Hi, I want to see if I have the correct steps in the program. Thanks. Code: ; TI
ID: 3757200 • Letter: H
Question
Hi, I want to see if I have the correct steps in the program. Thanks.
Code:
; TITLE Adding four 32-bit Integer Variables (3B.asm)
; Program Description:
; This program will contain four 32-bit integer variables and add these values together, saving the result in a variable The sum should still be in the EAX register when you call the library routine DumpRegs.
; Author: Yen Jiu
; Creation Date: September 20, 2018
; Status: Completed
INCLUDE Irvine32.inc
.data
; declaring hexadecimal variables
var1 SDWORD 30050201h
var2 SDWORD 60040102h
var3 SDWORD 72010103h
var4 SDWORD 0B0700105h
.code
main PROC
MOV EAX, var1 ; moving var1 to EAX register
ADD EAX, var2 ; adding var2 to EAX register
ADD EAX, var3 ; adding var3 to EAX register
ADD EAX, var4 ; adding var4 to EAX register
call dumpregs ; displaying registers
call Waitmsg
exit
main ENDP
END main
Output:
Assignment 3A - A program that adds and subtracts 32-bit numbers After installing the assembler on the computer, enter the following program, save it, assemble it and run it. Do not forget to add a comment with your name in it. You will hand in a listing (e.g., addsum.asm) that should include your name TITLE Add and Subtract (AddSum.asm) This program adds and subtracts 32-bit integers Caterina Pentcheva INCLUDE Irvine32.inc .code main PROC mov eax, 10000h EAX- 10000h add eax, 40000h ;EAX = 50000h eax, 20000h EAX 30000h call DumpRegs display registersExplanation / Answer
Assignment 3B:
This program will add four 32-bit integer values
INCLUDE Irvine32.inc
.data
;initialize the four variables
a dword 10000h
b dword 20000h
c dword 30000h
d dword 40000h
.code
main PROC
;move a to eax
mov eax, a
;move b to ebx
mov ebx, b
;perform a+b
add eax, ebx
;move c to ebx
mov ebx, c
;perform (a+b)+c
add eax, ebx
;move d to ebx
mov ebx, d
;perform ((a+b)+c)+d
add eax, ebx
;now the result is in eax
call DumpRegs ; display registers
exit
main ENDP
END main
The code the instruction mentioned we're executed. and the result also clears that the output is accurate. And the EAX value also contains the sum value when eexecute DumpReg instruction.so it follows all the instructions specified in 3B question.
Assignment 3A:
It is to run the given program.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.