0
我有一個組件86問題計算組件86的算術表達式
INCLUDE Irvine32.inc
.data
day WORD 0
month WORD 0
year WORD 0
count BYTE 0
prompt1 BYTE "enter month: ",0
prompt2 BYTE "enter day: ",0
prompt3 BYTE "enter an year: ",0
prompt4 BYTE " the day of the week is ",0
.code
main PROC
mov edx, OFFSET prompt1
call writeString
mov edx, 0
mov eax, OFFSET month
mov ecx, 19
call readInt
call crlf
mov eax, 0
mov ecx, 0
mov edx, OFFSET prompt2
call writeString
mov edx, 0
mov eax, OFFSET day
mov ecx, 19
call readInt
call crlf
mov eax, 0
mov ecx, 0
mov edx, OFFSET prompt3
call writeString
mov edx, 0
mov eax, OFFSET year
mov ecx, 19
call readInt
call crlf
mov eax, 0
mov ecx, 0
mov ebx, 0
mov ax, 14
sub ax, month
mov bx, 12
div bx
mov ebx, 0
sub year, ax
mov ecx, 0
mov cx, year
exit
main ENDP
END main
所以我必須做2運算式爲這個編碼
a = (14 - month)/12
y = year - a
這是我的輸入
enter month: 4
enter day: 15
enter an year: 2013
我期待在最後一條指令之後y的值是7dd(2013)
但我得到的寄存器ecx的值是0000FFFF,爲什麼不是y 7dd的值,但FFFF
任何人都可以幫忙嗎? 預先感謝
仔細看一下分割的結果。 – 2013-05-03 04:46:48