Question: Using the AddSub program from the book as a reference, write an assembly program to perform the following operations using only 16-bit registers: AX =

Using the AddSub program from the book as a reference, write an assembly program to perform the following operations using only 16-bit registers: AX = 20 - (15 + 30). You must perform 15 + 30 first and then perform the subtraction operation. Insert a call DumpRegs statement after each operation and confirm that result is correct. Include code to output your name as well. Add a comment after each instruction to describe it. Once your program is working correctly, modify it to add the following calculation: BX = a - (b + d), but do keep the code from previous step. Once again, you must perform addition operation first and then perform the subtraction operation. Define variables a, b, and d as 16-bits signed integers with values 20, 15, and 30 respectively. Use DumRegs to confirm that it calculates the result correctly.

addsub program:

TITLE Add and Subtract (AddSubAlt.asm) ; This program adds and subtracts 32-bit integers. .386 .model flat,stdcall .stack 4096 ExitProcess PROTO, dwExitCode:DWORD DumpRegs PROTO .code main PROC mov eax,10000h ; EAX = 10000h add eax,40000h ; EAX = 50000h sub eax,20000h ; EAX = 30000h call DumpRegs INVOKE ExitProcess,0 main ENDP END main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!