Hi guys, first of all forgive me if my English is not perfect but this is not my first language.
Anyway what I'm trying to do is just comparing two numbers. More precisely I have to verify that a number is less than or equal to 64000. What I'm doing is reading the string typed by the user and converting it into a number (this should be OK since I make it display the number after conversion and it is always right) stored in NUM, defined as
NUM DW 0
Then I try to compare this number with 64000 by doing this:
MOV AX,NUM
CMP AX,NUM_MAX
JLE NO_ERR_SUP
CALL ERR_SUP
JMP START
......
where NUM_MAX is defined as
NUM_MAX DW 64000
The problem is it (rightly) accepts 45678 but not 34 or 100. After some tests I found out that the smallest number accepted is 32768 which is 2^15.
How can I solve this?
Thank you!
JLE does a signed comparison, so 32768 is negative.
jae does unsigned comparison, so 32768 to 65535 are positive.
Thank you very much, I don't know how I could miss that! :icon_redface:
In fact I had understood that it had something to do with the first byte but couldn't solve the problem.
Thank you again!