Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to ask the user to enter number less than 5 5 using the below code as a skeloton. If the user enters
Write a program to ask the user to enter number less than 5 using the below code as a skeloton. If the user enters greater than 5, the program will loop to ask the user to enter the number less than 5 again until user enter the number less than 5. Display the number if the user enter number less than 5. The maximum attempts not more than 8 times. If the user did not enter the number less than 5 in 8 attempts, the program will prompt Fail at the screen.
.model small
.stack 100h
.data
val1 dw ?
msg1 db 'Data to be push : $' " id="MathJax-Element-18-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">' ;
msg2 db 'Data from pop : $' " id="MathJax-Element-20-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">' ;
.code
mov ax,@data
mov ds,ax
lea dx, msg1
mov ah,09h
int 21h
mov ah,2
mov dx,32H
int 21h
mov ax,32H
push ax
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21H
lea dx, msg1
mov ah,09h
int 21h
mov ah,2
mov dx,34H
int 21h
mov ax,34H
push ax
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21H
pop val1
lea dx, msg2
mov ah,09h
int 21h
mov ah,2 mov dx, val1
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21H
lea dx, msg1
mov ah,09h
int 21h
mov ah,2
mov dx,36H
int 21h
mov ax,36H
push ax
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21H
pop val1
lea dx, msg2
mov ah,09h
int 21h
mov ah,2
mov dx, val1
int 21h
mov ah,2
mov dl,0dh
int 21h
mov dl,0ah
int 21H
pop val1
lea dx, msg2
mov ah,09h
int 21h
mov ah,2
mov dx, val1
int 21h
mov ah,4ch
int 21h
end
Step by Step Solution
★★★★★
3.39 Rating (140 Votes )
There are 3 Steps involved in it
Step: 1
Heres the code implementing the required functionality model small stack 100h data prompt db Enter a number less than 55 failMsg db Fail num dw To store the users input maxAttempts db 8 Maximum allowe...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started