03 Assignment - Intro Assembly Language ANS
03 Assignment - Intro Assembly Language ANS
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
; Caterina Pentcheva
INCLUDE Irvine32.inc
.code
main PROC
mov eax, 10000h ; EAX = 10000h
add eax, 40000h ; EAX = 50000h
sub eax, 20000h ; EAX = 30000h
call DumpRegs ; display registers
exit
main ENDP
END main
My Source:
INCLUDE Irvine32.inc
.code
main PROC
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.
My Source:
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
Assignment 3C: Answer the following questions
Question 1.
a. Declare a 32-bit signed integer variable and initialize it with the smallest
possible negative decimal value.
Question 2
.DATA
I SBYTE 1, -1
K DWORD 23456h
L BYTE 'DVC'
Question 3
.DATA
ALIGN 4
What will be the value of EAX, AX, and AL after executing each of the
following instructions? Assume that the address of barray is 404000h.
a. mov eax, TYPE warray
EAX:00000002h
AX: 0002h
AL: 02h