Answers: Direct Memory Operands

Updated 9/30/2002

Use the following data declarations for Questions 1-4. Assume that the offset of byteVal is 00000000h, and that all code runs in Protected mode.

.data
byteVal  BYTE 1,2,3,4
wordVal  WORD 1000h,2000h,3000h,4000h
dwordVal DWORD 12345678h,34567890h
aString  BYTE "ABCDEFG",0

 

1. Indicate whether or not each of the following MOV instructions is valid:

(notate: V = valid, I = invalid)

  
a.
mov ax,byteVal
  
 I 
b.
mov dx,wordVal
  
 V
c.
mov ecx,dwordVal
  
 V
d.
mov si,aString
  
 I
e.
mov esi,offset aString
  
 V
f.
mov al,byteVal
  
 V

 

2. Indicate whether or not each of the following MOV instructions is valid:

(notate: V = valid, I = invalid)

  
a.
mov eax,offset byteVal
  
 V 
b.
mov dx,wordVal+2
  
 V
c.
mov ecx,offset dwordVal
  
 V
d.
mov si,dwordVal
  
 I
e.
mov esi,offset aString+2
  
 V
f.
mov al,offset byteVal+1
  
 I

 

3. Indicate the hexadecimal value moved to the destination operand by each of the following MOV instructions:

(If any instruction is invalid, indicate "I" as the answer.)

  
a.
mov ax,offset byteVal
  
 00000000h 
b.
mov dx,wordVal
  
 1000h
c.
mov ecx,dwordVal
  
 12345678h
d.
mov esi,offset wordVal
  
 00000004h
e.
mov esi,offset aString
  
 00000014h
f.
mov al,aString+2
  
 43h ('C')
g.
mov edi,offset dwordVal
 0000000Ch

 

4. Indicate the hexadecimal value moved to the destination operand by each of the following MOV instructions:

(If any instruction is invalid, indicate "I" as the answer.)

  
a.
mov eax,offset byteVal+2
  
 00000002h 
b.
mov dx,wordVal+4
  
 3000h
c.
mov ecx,dwordVal+4
  
 34567890h
d.
mov esi,offset wordVal+4
  
 00000008h
e.
mov esi,offset aString-1
  
 00000013h

 

Use the following data declarations for Questions 5-6. Assume that the offset of byteVal is 0000:

.data
byteVal     BYTE 3 DUP(0FFh),2,"XY"
wordVal     WORD 2 DUP(6),2
dwordVal    DWORD 8,7,6,5
dwordValSiz WORD ($ - dwordVal)
ptrByte     DWORD byteVal
ptrWord     DWORD wordVal

 

5. Indicate the hexadecimal value moved to the destination operand by each of the following MOV instructions:

(If any instruction is invalid, indicate "I" as the answer.)

  
a.
mov eax,offset wordVal
  
00000006h
b.
mov dx,wordVal+4
  
0002h
c.
mov ecx,dwordVal+4
  
00000007h
d.
mov si,dwordValSiz
  
0010h
e.
mov al,byteVal+4
 
58h('X')

 

6. Indicate the hexadecimal value moved to the destination operand by each of the following MOV instructions:

(If any instruction is invalid, indicate "I" as the answer.)

  
a.
mov ax,dwordVal+2
  
I
b.
mov dx,wordVal-2
  
5958h ("YX")
*
c.
mov eax,ptrByte
  
00000000h
d.
mov esi,ptrWord
  
00000006h
e.
mov edi,offset dwordVal+2
 
0000000Eh

* The two character bytes are automatically reversed when loaded into a 16-bit register.