|
1 Variables, Registers, and Data Movement |
|
|
1 | (16) |
|
|
1 | (1) |
|
|
2 | (2) |
|
|
4 | (2) |
|
|
6 | (1) |
|
|
7 | (3) |
|
|
10 | (1) |
|
|
11 | (1) |
|
|
12 | (1) |
|
1.9 Complete Program: Implementing Inline Assembly in C |
|
|
13 | (1) |
|
|
14 | (1) |
|
1.11 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
14 | (3) |
|
|
17 | (12) |
|
|
17 | (1) |
|
|
17 | (2) |
|
|
19 | (2) |
|
|
21 | (2) |
|
2.5 Complete Program: Using Input, Data Transfer, and Output |
|
|
23 | (1) |
|
|
24 | (1) |
|
2.7 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
25 | (4) |
|
3 Arithmetic Instructions |
|
|
29 | (18) |
|
3.1 Addition and Subtraction |
|
|
29 | (2) |
|
3.2 Multiplication and Division |
|
|
31 | (5) |
|
3.3 Implementing Unary Operators: Increment, Decrement, and Negation |
|
|
36 | (3) |
|
3.4 Order of Operations with Binary and Unary Operators |
|
|
39 | (2) |
|
3.5 Complete Program: Impementing I/O and Arithmetic |
|
|
41 | (2) |
|
|
43 | (1) |
|
3.7 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
43 | (4) |
|
|
47 | (24) |
|
|
47 | (1) |
|
|
48 | (5) |
|
4.3 If-Then-Else Structure |
|
|
53 | (1) |
|
|
54 | (3) |
|
|
57 | (2) |
|
4.6 Characters and Logical Operations |
|
|
59 | (5) |
|
4.7 Arithmetic Expressions in High-Level Directives |
|
|
64 | (2) |
|
4.8 Complete Program: Using Selection Structures and I/O |
|
|
66 | (3) |
|
|
69 | (1) |
|
4.10 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
69 | (2) |
|
|
71 | (20) |
|
5.1 Pre-test Loop Structure |
|
|
71 | (3) |
|
5.2 Post-test Loop Structures |
|
|
74 | (2) |
|
5.3 Fixed-Iteration Loop Structures |
|
|
76 | (2) |
|
5.4 Loops and Input/Output |
|
|
78 | (4) |
|
|
82 | (2) |
|
5.6 Complete Program: Implementing the Power Function |
|
|
84 | (3) |
|
|
87 | (1) |
|
5.8 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
87 | (4) |
|
6 Logic, Shifting, Rotating, and Stacks |
|
|
91 | (24) |
|
|
91 | (1) |
|
|
91 | (4) |
|
6.3 Logical Shift Instructions |
|
|
95 | (4) |
|
6.4 Arithmetic Shift Instructions |
|
|
99 | (3) |
|
|
102 | (2) |
|
|
104 | (3) |
|
6.7 Swapping Using Registers, the Stack, and the xchg Instruction |
|
|
107 | (2) |
|
6.8 Complete Program: Simulating an OCR Machine |
|
|
109 | (3) |
|
|
112 | (1) |
|
6.10 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
113 | (2) |
|
|
115 | (32) |
|
|
115 | (4) |
|
7.2 Complete Program: Implementing the Power Function in a Procedure |
|
|
119 | (3) |
|
7.3 Saving and Restoring Registers |
|
|
122 | (1) |
|
|
123 | (6) |
|
|
129 | (3) |
|
7.6 Swap Macro Revisited Using Conditional Assembly |
|
|
132 | (4) |
|
7.7 Power Function Macro Using Conditional Assembly |
|
|
136 | (3) |
|
7.8 Complete Program: Implementing a Macro Calculator |
|
|
139 | (6) |
|
|
145 | (1) |
|
7.10 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
146 | (1) |
|
|
147 | (26) |
|
8.1 Array Declaration and Addressing |
|
|
147 | (3) |
|
8.2 Indexing Using the Base Register |
|
|
150 | (3) |
|
|
153 | (2) |
|
8.4 Indexing Using the esi and edi Registers |
|
|
155 | (6) |
|
8.5 Lengthof and sizeof Operators |
|
|
161 | (1) |
|
8.6 Complete Program: Implementing a Queue |
|
|
162 | (5) |
|
8.7 Complete Program: Implementing the Selection Sort |
|
|
167 | (4) |
|
|
171 | (1) |
|
8.9 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
171 | (2) |
|
|
173 | (18) |
|
|
173 | (2) |
|
9.2 String Instructions: Moving Strings (movsb) |
|
|
175 | (2) |
|
9.3 String Instructions: Scanning (scasb), Storing (stosb), and Loading (lodsb) |
|
|
177 | (2) |
|
|
179 | (2) |
|
9.5 String Instructions: Comparing Strings (cmpsb) |
|
|
181 | (5) |
|
9.6 Complete Program: Searching an Array of Strings |
|
|
186 | (2) |
|
|
188 | (1) |
|
9.8 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
189 | (2) |
|
10 Selected Machine Language Instructions |
|
|
191 | (18) |
|
|
191 | (1) |
|
10.2 Inc and dec Instructions |
|
|
191 | (3) |
|
|
194 | (5) |
|
10.4 Add and sub Instructions |
|
|
199 | (1) |
|
10.5 Mov offset and lea Instructions |
|
|
200 | (2) |
|
|
202 | (1) |
|
|
203 | (1) |
|
10.8 Complete Program: Machine Language Listing |
|
|
204 | (2) |
|
|
206 | (1) |
|
10.10 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
207 | (2) |
|
Appendix A Installation of Visual C++ and MASM |
|
|
209 | (6) |
|
A.1 Directions for Installing Visual C++ and MASM |
|
|
209 | (1) |
|
A.2 Writing C Programs and Inline Assembly |
|
|
210 | (1) |
|
A.3 Writing Stand-alone MASM Programs |
|
|
211 | (2) |
|
|
213 | (2) |
|
Appendix B Binary, Hexadecimal, Logic, and Arithmetic |
|
|
215 | (20) |
|
B.1 Decimal and Binary Numbers |
|
|
215 | (3) |
|
|
218 | (2) |
|
|
220 | (2) |
|
B.4 Unsigned Numbers and Addition |
|
|
222 | (1) |
|
|
223 | (2) |
|
B.6 Addition and Subtraction of Signed Numbers |
|
|
225 | (3) |
|
|
228 | (1) |
|
|
229 | (1) |
|
|
230 | (1) |
|
B.10 Exercises (Items Marked with an Have Solutions in Appendix E) |
|
|
231 | (4) |
|
|
235 | (4) |
|
Appendix D Selected Assembly Language Instructions |
|
|
239 | (8) |
|
Appendix E Answers to Selected Exercises |
|
|
247 | (6) |
Index |
|
253 | |