Assembly Language
Homework 2, Due 2010/3/22
Problem 1
Overflow flag (Page 109, Problem 4)
Write a program that uses addition and subtraction to set and clear the Overflow flag. After each addition or subtraction instruction, insert the call DumpRegs statement to display the registers and flags. Using comments, explain how (and why) the Overflow flag was affected by each instruction.
Optional: include an ADD instruction that sets both the Carry and Overflow flags.
Problem 2
Arithmetic expression (Page 109, Problem 7)
Write a program that implements the following arithmetic expression:
EAX = -val2 + 7 - val3 + val1
In comments next to each instruction, write the hexadecimal value of EAX. Insert a call DumpRegs statement at the end of the program.
ftp your homework to
in the directory \HW2
by the following format:
檔案名稱:hw#_學號.zip
例如:資工同學,作業4
檔案名稱:hw4_a09755xx.zip. (注意:檔案名稱不能有中文)
The password is given in class.