This program take a user input and determines if the value is negative or positive. I want to use a for loop so that a user can check multiple numbers, in this case I set the loop at three inputs. What I am having difficulty with is allowing the user to enter '0' to exit. JS does the same thing as JG & JL, i just commented them out to consolidate the two tests into one jump. When I add a conditional statement to check for zero I get a "jump" error of at least 5 bytes. Please help. I have commented out the faulty code. Thanks.
.586
.MODEL FLAT
INCLUDE io.h
.STACK 4096
.DATA
titleLbl BYTE "Is your number positive or negative ", 0
formula BYTE "It's anyones guess, well no not really, cuz conditional statements.....", 0
prompt BYTE "Please enter a number: (enter '0' to exit)", 0
string BYTE 40 DUP (?)
resultLbl BYTE "The number you entered is:", 0
positiveLbl BYTE "Positive", 0
negativeLbl BYTE "Negative", 0
zeroLbl BYTE "You Entered '0'", 0
zero_messageLbl BYTE "Exiting", 0
.CODE
_MainProc PROC
output titleLbl, formula
mov ecx, 3 ;the for loop will run 3 times
forCount: input prompt, string, 40 ; prompt user for a number
atod string ;convert to integer
cmp eax, 0 ;compare user input to value stored (0)
js negative
;jg positive ;jump conditional if input is greater than 0
;jl negative ;jump conditional if input is less than 0
;jz zero ;jump conditional if input is equal to 0
positive: ;condition if greater than; ouput
output resultLbl, positiveLbl ; output the even message
jmp exit
negative: ;condition if less than; ouput
output resultLbl, negativeLbl ; output the odd message
jmp exit
;zero: ;condition if equal to; ouput
;output zeroLbl, zero_messageLbl
;jmp exit
exit: ;quit jump ;end if/else/if conditional
loop forCount
quit:
mov eax, 0 ;clear memory
ret
_MainProc ENDP
END