Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assembly language Using the AddSub program from Section 3.2 as a reference, writ

ID: 3752238 • Letter: A

Question

Assembly language

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 varl 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 va13 DWORD 20000h finalVal DWORD? .code main PROC moy eax,vall add eax,val2 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 func tion main ENDP END main

Explanation / Answer

INCLUDE Irvine32.inc

.data
var1 DWORD 190h
var2 DWORD 64h
var3 DWORD 46h
var4 DWORD 9h
finalVal DWORD ?

.code
main PROC

mov eax,0

mov ax,var1
sub ax,var2
sub ax,var3
sub ax,var4
mov finalVal,eax
call DumpRegs
exit

main ENDP
END main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote