The program should be written in Marie simulator Write an as
The program should be written in Marie simulator.
Write an assembler program that will perform the \'while loop\' logic
read in a number that will be your LCV (loop-control-variable)
each time through the loop, print out the LCV
Example: you enter a 5
print out 5
4
3
2
1
The program should be written in Marie simulator.
remember, with a while loop, it is possible for the while loop won\'t run (if the LCV is incorrectly initialized)
Solution
. MODEL SMALL
.STACK 100H
.DATA
PROMPT_1 Db \'enter the number:$\'
PROMPT_2 db,odh,oah, \'the number is :$ \'
.CODE
MAIN PROC
MOV AX,@DATA
Move DS,AX
LEA DX,PROMPT_1
MOV AH,9
INT 21H
Mov AH,1
INT 21H
MOV BL,AL
LEA DX,PROMPT_2
MOV AH,9
INT 21H
TEST BL,01H
JNE @ODD
MOV AH,2
MOV DL,\"E\"
INT 21H
JMP @EXIT
@ODD:
MOV AH,2
MOV DL,\"0\"
INT 21H
@EXIT
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN

