Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Please show work step by step on Microsoft words MAC283 CLASSWORK NO 10 (DUE ON JUNE 1st, XXXXXXXXXXWrite a line by line explanation to this program. 2. What does the program do at every routine?...

1 answer below »
Please show work step by step on Microsoft words
MAC283 CLASSWORK NO 10 (DUE ON JUNE 1st, XXXXXXXXXXWrite a line by line explanation to this program. 2. What does the program do at every routine? Explain. The program is here

here is the program! this is for assembly language class
.model small XXXXXXXXXXstack 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  	mov ds,ax XXXXXXXXXXmov dx,offset msg1 	call display_message  	call m_keyin 	 	call operation 	mov dx,offset msg1 	call display_message  	call m_keyin 	cmp op_type, "+" 	jnz short skip_plus 	call op_plus 	skiP_plus: 	cmp op_type, "-" 	jnz short skip_minus 	call op_minus skip_minus: 	 	cmp op_type, "*" 	jnz short skip_mul 	call op_mult skip_mul: cmp op_type, "/" 	jnz short skip_div 	 	call op_div skip_div:	 	call m_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 	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  	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 


Answered 1 days After May 30, 2022

Solution

Nimesh answered on Jun 01 2022
89 Votes
All the assembly code description line by line is defined below.

.model small

using small memory

using segments of code, data and stack
.386

work with 32bits

Enables assembly of nonprivileged instructions for the 80386 processor
.stack 100h

eserves 100h bytes for stack
.data

data section starts and initilized.

dw - define byte, dw- define word, dd - define double word
msg1 db 13, 10, "Enter any number --> ", "$"

moves the cursor to the next line and set to start of line

Print "Enter any number --> "

and take number as input
msg2 db "Enter an operation +,- * or / --> ",13, 10, "$"

print "Enter an operation +,- * or / --> " and take appropriate input
msg3 db "The Operation is --> ", "$"

print "The Operation is --> " and appropriate input
msg4 db "The result is --> ", "$"

print "The result is --> " and apropriate input
y_10 dd 10

y_10 taken as double word and value of it is 10
sp_counter db 0

sp_counter taken as double word and value of it is 0
disp_number dd 0

disp_number taken as double word and value of it is 0
disp_number2 dd 0

disp_number2 taken as double word and value of it is 0
disp_number3 dd 0

disp_number3 taken as double word and value of it is 0
op_type db 0

op_type taken as double word and value of it is 0
last_key dd 0

last_key taken as double word and value of it is 0
emainder db 0

emainder taken as double word and value of it is 0
.code

code segment start here
main proc

main method start
mov ax,@data

move starting address of data to ax
mov ds,ax

data segment start or initilized
mov dx,offset msg1
call display_message

call instruction do push the return address on the stack and start
execution of calling function.

call m_keyin

call instruction do push the return address on the stack and start
execution of calling function.

call operation

call instruction do push the return address on the stack and start
execution of calling function.

mov dx,offset msg1
call display_message

call instruction do push the return address on the stack and start
execution of calling function.

call m_keyin

call instruction do push the return address on the stack and start
execution of calling function.
cmp op_type, "+"

compare op_type with +
jnz short skip_plus

if comparision true then short jump with no zero flag to
skip_plus
call op_plus

call instruction do push the return address on the stack and start
execution of calling function.
skiP_plus:

skiP_plus statements
cmp op_type, "-"

compare op_type with -
jnz short skip_minus

if comparision true then short jump to skip_minus
call op_minus

call instruction do push the return address on the stack and start
execution of calling function.
skip_minus:
skip_minus statements
cmp op_type, "*"

compare op_type with *
jnz short skip_mul

if comparision...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here