computer organization and assembly language 1. Write a line by line explanation to this program. 2. What does the program do at every routine? Explain. Please help me! Please  Program: .model small  .386  .stack 100h    .data  msg1 db 13, 10, "Enter any number --> ", "$" msg2 db  "Enter an operation +,- * or /  --> ",13, 10, "$"

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

computer organization and assembly language

1. Write a line by line explanation to this program.
2. What does the program do at every routine? Explain.

Please help me! Please 

Program:

.model small 

.386 

.stack 100h 

 

.data 

msg1 db 13, 10, "Enter any number --> ", "$"

msg2 db  "Enter an operation +,- * or /  --> ",13, 10, "$"

msg3 db  "The Operation is --> ", "$"

msg4 db  "The result is --> ", "$"

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 

movds,ax

        mov dx,offset msg1

call display_message

 

callm_keyin

 

calloperation

mov dx,offset msg1

calldisplay_message

 

callm_keyin

cmpop_type, "+"

jnz short skip_plus

callop_plus

skiP_plus:

cmp op_type, "-"

jnz short skip_minus

callop_minus

skip_minus:

 

cmp op_type, "*"

jnz short skip_mul

callop_mult

skip_mul:

cmp op_type, "/"

jnz short skip_div

 

callop_div

skip_div:

callm_display

 

mov ax, 4c00h 

int 21h 

 

operation proc

mov dx,offset msg2

rpt4:

call display_message

mov dx,offset msg3

call display_message

mov ah, 1

int 21h

cmp al, 30h

jns rpt4

mov op_type, al

 

 

ret

operation endp

 

m_display proc

mov dx,offset msg4

call display_message

mov eax, disp_number

mov sp_counter, 0

 

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

ret

m_display endp

 

op_minus proc

mov eax, disp_number2

sub eax, disp_number3

mov disp_number, eax

ret

op_minus endp

op_div proc

 

mov eax, disp_number2

div disp_number3

mov disp_number, eax

mov remainder, dl

 

call display

call m_display

mov dl, -16

call display

 

mov dl, remainder

call display

mov dl, -1

call display

mov edx, disp_number3

 

call display

 

 

mov ax, 4c00h 

int 21h 

op_div endp

 

op_mult proc

mov eax, disp_number2

mul disp_number3

mov disp_number, eax

 

ret

op_mult endp

op_plus proc

mov eax, disp_number2

add eax, disp_number3

mov disp_number, eax

ret

op_plus endp

display proc

add dl, 30h

cmp dl, 39h

jsshort 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 

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

ret

m_keyin endp

 

 

main endp

end main

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education