CS301 – Fall 2003
Prof. Hartman
Homework #3
Due Monday, October 6th by 4:45 pm
int
a, i, z;
cout
<< "Enter z (z>0): ";
cin
>> z;
for
(i=0; i<=z; i++)
{
a = i % 2;
if (a == 0)
cout << i << endl;
}
You may use the I/O routines from Carter’s book. Refer to the handout about using NASM with Windows and Visual C++ for links to the I/O files if you don’t have them. Hand in your program listing and a sample run showing z=10. Explain in English what the program does. For full credit you must turn in a well-commented listing including your name and the problem number.
|
Instruction |
Before |
After |
a) |
mov cx,25h |
; cx = 0000h |
cx = |
b) |
mov cl,0 |
; cx = 0ffffh |
cx = |
c) |
mov dh,[BYTE1] |
; dx = 0beefh |
dx = |
d) |
xchg ah,al |
; ax = 1234h |
ax = |
e) |
xor eax,eax |
; eax = 12345678h |
eax = |
f) |
inc dl |
; dx = 0ffffh |
dx = |
g) |
inc dx |
; dx = 0ffffh |
dx = |