Write an assembly program, fsm1234.asm
, that prompts the user for a number and checks it against the fsm in the figure 2.
Figure 2.L={1,2,3,4}
All numbers besides 1 must be preceded AND followed by a 1. So every 2,3 and 4 WILL have a 1 before and after it.
Here are some valid inputs: 11112131214141411121, 1214131, 131,14121..
the list is endless! NB: 1 is a valid input aswell. In this case the start state is also the final state
my code:
INCLUDE Irvine16.inc
.data
Writestring proto
crlf proto
Readint proto
Writeint proto
mg byte "Please enter number ",0
numb sword ?
.code
main proc
mov dx,offset mg ;displaying message to the user to enter number
invoke Writestring
mov cx,3 ;this the counter
;this the loop
label1:
mov dx,offset numb
invoke Readint
invoke crlf
mov dx,offset numb
invoke Writeint
loop label1
terminate : exit
main endp
end main
please guys help me finish this code..