Don't like ads? PRO users don't see any ads ;-)
Guest

ExeciN

By: a guest on May 15th, 2012  |  syntax: ASM (NASM)  |  size: 1.17 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. TITLE FSM
  2.  
  3. INCLUDE Irvine32.inc
  4.  
  5. .data
  6.     state dword 0
  7.     message byte "Enter 1 or 0:", 0ah, 0dh, 0
  8.     stateis byte "The current state is:", 0ah, 0dh, 0
  9.                        
  10. .code
  11. main PROC
  12.    
  13.     State0:
  14.         mov state, 0
  15.        
  16.         mov ecx, stateis
  17.         call writestring
  18.         mov eax, state
  19.         call writeint
  20.        
  21.         mov ecx, message
  22.         call writestring
  23.        
  24.         call readint
  25.         cmp eax, 0
  26.         je State0
  27.        
  28.     State1:
  29.         mov state, 1
  30.        
  31.         mov ecx, stateis
  32.         call writestring
  33.         mov eax, state
  34.         call writeint
  35.        
  36.         mov ecx, message
  37.         call writestring
  38.        
  39.         call readint
  40.         cmp eax, 0
  41.         je State1
  42.        
  43.     State2:
  44.         mov state, 2
  45.        
  46.         mov ecx, stateis
  47.         call writestring
  48.         mov eax, state
  49.         call writeint
  50.        
  51.         mov ecx, message
  52.         call writestring
  53.        
  54.         call readint
  55.         cmp eax, 0
  56.         je State2
  57.  
  58.     State3:
  59.         mov state, 3
  60.        
  61.         mov ecx, stateis
  62.         call writestring
  63.         mov eax, state
  64.         call writeint
  65.        
  66.         mov ecx, message
  67.         call writestring
  68.        
  69.         call readint
  70.         cmp eax, 0
  71.         je State0
  72.        
  73. exit
  74. main ENDP
  75. END main