The Art of Assembly Language the Art of Assembly Language (Brief Contents)
Total Page:16
File Type:pdf, Size:1020Kb
The Art of Assembly Language The Art of Assembly Language (Brief Contents) Forward Why Would Anyone Learn This Stuff? ................................................................ 1 Section One: ...................................................................................................................... 9 Chapter One Data Representation ..................................................................................... 11 Chapter Two Boolean Algebra .......................................................................................... 43 Chapter Three System Organization .................................................................................. 83 Chapter Four Memory Layout and Access ......................................................................... 145 Section Two: ...................................................................................................................... 193 Chapter Five Variables and Data Structures ...................................................................... 195 Chapter Six The 80x86 Instruction Set ............................................................................... 243 Chapter Seven The UCR Standard Library ......................................................................... 333 Chapter Eight MASM: Directives & Pseudo-Opcodes ....................................................... 355 Chapter Nine Arithmetic and Logical Operations ............................................................. 459 Chapter 10 Control Structures ............................................................................................ 521 Chapter 11 Procedures and Functions ............................................................................... 565 Section Three: .................................................................................................................... 637 Chapter 12 Procedures: Advanced Topics ......................................................................... 639 Chapter 13 MS-DOS, PC-BIOS, and File I/O ..................................................................... 699 Chapter 14 Floating Point Arithmetic ................................................................................. 771 Chapter 15 Strings and Character Sets ............................................................................... 819 Chapter 16 Pattern Matching .............................................................................................. 883 Section Four: ...................................................................................................................... 993 Chapter 17 Interrupts, Traps, and Exceptions ................................................................... 995 Chapter 18 Resident Programs ........................................................................................... 1025 Chapter 19 Processes, Coroutines, and Concurrency ....................................................... 1065 Section Five: ...................................................................................................................... 1151 Chapter 20 The PC Keyboard ............................................................................................. 1153 Chapter 21 The PC Parallel Ports ....................................................................................... 1199 Chapter 22 The PC Serial Ports .......................................................................................... 1223 Chapter 23 The PC Video Display ..................................................................................... 1247 Chapter 24 The PC Game Adapter ..................................................................................... 1255 Section Six: ........................................................................................................................ 1309 Chapter 25 Optimizing Your Programs ............................................................................. 1311 Section Seven: ................................................................................................................... 1343 Appendix A: ASCII/IBM Character Set ............................................................................... 1345 Appendix B: Annotated Bibliography ............................................................................... 1347 Page i Thi d t t d ith F M k 4 0 2 Appendix C: Keyboard Scan Codes ................................................................................... 1351 Appendix D: Instruction Set Reference .............................................................................. 1361 Page ii The Art of Assembly Language The Art of Assembly Language (Full Contents) Forward Why Would Anyone Learn This Stuff? .............................................................. 1 1 What’s Wrong With Assembly Language ............................................................................ 1 2 What’s Right With Assembly Language? ............................................................................. 4 3 Organization of This Text and Pedagogical Concerns ....................................................... 5 4 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 ............................................................................................................ 11 1.1 Numbering Systems .......................................................................................................... 11 1.1.1 A Review of the Decimal System ........................................................................... 11 1.1.2 The Binary Numbering System ............................................................................. 12 1.1.3 Binary Formats ....................................................................................................... 13 1.2 Data Organization ............................................................................................................ 13 1.2.1 Bits .......................................................................................................................... 14 1.2.2 Nibbles ................................................................................................................... 14 1.2.3 Bytes ....................................................................................................................... 14 1.2.4 Words ..................................................................................................................... 15 1.2.5 Double Words ........................................................................................................ 16 1.3 The Hexadecimal Numbering System .............................................................................. 17 1.4 Arithmetic Operations on Binary and Hexadecimal Numbers ........................................ 19 1.5 Logical Operations on Bits ............................................................................................... 20 1.6 Logical Operations on Binary Numbers and Bit Strings ................................................. 22 1.7 Signed and Unsigned Numbers ........................................................................................ 23 1.8 Sign and Zero Extension .................................................................................................. 25 1.9 Shifts and Rotates .............................................................................................................. 26 1.10 Bit Fields and Packed Data ............................................................................................. 28 1.11 The ASCII Character Set .................................................................................................. 28 1.12 Summary ......................................................................................................................... 31 1.13 Laboratory Exercises ....................................................................................................... 33 1.13.1 Installing the Software ......................................................................................... 33 1.13.2 Data Conversion Exercises .................................................................................. 34 1.13.3 Logical Operations Exercises ............................................................................... 35 1.13.4 Sign and Zero Extension Exercises ..................................................................... 36 1.13.5 Packed Data Exercises ......................................................................................... 37 1.14 Questions ........................................................................................................................ 38 1.15 Programming Projects .................................................................................................... 41 Chapter Two Boolean Algebra ...................................................................................... 43 2.0 Chapter Overview ...........................................................................................................