4-2 For each of the following statements, what is the amount of storage space re
ID: 3674890 • Letter: 4
Question
4-2 For each of the following statements, what is the amount of storage space reserved (in bytes)? Also indicate the initialized data. Verify your answers using your assembler.
(a) table Times 100 DW -1
(b) value DW -2300
(c) count DW 40000
(d) msg1 DB ‘Finder’ ‘s fee is:’ ,0
(e) msg3 DB ‘Sorry! Invalid input.’ , 0DH,0AH,0
4-7 Use the following data definitions to answer this question:
.Data
Num1 DW 100
Num2 DB 225
Char1 DB ‘Y’
Num3 DD 0
Identify whether the following instructions are legal or illegal. Explain the reason for each illegal instruction.
(a) mov EAX,EBX (b) mov EAX,num2
(c) mov BL, num1 (d) mov DH, char1
(e) mov char1,num2 (f) mov IP,num1
(g) add 75,EAX (h) cmp 75, EAX
(i) sub char1,’A’ (j) xchg AL,num2
(k)xchg AL,23 (l) inc num3
4-8 Assume that the registers are initialized to
EAX = 12345D, EBX = 9528D
ECX = -1275D, EDX = -3001D
What is the destination operand value (in hex) after executing the following instructions:
(Note: Assume that the four registers are initialized as shown above for each question.)
(a) add EAX, EBX (b) sub AX, CX
(c) and EAX, EDX (d) or BX, AX
(e) not EDX (f) shl BX, 2
(g) shl EAX, CL (h) shr BX, 2
(i) shr EAX, CL (j) sub CX, BX
(k) add ECX, EDX (l) sub DX, CX
4-9 In the following code fragments, state whether mov AX, 10 or mov BX, 1is executed:
(a) mov CX,5 (b) mov CX, 5
sub DX, DX mov DX, 10
cmp DX, CX shr DX, 10
jge jump1 cmp CX, DX
mov BX, 1 je jump1
jmp skip1 mov BX, 1
jump1: jmp skip1
mov AX, 10 jump1:
skip1: mov AX, 10
skip1:
(c) mov CX, 15BAH (d) mov CX, 5
mov DX, 8244H not CX
add DX, CX mov DX, 10
jz jump1 cmp DX,1
mov BX, 1 jg jump1__
jmp skip1 mov BX, 1
jump1: jmp skip1
mov AX, 10 jump1:
skip1: mov AX, 10
skip1:
4-10 Describe in one sentence what the following code is accomplishing in the terms of number manipulation:
(a) Not AX (b) not AX
add AX, 1 inc AX
(c) sub AH, AH (d) sub AH, AH
sub DH, DH sub DH, DH
mov DL, AL mov DL, AL
add DX, DX mov CL, 3
add DX, DX shl DX, CL
add DX, AX shl AX, 1
add DX, DX add DX, AX
Explanation / Answer
4-2
a) 35
b) 45
c) 76
d) 56
e) 87
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.