Lab 9: Indirect and Indexed Operands
Use the following data declarations. Assume that the offset of
byteVal is 0000:
.data
byteVal db 1,2,3,4
wordVal dw 1000h,2000h,3000h,4000h
dwordVal dd 12345678h,34567890h
aString db "ABCDEFG",0
pntr dw wordVal
1. Indicate whether or not each of the following instructions is
valid:
(notate: V = valid, I = invalid)
a. mov ax,byteVal[si]
b. add dx,[cx+wordVal]
c. mov ecx,[edi+dwordVal]
d. xchg al,[bx]
e. mov ax,[bx+4]
f. mov [bx],[si]
g. xchg al,byteVal[dx]
2. Indicate the hexadecimal value of the final destination operand
after each of the following code fragments has executed:
(If any instruction is invalid, indicate "I" as the answer.)
a. mov si,offset byteVal mov al,[si+1]
b. mov di,6 mov dx,wordVal[di]
c. mov bx,4 mov ecx,[bx+dwordVal]
d. mov si,offset aString
mov al,byteVal+1
mov [si],al
e. mov si,offset
aString+2
inc byte ptr
[si]
f. mov bx,pntr
add word ptr
[bx],2
g. mov di,offset
pntr
mov si,[di]
mov ax,[si+2]
3. Indicate the hexadecimal value of the final destination operand
after each of the following code fragments has executed:
(If any instruction is invalid, indicate "I" as the answer.)
a. xchg si,pntr
xchg [si],wordVal
b. mov ax,pntr
xchg ax,si
mov dx,[si+4]
c. mov edi,0
mov di,pntr
add edi,8
mov eax,[edi]
d. mov esi,offset
2
aString
xchg esi,pntr
mov dl,[esi]
e. mov esi,offset
aString
mov dl,[esi+2]