Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5 x1 X2 Solve the system || +s 4x1 -8x1 +x2 -2x2 = 7 -14

Answered: 1 week ago