Question: For the following program: Here Read About the AND command and about any command that you may have not previously understood in the book. Here
For the following program: Here
Read About the AND command and about any command that you may have not
previously understood in the book. Here
Write an explanation for each line of code.
Write the logic of each procedure function How does it work?
model small stack h data msg db "Enter any number $ msg db "Enter an operation or $ msg db "The Operation is $ msg db "The result is $ Bybase dd by dd spcounter db dispnumber dd dispnumber dd dispnumber dd optype db lastkey dd remainder db code main proc mov ax@data mov dsax mov dxoffset msg call displaymessage call mkeyin call operation mov dxoffset msg call displaymessage call mkeyin cmp optype, jnz short skipplus call opplus skiPplus: cmp optype, jnz short skipminus call opminus skipminus: cmp optype, jnz short skipmul call opmult skipmul: cmp optype, jnz short skipdiv call opdiv skipdiv: call mdisplay mov axch int h operation proc mov dxoffset msg rpt: call displaymessage mov dxoffset msg call displaymessage mov ah int h cmp alh jns rpt mov optype, al ret operation endp mdisplay proc mov dxoffset msg call displaymessage mov eax, dispnumber mov spcounter, Baselp: LP: mov edx, div ByBase push dx inc spcounter cmp eax, jnz lp LP: pop dx call display dec spcounter jnz lp mov edx, call display mov edx, bybase call display mov edx, call display dec Bybase mov eax, dispnumber cmp Bybase, jnz Baselp ret mdisplay endp opminus proc mov eax, dispnumber sub eax, dispnumber mov dispnumber, eax ret opminus endp opdiv proc mov eax, dispnumber div dispnumber mov dispnumber, eax mov remainder, dl call display call mdisplay mov dl call display mov dl remainder call display mov dl call display mov edx, dispnumber call display mov axch int h opdiv endp opmult proc mov eax, dispnumber mul dispnumber mov dispnumber, eax ret opmult endp opplus proc mov eax, dispnumber add eax, dispnumber mov dispnumber, eax ret opplus endp display proc add dlh cmp dlah js short skiphex add dl Skiphex: mov ah int h ret display endp displaymessage proc mov ah int h mov edx, ret displaymessage endp mkeyin proc MOV dispnumber, mov lastkey, LPkey: mov eax, dispnumber mul by ; eax eax add eax, lastkey mov DISPNUMBER, eax mov ah int h AND eax, ffh cmp al jz short finkey sub alh MOV LASTKEY, EAX jmp lpkey finkey: MOV eax, DISPNUMBER cmp DISPNUMBER jnz short skip MOV DISPNUMBER EAX skip: MOV DISPNUMBER EAX ret mkeyin endp main endp end mainRun all the options of the program and explain in details the logic of the
entire program and how does it achieves its goals.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
