Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program 2 - . model small . 3 8 6 . stack 1 0 0 h . data msg 1 db 1 3 , 1

program 2-
.model small
.386
.stack 100h
.data msg1 db 13,10, "Enter any key -->","$"
by_10 dd 10
sp_counter db 0
disp_number dd 0
disp_number2 dd 0
disp_number3 dd 0
op_type db 0
last_key dd 0
remainder db 0
.code
main proc
mov ax,@data
mov ds,ax
mov dx,offset msg1
call display_message
call m_keyin
mov EAX, DISP_NUMBER
zzz:
dec DISP_NUMBER
mul DISP_NUMBER
cmp DISP_NUMBER, 1
jnz zzz
mov DISP_NUMBER, eax
call m_display
mov ax,4c00h
int 21h
m_display proc
mov eax, disp_number
mov sp_counter, 0
Base_lp:
LP1:
mov edx, 0
div By_10
push dx
inc sp_counter
cmp eax, 0
jnz lp1
LP2:
pop dx
call display
dec sp_counter
jnz lp2
mov edx, -8
call display
mov edx, by_10
call display
mov edx, -7
call display
dec By_10
mov eax, disp_number
cmp By_10,1
jnz Base_lp
ret
m_display endp
iii:
mov ax,4c00h
int 21h
op_mult proc
mov eax, disp_number2
mul disp_number3
mov disp_number, eax
ret
op_mult endp
display proc
add dl,30h
cmp dl,3ah
js short skip_hex
add dl,7
Skip_hex:
mov ah,6
int 21h
ret
display endp
display_message proc
mov ah,9
int 21h
mov edx, 0
ret
display_message endp
m_keyin proc
MOV disp_number, 0
mov last_key, 0
LP_key:
mov eax, disp_number
mul by_10
add eax, last_key
mov DISP_NUMBER, eax
mov ah,1
int 21h
AND eax, 000000ffh
cmp al,13
jz short finkey
cmp al,30h
js iii
cmp al,3Ah
jns iii
sub al,30h
MOV LAST_KEY, EAX
jmp lp_key
finkey:
MOV eax, DISP_NUMBER
cmp DISP_NUMBER2,0
jnz short skip
MOV DISP_NUMBER2, EAX
skip:
MOV DISP_NUMBER3, EAX
cmp DISP_NUMBER, 13
jns iii
cmp DISP_NUMBER, 1
jz iii
ret
m_keyin endp
main endp
end main
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

Students also viewed these Databases questions

Question

What is Bacons approach to scientific methodology?

Answered: 1 week ago