General

The Art of Assembly Language

Description
The Art of Assembly Language
Categories
Published
of 1426
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
   The Art of Assembly LanguagePage i  The Art of Assembly Language (Brief Contents)  Forward Why Would Anyone Learn This Stuff? ................................................................ 1 Section One: ...................................................................................................................... 9Chapter One Data Representation ..................................................................................... 11Chapter Two Boolean Algebra .......................................................................................... 43Chapter Three System Organization .................................................................................. 83Chapter Four Memory Layout and Access ......................................................................... 145 Section Two: ...................................................................................................................... 193Chapter Five Variables and Data Structures ...................................................................... 195Chapter Six The 80x86 Instruction Set ............................................................................... 243Chapter Seven The UCR Standard Library ......................................................................... 333Chapter Eight MASM: Directives & Pseudo-Opcodes ....................................................... 355Chapter Nine Arithmetic and Logical Operations ............................................................. 459Chapter 10 Control Structures ............................................................................................ 521Chapter 11 Procedures and Functions ............................................................................... 565 Section Three: .................................................................................................................... 637Chapter 12 Procedures: Advanced Topics ......................................................................... 639Chapter 13 MS-DOS, PC-BIOS, and File I/O ..................................................................... 699Chapter 14 Floating Point Arithmetic ................................................................................. 771Chapter 15 Strings and Character Sets ............................................................................... 819Chapter 16 Pattern Matching .............................................................................................. 883 Section Four: ...................................................................................................................... 993Chapter 17 Interrupts, Traps, and Exceptions ................................................................... 995Chapter 18 Resident Programs ........................................................................................... 1025Chapter 19 Processes, Coroutines, and Concurrency ....................................................... 1065 Section Five: ...................................................................................................................... 1151Chapter 20 The PC Keyboard ............................................................................................. 1153Chapter 21 The PC Parallel Ports ....................................................................................... 1199Chapter 22 The PC Serial Ports .......................................................................................... 1223Chapter 23 The PC Video Display ..................................................................................... 1247Chapter 24 The PC Game Adapter ..................................................................................... 1255 Section Six: ........................................................................................................................ 1309Chapter 25 Optimizing Your Programs ............................................................................. 1311 Section Seven: ................................................................................................................... 1343Appendix A: ASCII/IBM Character Set ............................................................................... 1345Appendix B: Annotated Bibliography ............................................................................... 1347     Page ii  Appendix C: Keyboard Scan Codes ................................................................................... 1351Appendix D: Instruction Set Reference .............................................................................. 1361   The Art of Assembly LanguagePage iii  The Art of Assembly Language(Full Contents)  Forward Why Would Anyone Learn This Stuff? .............................................................. 1  1 What’s Wrong With Assembly Language ............................................................................12 What’s Right With Assembly Language? .............................................................................43 Organization of This Text and Pedagogical Concerns .......................................................54 Obtaining Program Source Listings and Other Materials in This Text ...............................7  Section One: ................................................................................................................... 9  Machine Organization ...........................................................................................................9  Chapter One Data Representation ................................................................................ 11  1.0 Chapter Overview ............................................................................................................111.1 Numbering Systems ..........................................................................................................111.1.1 A Review of the Decimal System ...........................................................................111.1.2 The Binary Numbering System .............................................................................121.1.3 Binary Formats .......................................................................................................131.2 Data Organization ............................................................................................................131.2.1 Bits ..........................................................................................................................141.2.2 Nibbles ...................................................................................................................141.2.3 Bytes .......................................................................................................................141.2.4 Words .....................................................................................................................151.2.5 Double Words ........................................................................................................161.3 The Hexadecimal Numbering System ..............................................................................171.4 Arithmetic Operations on Binary and Hexadecimal Numbers ........................................191.5 Logical Operations on Bits ...............................................................................................201.6 Logical Operations on Binary Numbers and Bit Strings .................................................221.7 Signed and Unsigned Numbers ........................................................................................231.8 Sign and Zero Extension ..................................................................................................251.9 Shifts and Rotates ..............................................................................................................261.10 Bit Fields and Packed Data .............................................................................................281.11 The ASCII Character Set ..................................................................................................281.12 Summary .........................................................................................................................311.13 Laboratory Exercises .......................................................................................................331.13.1 Installing the Software .........................................................................................331.13.2 Data Conversion Exercises ..................................................................................341.13.3 Logical Operations Exercises ...............................................................................351.13.4 Sign and Zero Extension Exercises .....................................................................361.13.5 Packed Data Exercises .........................................................................................371.14 Questions ........................................................................................................................381.15 Programming Projects ....................................................................................................41  Chapter Two Boolean Algebra ...................................................................................... 43  2.0 Chapter Overview ............................................................................................................432.1 Boolean Algebra ...............................................................................................................43     Page iv  2.2 Boolean Functions and Truth Tables ................................................................................452.3 Algebraic Manipulation of Boolean Expressions .............................................................482.4 Canonical Forms ................................................................................................................492.5 Simplification of Boolean Functions .................................................................................522.6 What Does This Have To Do With Computers, Anyway? ................................................592.6.1 Correspondence Between Electronic Circuits and Boolean Functions ................592.6.2 Combinatorial Circuits ............................................................................................602.6.3 Sequential and Clocked Logic ................................................................................622.7 Okay, What Does It Have To Do With Programming, Then? ..........................................642.8 Generic Boolean Functions ..............................................................................................652.9 Laboratory Exercises .........................................................................................................692.9.1 Truth Tables and Logic Equations Exercises .........................................................702.9.2 Canonical Logic Equations Exercises .....................................................................712.9.3 Optimization Exercises ...........................................................................................722.9.4 Logic Evaluation Exercises .....................................................................................722.10 Programming Projects .....................................................................................................772.11 Summary ..........................................................................................................................782.12 Questions .........................................................................................................................80  Chapter Three System Organization .............................................................................. 83  3.0 Chapter Overview .............................................................................................................833.1 The Basic System Components .........................................................................................833.1.1 The System Bus ......................................................................................................843.1.1.1 The Data Bus ................................................................................................ 843.1.1.2 The Address Bus ........................................................................................... 863.1.1.3 The Control Bus ............................................................................................ 863.1.2 The Memory Subsystem .........................................................................................873.1.3 The I/O Subsystem .................................................................................................923.2 System Timing ...................................................................................................................923.2.1 The System Clock ...................................................................................................923.2.2 Memory Access and the System Clock ...................................................................933.2.3 Wait States ...............................................................................................................953.2.4 Cache Memory ........................................................................................................963.3 The 886, 8286, 8486, and 8686 “Hypothetical” Processors ..............................................993.3.1 CPU Registers ..........................................................................................................993.3.2 The Arithmetic & Logical Unit ................................................................................1003.3.3 The Bus Interface Unit ............................................................................................1003.3.4 The Control Unit and Instruction Sets ....................................................................1003.3.5 The x86 Instruction Set ...........................................................................................1023.3.6 Addressing Modes on the x86 ................................................................................1033.3.7 Encoding x86 Instructions ......................................................................................1043.3.8 Step-by-Step Instruction Execution ........................................................................1073.3.9 The Differences Between the x86 Processors .......................................................1093.3.10 The 886 Processor ................................................................................................1103.3.11 The 8286 Processor ...............................................................................................1103.3.12 The 8486 Processor ...............................................................................................1163.3.12.1 The 8486 Pipeline ....................................................................................... 1173.3.12.2 Stalls in a Pipeline ....................................................................................... 1183.3.12.3 Cache, the Prefetch Queue, and the 8486 .................................................. 119   The Art of Assembly LanguagePage v  3.3.12.4 Hazards on the 8486 .................................................................................. 1223.3.13 The 8686 Processor ..............................................................................................1233.4 I/O (Input/Output) ...........................................................................................................1243.5 Interrupts and Polled I/O .................................................................................................1263.6 Laboratory Exercises .........................................................................................................1283.6.1 The SIMx86 Program – Some Simple x86 Programs .............................................1283.6.2 Simple I/O-Mapped Input/Output Operations .....................................................1313.6.3 Memory Mapped I/O .............................................................................................1323.6.4 DMA Exercises .......................................................................................................1333.6.5 Interrupt Driven I/O Exercises ..............................................................................1343.6.6 Machine Language Programming & Instruction Encoding Exercises ...................1353.6.7 Self Modifying Code Exercises ..............................................................................1363.7 Programming Projects ......................................................................................................1383.8 Summary ...........................................................................................................................1393.9 Questions ..........................................................................................................................142  Chapter Four Memory Layout and Access .................................................................. 145  4.0 Chapter Overview ............................................................................................................1454.1 The 80x86 CPUs:A Programmer’s View ...........................................................................1454.1.1 8086 General Purpose Registers ............................................................................1464.1.2 8086 Segment Registers .........................................................................................1474.1.3 8086 Special Purpose Registers .............................................................................1484.1.4 80286 Registers ......................................................................................................1484.1.5 80386/80486 Registers ...........................................................................................1494.2 80x86 Physical Memory Organization .............................................................................1504.3 Segments on the 80x86 .....................................................................................................1514.4 Normalized Addresses on the 80x86 ................................................................................1544.5 Segment Registers on the 80x86 .......................................................................................1554.6 The 80x86 Addressing Modes ..........................................................................................1554.6.1 8086 Register Addressing Modes ...........................................................................1564.6.2 8086 Memory Addressing Modes ..........................................................................1564.6.2.1 The Displacement Only Addressing Mode ................................................. 1564.6.2.2 The Register Indirect Addressing Modes ..................................................... 1584.6.2.3 Indexed Addressing Modes ......................................................................... 1594.6.2.4 Based Indexed Addressing Modes .............................................................. 1604.6.2.5 Based Indexed Plus Displacement Addressing Mode ................................ 1604.6.2.6 An Easy Way to Remember the 8086 Memory Addressing Modes ............. 1624.6.2.7 Some Final Comments About 8086 Addressing Modes .............................. 1624.6.3 80386 Register Addressing Modes .........................................................................1634.6.4 80386 Memory Addressing Modes ........................................................................1634.6.4.1 Register Indirect Addressing Modes ............................................................ 1634.6.4.2 80386 Indexed, Base/Indexed, and Base/Indexed/Disp Addressing Modes 1644.6.4.3 80386 Scaled Indexed Addressing Modes ................................................... 1654.6.4.4 Some Final Notes About the 80386 Memory Addressing Modes ................ 1654.7 The 80x86 MOV Instruction .............................................................................................1664.8 Some Final Comments on the MOV Instructions .............................................................1694.9 Laboratory Exercises .........................................................................................................1694.9.1 The UCR Standard Library for 80x86 Assembly Language Programmers .............1694.9.2 Editing Your Source Files ......................................................................................170
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x