我已经根据给我的图表编写了这个程序。我只是不知道在哪里以及如何阻止它运行。它一直在要求输入。在我的程序中在哪里添加退出命令?任何想法?
谢谢你。
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
初始状态为 S0
myexit proc
mov eax, white+16*black
call settextcolor
call waitmsg
ret
myexit endp
这个退出程序在这里不起作用
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
S0,S1,S2,S3 的程序从这里开始
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