In: Computer Science
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.
b. Declare an uninitialized array of 100 16-bit unsigned integers.
c. Declare a string variable containing the word “DVC” repeated 20 times, and terminated with the null char.
Question 2
For the following declarations, assuming that the address of I is 404000h
What are the addresses of J, K, and L?
What is the total number of allocated bytes?
Show the content of the individual bytes allocated in memory in hexadecimal
.DATA
I SBYTE 1, -1
J SWORD 10FFh, -256
K DWORD 23456h
L BYTE 'DVC'
Question 3
Given the following definitions:
.DATA
wval LABEL WORD
barray BYTE 10h, 20h, 30h, 6 DUP (0Ah)
ALIGN 4
warray WORD 5 DUP (1000h)
pressKey EQU <"Press any key to continue ...", 0>
darray DWORD 5 DUP (56789ABh), 7 DUP (12345678h)
dval LABEL DWORD
prompt BYTE pressKey
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
b. mov eax, LENGTHOF barray
c. mov eax, SIZEOF darray
d. mov eax, OFFSET warray
e. mov eax, OFFSET darray
f. mov eax, OFFSET prompt
g. mov eax, DWORD PTR barray
h. mov al, BYTE PTR darray
i. mov ax, wval
j. mov eax, dval
Answer:-----------
1)
a). var SDWORD - 2147483648
b). array WORD100 DUP(?)
c). string BYTE 20 DUP(“DVC”),0
2)
a).
J: 404002h
K: 404006h
L: 40400Ah
b). 1X2 + 2X2 + 4X1 + 1X3 = 13
c).
404000h: 01
404001h: FF
404002h: 10
404003h: FF
404004h: FF
404005h: 00
404006h: 00
404007h: 56
404008h: 34
404009h: 02
40400Ah: 43
40400Bh: 56
40400Ch: 44.
.DATA
I SBYTE 1, -1
J SWORD 10FFh, -256K
DWORD 23456h
L BYTE 'DVC'
3).
warray WORD 5 DUP (1000h) ------------------------ 5*2 =
10bytes
pressKey EQU <"Press any key to continue ...", 0>
---------------- allocate no spaced
array DWORD 5 DUP (56789ABh), 7 DUP (12345678h) ------------------
5*4 bytes + 7*4 bytes = 48 bytes
dval LABEL DWORD ------------------------ allocate no spaces
prompt BYTE pressKey
30 bytes for (“Press any key to continue…”,0)
Assume that the address of barray is 404000h.
a. mov eax, TYPE warray;eax=2
b. mov eax, LENGTHOF barray;eax=9
c. mov eax, SIZEOF darray;eax=30
d. mov eax, OFFSET warray;eax=0040400Ch
e. mov eax, OFFSET darray;eax=00404016h
f. mov eax, OFFSET prompt;eax=00404046h
g. mov eax, DWORD PTR barray;eax=0A302010h
h. mov al, BYTE PTR darray;eax=ABh
i. mov ax, wval;AX=2010h
j. mov eax, dval;EAX=73657250h