
ExeciN
By: a guest on
May 15th, 2012 | syntax:
ASM (NASM) | size: 1.17 KB | hits: 19 | expires: Never
TITLE FSM
INCLUDE Irvine32.inc
.data
state dword 0
message byte "Enter 1 or 0:", 0ah, 0dh, 0
stateis byte "The current state is:", 0ah, 0dh, 0
.code
main PROC
State0:
mov state, 0
mov ecx, stateis
call writestring
mov eax, state
call writeint
mov ecx, message
call writestring
call readint
cmp eax, 0
je State0
State1:
mov state, 1
mov ecx, stateis
call writestring
mov eax, state
call writeint
mov ecx, message
call writestring
call readint
cmp eax, 0
je State1
State2:
mov state, 2
mov ecx, stateis
call writestring
mov eax, state
call writeint
mov ecx, message
call writestring
call readint
cmp eax, 0
je State2
State3:
mov state, 3
mov ecx, stateis
call writestring
mov eax, state
call writeint
mov ecx, message
call writestring
call readint
cmp eax, 0
je State0
exit
main ENDP
END main