I have written this program from a diagram given to me. I just can't figure out where and how to stop it from running. It keeps asking for inputs forever. Where to add exit command in my program? Any idea?
Thank you.
INCLUDE Irvine32.inc
.data
A DWord ?
B dword ?
prompta byte "what is your digit a?",0
promptb byte "what is your digit b?",0
message0 byte "you are in s0 with output ",0
message1 byte "you are in s1 with output ",0
message2 byte "you are in s2 with output ",0
message3 byte "you are in s3 with output ",0
.code
main PROC
call s0
call waitmsg
Initial State is S0
myexit proc
mov eax, white+16*black
call settextcolor
call waitmsg
ret
myexit endp
This exit procedure here isn't working
readdigits proc
mov edx, offset prompta
call writestring
call readint ; dword into eax
mov a,eax
mov edx, offset promptb
call writestring
call readint
mov b,eax
ret
readdigits endp
Procedures for S0,S1,S2,S3 Start here
s0 proc
mov edx,offset message0
call writestring
mov eax,0 ;Output is 0 in State 0
call writedec
call crlf
call readdigits
.if(a==0)&&(b==0)
call s0
.endif
.if(a==1)&&(b==1)
call s1
.endif
call s2
ret
s0 endp
s1 proc
mov edx,offset message1
call writestring
mov eax,0 ;Output is 1 in State 0
call writedec
call crlf
call readdigits
.if(a==0)&&(b==0)
call s2
.endif
.if(a==1)&&(b==1)
call s3
.endif
call s1
ret
s1 endp
s2 proc
mov edx,offset message2
call writestring
mov eax,1 ;Output is 1 in State 2
call writedec
call crlf
call readdigits
.if(a==0)&&(b==0)
call s0
.endif
.if(a==1)&&(b==1)
call s1
.endif
call s2
ret
s2 endp
s3 proc
mov edx,offset message3
call writestring
mov eax,1 ;Output is 1 in State 2
call writedec
call crlf
call readdigits
.if(a==0)&&(b==0)
call s2
.endif
.if(a==1)&&(b==1)
call s0
.endif
call s1
ret
s3 endp
main endp
end main