Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the AddSub program from Section 3.2 as a reference, write a program that subtracts three integers using only 16- bit registers. Insert a call
Using the AddSub program from Section 3.2 as a reference, write a program that subtracts three integers using only 16- bit registers. Insert a call DumpRegs statement to display the register values.
;TITLE Add and Subtract (AddSub.asm) ; This program adds and subtracts 32-bit integers. INCLUDE Irvine32.inc
.code main PROC
mov eax,10000h add eax,40000h sub eax,20000h call DumpRegs exit
main ENDP
END main
let use the following values var1 400 var2 100 var3 70 var4 9
and then move var1 in to EAX and then subtract var2, then var3, and then var4 EAX should then hold 221
TITLE Add and Subtract, Version 2 ; This program adds and subtracts 32-bit unsigned ; integers and stores the sum in a variable. INCLUDE Irvine32.inc (AddSub2.asm) data vall DWORD 10000h val2 DWORD 40000h val3 DWORD 20000h finalVal DWORD? .code main PROC mov eax , val! add eax,va12 sub eax,val3 mov finalVal.eax call DumpRegs. exit ; start with 10000h : add 40000h ; subtract 20000h ; store the result (30000h) : display the registers ; predefined MS-Win function main ENDP END main TITLE Add and Subtract, Version 2 ; This program adds and subtracts 32-bit unsigned ; integers and stores the sum in a variable. INCLUDE Irvine32.inc (AddSub2.asm) data vall DWORD 10000h val2 DWORD 40000h val3 DWORD 20000h finalVal DWORD? .code main PROC mov eax , val! add eax,va12 sub eax,val3 mov finalVal.eax call DumpRegs. exit ; start with 10000h : add 40000h ; subtract 20000h ; store the result (30000h) : display the registers ; predefined MS-Win function main ENDP END mainStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started