Question: I must write an assembly routine that accepts a numerical input from the keyboard. The routine will display the number and will start to count

I must write an assembly routine that accepts a numerical input from the keyboard. The routine will display the number and will start to count down displaying all numbers till it reaches 4. NOTE: I have the whole short program on a file in Notepad so I just need to input this routine with these indications in between a space of coding. I must use some of these 7 given values to write the little program and be able to compile it. I'll post the whole program down below and I must write this instructions in-between the given blank spaced lines (I think they are around line 38 or 40). I believe I did it ok but I want to be really sure. Thank You !

I must write an assembly routine that accepts a numerical input from

.model small .386 .stack 100h

.data operation db ? base_addr dw 0 first_key db 0 by10 dd 10 stack_counter db 0 delayv dw ? total_key db 0 an_msg db 13, 10, "Enter any key --> ", "$" key_msg db 13, 10, "Enter any number --> ", "$" msg1 db " LOC1=","$" msg2 db " LOC2=","$" msg3 db " LOC3=","$" msg4 db " AL=","$" msg5 db 0DH,0AH, "Disp=","$" a db ? b db ? c db ? d db 232 stt db 0 Loc1 db ? Loc2 db ? Loc3 db ? ; msg dd ? ; .code extrn clrscr:proc

main proc mov ax,@data ; set up data segment mov ds,ax

call clrscr ; clear the screen ;enter your program below_________________________________________________________________

;do not cross this line____________________________________________________________________ mov ax,4C00h ; return to DOS int 21h

display proc and eax, 000000ffh mov ebx, eax

mov ah,9 mov dx,offset msg5 int 21h

mov ah, 0 call display10 call space mov eax, ebx call display1 mov ah, 0 ret display endp display1 proc mov cl, al mov a, al mov b, 8 lp1: shl cl, 1 jnc short print0 mov dl, d mov ah, 6 int 21h dec b jnz lp1 mov al, a

call delay1 mov ah, 0 ret print0: mov dl, 30h mov ah, 6 int 21h dec b jnz lp1 mov al, a

call delay1 ret display1 endp delay1 proc cmp stt, 255 jnz short skip ret skip: mov bx, 9999 yy: mov delayv, 4000 zz: dec delayv jnz zz dec bx jnz yy ret delay1 endp space proc

mov dl, 20h mov ah, 6 int 21h

ret space endp

Status proc mov stt, 255 mov c, al ; save al mov ah,9 mov dx,offset msg1 int 21h mov al, loc1 mov d, 31h call display1

mov ah,9 mov dx,offset msg2 int 21h mov al, loc2 call display1

mov ah,9 mov dx,offset msg3 int 21h mov al, loc3 call display1

mov ah,9 mov dx,offset msg4 int 21h mov al, c call display1 mov d, 232 mov stt, 0 ret status endp display10 proc

mov eax, ebx lp10: mov edx, 0 div by10 push dx inc stack_counter cmp eax, 0 jnz lp10 ;--- lp10B: pop dx call view10 dec stack_counter jnz lp10B ret display10 endp view10 proc add dl, 30h mov ah, 6 int 21h and eax, 000000ffH ret view10 endp keyin proc no_num: mov total_key,0 mov first_key, 0 mov ah,9 mov dx,offset key_msg int 21h rpt:

mov ah, 1 int 21h cmp al, 13 jz short finkey cmp al, 30h js no_num cmp al, 3Ah jns no_num sub al, 30h

call tabulate mov first_key, 1 jmp rpt

finkey: mov al, total_key mov first_key, 0 mov ah, 0 ret keyin endp Tabulate proc and eax, 000000ffh cmp first_key, 0 jz short skip_mul mov bh, al mov al, total_key mul by10 add al, bh skip_mul: mov total_key, al ret tabulate endp

Message proc

msgrpt:

mov edx, msg shr edx, 24 mov ah, 6 int 21h

mov edx, msg shr edx, 16 mov ah, 6 int 21h

mov edx, msg shr edx, 8 mov ah, 6 int 21h

mov edx, msg mov ah, 6 int 21h ret message endp ;____________________ keyin_AN proc mov bx, 200 mov ah,9 mov dx,offset an_msg int 21h rptmsg: mov ah, 1 int 21h cmp al, 13 jz short finkeymsg mov operation , al mov [bx], al inc bx jmp rptmsg

finkeymsg: mov base_addr, bx mov al, operation mov ah, 0 ret keyin_AN endp mssg_an proc mov bx, 200 rptan:

mov dl, [bx]

mov ah, 6 int 21h inc bx cmp bx, base_addr jnz rptan ret mssg_an endp main endp end main

1. MOV AL, 35 2. CALL DISPLAY; CALL TO DISPLAY THE VALUE OF AL 3. CALL KEYIN; TO ENABLE THE USER TO ENTER VALUE FROM THE KEYBOARD 4.INC AL ; (AL) = AL+1 5.JNZ AAA; JUMP TO LOCATION AAA IF THE LAST COMAND DID NOT RESULT IN ZERO 6. AAA: THIS IS JUST A LOCATION IN THE PROGRAM 7. CMP AL, 245 ; COMPARE THE VALUE OF AL TO 245

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!