Assignment 3B: Adding 4 32-Bit Integer Variables
The 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.
Have your values initialized in the data segment.
Answer:-----------
Source Code:
; Add and Sum Variables(AddVarSum.asm)
;This program adds and sums variables of 32-bit integers
;Assignment: 3B
;Name:Joseph Wilcox
;assignment complete
INCLUDE Irvine32.inc
.data
val1 DWORD 20 ;32-bit usigned integer
val2 DWORD 28 ;32-bit usigned integer
val3 DWORD 36 ;32-bit usigned integer
val4 DWORD 42 ;32-bit usigned integer
sum DWORD 0 ;32-bit usigned integer
.code
main PROC
mov eax, val1 ;EAX=val1(20)
add eax, val2 ;EAX=eax(20)+val2(28), 48
add eax, val3 ;EAX=eax(48)+val3(36), 84
add eax, val4 ;EAX=eax(84)+val4(42), 126, 7E in hex
mov sum, eax ;move EAX(126) into var sum
call DumpRegs ;display registers
exit
main ENDP
END main
Get Answers For Free
Most questions answered within 1 hours.