0
TITLE Allowance
INCLUDE irvine32.inc
.DATA
welcomeMessage BYTE "Welcome To Allowance Calculator", 0 ;
inputMessage BYTE "Please Enter Salary", 0 ;
salary WORD ?
allowance WORD ?
total WORD ?
ten WORD 10
five WORD 5
hundred WORD 100
limit WORD 2D
great BYTE "I'm in greater"
.CODE
main PROC
MOV EAX, 0
MOV EBX, 0
MOV ECX, 0
MOV EDX, 0
Sub limit, 1D
Call DumpRegs
MOV EDX, offset welcomeMessage
Call WriteString
MOV EDX, offset inputMessage
Call WriteString
Call ReadDec
MOV salary, Ax
cmp Ax, 100D
Call DumpRegs
Call WriteInt
JLE lesser
JG greater
greater:
MOV EDX, offset great
Call WriteString
MOV EAX, 0
MOV Ax, salary
MUL ten
DIV hundred
MOV allowance, Ax
Call WriteInt
JMP end1
lesser:
MOV EAX, 0
MOV Ax, salary
MUL five
DIV hundred
MOV allowance, Ax
Call WriteInt
JMP end1
end1:
exit
main ENDP
END主要CMP聲明不給正確的結果
當我使用CMP命令比較它只是帶我去JGE ..不管是什麼值..任何解決這個好嗎?
我也嘗試過使用JE並給出了相同的意見,但即使如此,它也把我帶到更大的標籤。
DumpRegs和/或WriteInt很可能重挫的標誌。 –