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

Must use emu8086 Using the program from Section 3.2 as a reference, write a prog

ID: 3843413 • Letter: M

Question

Must use emu8086

Using the program from Section 3.2 as a reference, write a program that calculates the following expression, using registers: A = (A+B) - (C+D). Assign integer values to the EAX, EBX, ECX, and EDX registers. 1:; AddTwo.asm - adds two 32-bit integers 2:; Chapter 3 example 3: 4:. 386 5: .model flat, stdcall 6: .stack 4096 7: ExitProcess PROTO, dwExitCode:DWORD 8: 9: .code 10: main PROC 11: move ax, 5; move 5 to the eax register 12: add eax, 6; add 6 to the eax register 13: 14: INVOKE ExitProcess, 0 15: main ENDP 16: END main

Explanation / Answer

1: ; ExprEval.asm - Evaluate expression
2: ; A = (A+B) - (C+D)
3:
4: .386
5: .model flat,stdcall
6: .stack 4096
7: ExitProcess PROTO, dwExitCode:DWORD
8:
9: .code
10: main PROC
11:    mov eax,9   ; move 5 to eax register
12:       mov ebx,8   ; move 6 to ebx register
13:       mov ecx,7   ; move 7 to ecx register
14:    mov edx,6   ; move 6 to edx register
15:       add eax,ebx   ; add ebx to eax register
16:    add ecx,edx   ; add edx to ecx register
17:       sub   eax,ecx   ; subtract ecx from eax register
18:       INVOKE ExitProcess,0
19:   main ENDP
16: END main

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote