PREFACE |
|
xiii | |
Part A Fundamentals of PC Hardware and Software |
|
1 | (48) |
|
1 BASIC FEATURES OF PC HARDWARE |
|
|
1 | (19) |
|
|
1 | (1) |
|
|
1 | (2) |
|
|
3 | (3) |
|
Hexadecimal Representation |
|
|
6 | (1) |
|
|
7 | (1) |
|
|
7 | (2) |
|
|
9 | (2) |
|
|
11 | (2) |
|
|
13 | (4) |
|
|
17 | (1) |
|
|
18 | (2) |
|
2 REQUIREMENTS FOR USING PC SOFTWARE |
|
|
20 | (9) |
|
|
20 | (1) |
|
Features of the Operating System |
|
|
20 | (1) |
|
|
21 | (1) |
|
|
22 | (1) |
|
The System Program Loader |
|
|
22 | (1) |
|
|
23 | (2) |
|
Addressing of Instructions and Data |
|
|
25 | (2) |
|
|
27 | (1) |
|
|
27 | (1) |
|
|
28 | (1) |
|
3 EXECUTING COMPUTER INSTRUCTIONS |
|
|
29 | (20) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
31 | (3) |
|
Machine Language Example I: Immediate Data |
|
|
34 | (4) |
|
Machine Language Example II: Defined Data |
|
|
38 | (3) |
|
An Assembly Language Example |
|
|
41 | (1) |
|
Using the INT Instruction |
|
|
42 | (3) |
|
Saving a Program from Within DEBUG |
|
|
45 | (1) |
|
|
45 | (1) |
|
|
46 | (1) |
|
|
47 | (2) |
Part B Fundamentals of Assembly Language |
|
49 | (90) |
|
4 REQUIREMENTS FOR CODING IN ASSEMBLY LANGUAGE |
|
|
49 | (24) |
|
|
49 | (1) |
|
|
50 | (1) |
|
|
50 | (1) |
|
|
51 | (1) |
|
|
51 | (1) |
|
|
52 | (1) |
|
|
53 | (4) |
|
Instructions for Initializing a Program |
|
|
57 | (2) |
|
Instructions for Ending Program Execution |
|
|
59 | (1) |
|
Example of a Source Program |
|
|
59 | (1) |
|
Initializing for Protected Mode |
|
|
60 | (1) |
|
Simplified Segment Directives |
|
|
61 | (1) |
|
|
62 | (3) |
|
Directives for Defining Data |
|
|
65 | (4) |
|
|
69 | (1) |
|
|
70 | (1) |
|
|
71 | (2) |
|
5 ASSEMBLING, LINKING, AND EXECUTING A PROGRAM |
|
|
73 | (18) |
|
|
73 | (1) |
|
Preparing a Program for Execution |
|
|
73 | (1) |
|
Assembling a Source Program |
|
|
74 | (2) |
|
Using Conventional Segment Definitions |
|
|
76 | (5) |
|
Using Simplified Segment Directives |
|
|
81 | (2) |
|
|
83 | (1) |
|
Linking an Object Program |
|
|
83 | (3) |
|
|
86 | (1) |
|
|
86 | (1) |
|
|
87 | (1) |
|
The Assembler Location Counter |
|
|
89 | (1) |
|
|
89 | (1) |
|
|
89 | (2) |
|
6 SYMBOLIC INSTRUCTIONS AND ADDRESSING |
|
|
91 | (17) |
|
|
91 | (1) |
|
The Symbolic Instruction Set |
|
|
91 | (3) |
|
|
94 | (3) |
|
|
97 | (1) |
|
Move-and-Fill Instructions |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
The INC and DEC Instructions |
|
|
101 | (1) |
|
|
101 | (2) |
|
|
103 | (1) |
|
|
104 | (1) |
|
|
104 | (1) |
|
The Segment Override Prefix |
|
|
105 | (1) |
|
|
105 | (1) |
|
|
106 | (2) |
|
|
108 | (6) |
|
|
108 | (1) |
|
Differences Between an .EXE and a .COM Program |
|
|
108 | (1) |
|
Converting into .COM Format |
|
|
109 | (1) |
|
Example of a .COM Program |
|
|
110 | (1) |
|
|
111 | (1) |
|
|
112 | (1) |
|
|
112 | (1) |
|
|
113 | (1) |
|
8 PROGRAMMING REQUIREMENTS FOR LOGIC AND CONTROL |
|
|
114 | (25) |
|
|
114 | (1) |
|
Short, Near, and Far Addresses |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
116 | (2) |
|
|
118 | (1) |
|
|
119 | (1) |
|
|
120 | (1) |
|
Conditional Jump Instructions |
|
|
121 | (2) |
|
|
123 | (3) |
|
Effect of Program Execution on the Stack |
|
|
126 | (1) |
|
|
127 | (2) |
|
Program: Changing Uppercase to Lowercase |
|
|
129 | (1) |
|
|
130 | (2) |
|
|
132 | (2) |
|
|
134 | (2) |
|
|
136 | (1) |
|
|
137 | (1) |
|
|
137 | (2) |
Part C Screen and Keyboard Operations |
|
139 | (64) |
|
9 INTRODUCTION TO SCREEN AND KEYBOARD PROCESSING |
|
|
139 | (17) |
|
|
139 | (1) |
|
|
140 | (1) |
|
|
140 | (1) |
|
|
141 | (1) |
|
INT 21H Function 09H for Screen Display |
|
|
142 | (2) |
|
INT 21H Function OAH for Keyboard Input |
|
|
144 | (1) |
|
Program: Accepting and Displaying Names |
|
|
145 | (4) |
|
Using Control Characters in a Screen Display |
|
|
149 | (1) |
|
INT 21H Function 02H for Screen Display |
|
|
150 | (1) |
|
|
150 | (1) |
|
INT 21H Function 40H for Screen Display |
|
|
151 | (1) |
|
INT 21H Function 3FH for Keyboard Input |
|
|
152 | (2) |
|
|
154 | (1) |
|
|
154 | (2) |
|
10 ADVANCED FEATURES OF SCREEN PROCESSING |
|
|
156 | (29) |
|
|
156 | (1) |
|
|
157 | (1) |
|
|
157 | (1) |
|
|
158 | (3) |
|
|
161 | (1) |
|
Using INT IOH for Text Mode |
|
|
161 | (6) |
|
Program: Displaying the ASCII Character Set |
|
|
167 | (3) |
|
ASCII Characters for Boxes and Menus |
|
|
170 | (1) |
|
Program: Blinking, Reverse Video, and Scrolling |
|
|
171 | (2) |
|
|
173 | (2) |
|
|
175 | (2) |
|
|
177 | (3) |
|
Program: Setting and Displaying Graphics Mode |
|
|
180 | (2) |
|
Determining the Type of Video Adapter |
|
|
182 | (1) |
|
|
182 | (1) |
|
|
183 | (2) |
|
11 ADVANCED FEATURES OF KEYBOARD PROCESSING |
|
|
185 | (18) |
|
|
185 | (1) |
|
|
186 | (1) |
|
|
186 | (1) |
|
|
187 | (1) |
|
Using INT 2IH for Keyboard Input |
|
|
188 | (1) |
|
Using INT I6H for Keyboard Input |
|
|
189 | (2) |
|
Extended Function Keys and Scan Codes |
|
|
191 | (2) |
|
Program: Selecting from a Menu |
|
|
193 | (4) |
|
BIOS INT 09H and the Keyboard Buffer |
|
|
197 | (4) |
|
Keying in the Full ASCII Character Set |
|
|
201 | (1) |
|
|
201 | (1) |
|
|
202 | (1) |
Part D Data Manipulation |
|
203 | (86) |
|
12 PROCESSING STRING DATA |
|
|
203 | (17) |
|
|
203 | (1) |
|
Features of String Operations |
|
|
204 | (1) |
|
REP: Repeat String Prefix |
|
|
204 | (1) |
|
MOVS: Move String Instruction |
|
|
205 | (2) |
|
LODS: Load String Instruction |
|
|
207 | (1) |
|
STOS: Store String Instruction |
|
|
208 | (1) |
|
Program: Using LODS and STOS to Transfer Data |
|
|
209 | (2) |
|
CMPS: Compare String Instruction |
|
|
211 | (2) |
|
SCAS: Scan String Instruction |
|
|
213 | (1) |
|
Example: Using Scan and Replace |
|
|
214 | (1) |
|
Alternative Coding for String Instructions |
|
|
214 | (1) |
|
|
215 | (1) |
|
Program: Right Adjusting a Screen Display |
|
|
215 | (3) |
|
|
218 | (1) |
|
|
218 | (2) |
|
13 ARITHMETIC: I-- PROCESSING BINARY DATA |
|
|
220 | (24) |
|
|
220 | (1) |
|
Processing Unsigned and Signed Data |
|
|
221 | (1) |
|
|
222 | (2) |
|
Extending Values in a Register |
|
|
224 | (1) |
|
Performing Arithmetic on Doubleword Values |
|
|
225 | (2) |
|
|
227 | (3) |
|
Performing Doubleword Multiplication |
|
|
231 | (3) |
|
Special Multiplication Instructions |
|
|
234 | (1) |
|
Multiplication by Shifting |
|
|
235 | (1) |
|
|
235 | (4) |
|
|
239 | (1) |
|
|
240 | (1) |
|
The Numeric Data Processor |
|
|
240 | (2) |
|
|
242 | (1) |
|
|
243 | (1) |
|
14 ARITHMETIC: II-- PROCESSING ASCII AND BCD DATA |
|
|
244 | (21) |
|
|
244 | (1) |
|
|
245 | (1) |
|
|
246 | (3) |
|
Processing Unpacked BCD Data |
|
|
249 | (2) |
|
Processing Packed BCD Data |
|
|
251 | (2) |
|
Converting ASCII Data to Binary Format |
|
|
253 | (2) |
|
Converting Binary Data to ASCII Format |
|
|
255 | (2) |
|
Shifting and Rounding a Product |
|
|
257 | (1) |
|
Program: Converting ASCII Data |
|
|
257 | (6) |
|
|
263 | (1) |
|
|
264 | (1) |
|
15 DEFINING AND PROCESSING TABLES |
|
|
265 | (24) |
|
|
265 | (1) |
|
|
265 | (1) |
|
Direct Addressing of Table Entries |
|
|
267 | (4) |
|
|
271 | (6) |
|
The XLAT (Translate) Instruction |
|
|
277 | (1) |
|
Program: Displaying Hex and ASCII Characters |
|
|
278 | (2) |
|
|
280 | (1) |
|
|
281 | (5) |
|
The TYPE, LENGTH, and SIZE Operators |
|
|
286 | (1) |
|
|
286 | (1) |
|
|
287 | (2) |
Part E Advanced Input/Output |
|
289 | (111) |
|
16 DISK STORAGE I: ORGANIZATION |
|
|
289 | (15) |
|
|
289 | (1) |
|
|
289 | (3) |
|
The Disk System Area and Data Area |
|
|
292 | (2) |
|
|
294 | (1) |
|
|
294 | (2) |
|
The File Allocation Table |
|
|
296 | (3) |
|
Exercise: Examining the FAT |
|
|
299 | (3) |
|
|
302 | (1) |
|
|
302 | (1) |
|
|
302 | (2) |
|
17 DISK STORAGE II: WRITING AND READING FILES |
|
|
304 | (28) |
|
|
304 | (1) |
|
|
305 | (1) |
|
|
305 | (1) |
|
|
305 | (1) |
|
|
306 | (1) |
|
Using File Handles to Create Disk Files |
|
|
306 | (5) |
|
Using File Handles to Read Disk Files |
|
|
311 | (2) |
|
Using File Handles for Random Processing |
|
|
313 | (7) |
|
Program: Processing an ASCII File |
|
|
320 | (4) |
|
|
324 | (1) |
|
Disk Services Using File Control Blocks |
|
|
325 | (5) |
|
|
330 | (1) |
|
|
330 | (2) |
|
18 DISK STORAGE III: INT 21H FUNCTIONS FOR SUPPORTING DISKS AND FILES |
|
|
332 | (25) |
|
|
332 | (1) |
|
Operations Handling Disk Drives |
|
|
333 | (9) |
|
Program: Reading Data from Sectors |
|
|
342 | (3) |
|
Operations Handling the Directory and the FAT |
|
|
345 | (1) |
|
Program: Displaying the Directory |
|
|
346 | (2) |
|
Operations Handling Disk Files |
|
|
348 | (5) |
|
Program: Selectively Deleting Files |
|
|
353 | (3) |
|
|
356 | (1) |
|
|
356 | (1) |
|
19 DISK STORAGE IV: INT 13H DISK FUNCTIONS |
|
|
357 | (12) |
|
|
357 | (1) |
|
|
358 | (1) |
|
Basic INT 13H Disk Operations |
|
|
358 | (2) |
|
Program: Using INT 13H to Read Sectors |
|
|
360 | (3) |
|
Other INT 13H Disk Operations |
|
|
363 | (5) |
|
|
368 | (1) |
|
|
368 | (1) |
|
20 FACILITIES FOR PRINTING |
|
|
369 | (14) |
|
|
369 | (1) |
|
Common Printer Control Characters |
|
|
370 | (1) |
|
INT 21H Function 40H: Print Characters |
|
|
370 | (1) |
|
Program: Printing With Page Overflow and Headings |
|
|
371 | (3) |
|
Program: Printing ASCII Files and Handling Tabs |
|
|
374 | (4) |
|
INT 21H Function 05H: Print Character |
|
|
378 | (1) |
|
Special Printer Control Characters |
|
|
379 | (1) |
|
INT 17H Functions for Printing |
|
|
380 | (1) |
|
|
381 | (1) |
|
|
381 | (2) |
|
21 OTHER INPUT/OUTPUT FACILITIES |
|
|
383 | (17) |
|
|
383 | (1) |
|
|
383 | (1) |
|
|
384 | (1) |
|
Common INT 33H Operations |
|
|
385 | (6) |
|
|
391 | (3) |
|
|
394 | (1) |
|
|
395 | (2) |
|
|
397 | (1) |
|
|
397 | (1) |
|
|
398 | (2) |
Part F Advanced Programming |
|
400 | (78) |
|
22 DEFINING AND USING MACROS |
|
|
400 | (19) |
|
|
400 | (1) |
|
Two Simple Macro Definitions |
|
|
401 | (1) |
|
Using Parameters in Macros |
|
|
402 | (1) |
|
|
403 | (2) |
|
Using a Macro Within a Macro Definition |
|
|
405 | (2) |
|
|
407 | (1) |
|
Including Macros from a Library |
|
|
407 | (3) |
|
|
410 | (1) |
|
|
410 | (2) |
|
|
412 | (4) |
|
|
416 | (1) |
|
|
417 | (2) |
|
23 LINKING TO SUBPROGRAMS |
|
|
419 | (26) |
|
|
419 | (1) |
|
|
420 | (1) |
|
|
421 | (1) |
|
|
422 | (1) |
|
The EXTRN and PUBLIC Attributes |
|
|
423 | (2) |
|
Using EXTRN and PUBLIC for an Entry Point |
|
|
425 | (2) |
|
Defining the Code Segment as PUBLIC |
|
|
427 | (2) |
|
Using Simplified Segment Directives |
|
|
429 | (1) |
|
Defining Common Data as PUBLIC |
|
|
430 | (1) |
|
Defining Data in Both Programs |
|
|
431 | (2) |
|
Passing Parameters to a Subprogram |
|
|
433 | (3) |
|
Linking Pascal with an Assembly Language Program |
|
|
436 | (4) |
|
Linking C with an Assembly Language Program |
|
|
440 | (2) |
|
|
442 | (2) |
|
|
444 | (1) |
|
|
445 | (33) |
|
|
445 | (1) |
|
|
445 | (1) |
|
|
446 | (1) |
|
The Program Segment Prefix |
|
|
447 | (5) |
|
|
452 | (3) |
|
Memory Allocation Strategy |
|
|
455 | (1) |
|
|
456 | (6) |
|
Allocating and Freeing Memory |
|
|
462 | (1) |
|
Loading or Executing a Program Function |
|
|
463 | (1) |
|
|
464 | (6) |
|
|
470 | (5) |
|
|
475 | (1) |
|
|
476 | (2) |
Part G Reference Chapters |
|
478 | (79) |
|
25 BIOS DATA AREAS AND PROGRAM INTERRUPTS |
|
|
478 | (19) |
|
|
478 | (1) |
|
|
478 | (1) |
|
|
479 | (3) |
|
|
482 | (1) |
|
|
483 | (4) |
|
|
487 | (1) |
|
|
487 | (1) |
|
|
488 | (6) |
|
|
494 | (1) |
|
|
495 | (2) |
|
26 OPERATORS AND DIRECTIVES |
|
|
497 | (28) |
|
|
497 | (1) |
|
|
497 | (1) |
|
|
498 | (6) |
|
|
504 | (21) |
|
27 THE PC INSTRUCTION SET |
|
|
525 | (32) |
|
|
525 | (1) |
|
|
526 | (1) |
|
|
526 | (1) |
|
|
527 | (1) |
|
|
528 | (1) |
|
|
528 | (1) |
|
|
529 | (28) |
APPENDIXES |
|
557 | (26) |
A Conversion Between Hexadecimal and Decimal Numbers |
|
557 | (3) |
B ASCII Character Codes |
|
560 | (2) |
C Reserved Words |
|
562 | (2) |
D Assembler and Link Options |
|
564 | (8) |
E The DEBUG Program |
|
572 | (7) |
F Keyboard Scan Codes and ASCII Codes |
|
579 | (4) |
ANSWERS TO SELECTED QUESTIONS |
|
583 | (12) |
INDEX |
|
595 | |