这段代码类似于图灵机的模拟。我正在检测此代码,并且我制作了一张关于更改它的每一步的表格,但我不明白如何使用CALL AND RET更改堆栈内容
.model small
.data
bant db 0,0,0,0,0,0,0,0,0
.code
.startup
mov si,4
call stateA
.exit
stateA proc near
cmp bant[si],0
je AB
jmp AC
AB:
mov bant[si],1
inc si
call stateB
jmp RTA
AC:
mov bant[si],1
dec si
call stateC
RTA: ret
stateA endp
stateB proc near
cmp bant[si],0
je BA
jmp BB
BA:
mov bant[si],1
dec si
call stateA
jmp RTB
BB:
mov bant[si],1
inc si
call stateB
RTB: ret
stateB endp
stateC proc near
cmp bant[si],0
je CB
jmp CHLT
CB:
mov bant[si],1
dec si
call stateB
jmp RTC
CHLT:
mov bant[si],1
inc si
RTC: ret
stateC endp
end