Sunteți pe pagina 1din 7

Sheet (5)

1. What do the following MOV instructions accomplish?


(a) MOV EBX,EAX
Copies EAX into EBX
(b) MOV BH,AH
Copies AH into BH
(c) MOV RDI,RSI
Copies RSI into RDI
(d) MOV AX, 44
Copies 44(2CH) into AX
(e) MOV ECX, 44H
Copies 00000044H into ECX
(f) MOV AL, 11001100B
Copies 11001100B (CCH) into AL
(g) MOV DX, [1111H]
Copies the word contents of the data segment memory location address by offset address
1111H into DX
(h) MOV [1111H], DX
Copies DX into data segment memory location address by offset address 1111H
(i) MOV CX, [BX]
Copies the word contents of the data segment memory location address by BX into CX
(j) MOV [BX], CX
Copies CX into the data segment memory location address by BX
(k) MOV CL, [BX+SI]
Copies the byte contents of the data segment memory location address by BX plus SI into CL
(l) MOV [BX+DI], AX
Copies AX into the data segment memory location address by BX plus DI
(m) MOV BX, [BP+DI]
Copies the word contents of the stack segment memory location address by BP plus DI into BX
(n) MOV [EBP+EAX], CX
Copies CX into the stack segment memory location address by EBP plus EAX
(0) MOV BX, [EDX+ECX]
Copies the word contents of the data segment memory location address by EDX plus ECX into
BX
(p) MOV [DI+100H], EAX
Copies EAX into the data segment memory location address by DI plus 100H
(q) MOV [BP+10H], DX
Copies DX into the stack segment memory location address by BP plus 10H
(r) MOV EBX, [EDX+1000H]
Copies the double word contents of the data segment memory location address by EDX plus
1000H into EBX
(s) MOV [BX+DI+20H], DH
Copies DH into the data segment memory location address by the sum of BX, DI and 20H
(t) MOV AX, [BX+SI+10H]
Copies the word contents of the data segment memory location address by sum BX, SI and 10H
(u) MOV AX, [BP+DI+30H]
Copies the word contents of the stack segment memory location address by sum Bp, DI and
30H
2. Select an instruction for each of the following tasks:
(a) Copy BX into DX
MOV DX, BX
(b) Move 12H into AL
MOV AL, 12H
(c) Copies the Byte contents of data segment memory location addressed by offset address
2000H into BL
MOV BL, [2000H]
(d) Copies BL into the stack segment memory location addressed by BP
MOV [BP], BL
(e) Copies the word contents of the data segment memory location addressed by BX plus SI
into DX
MOV DX, [BX+SI]
(f) Copies the word contents of the stack segment location addressed by BP plus 200H into AX
MOV AX, [BP+200H]
(g) Copies the byte contents of the data segment memory location addressed by the sum of BX,
SI and 100H into CL
MOV CL, [BX+SI+100]

3. What is wrong with the following MOV instruction?


(a) MOV BL,CX
Different size of registers with MOV instruction, register sizes must be equal 16 bits can’t be fit
into 8 bits
(b) MOV DS, SS
Segment to segment register MOV instruction is not allowed
(c) MOV [BX], [DI]
Memory to memory moves are not allowed
(d) MOV CS, BX
CS (code segment) not allowed being a destination register with MOV instruction

4. List the 8-bit registers, 16-bit registers, 32-bit registers, 64-bit registers and segment
registers that are used in register data-addressing mode.
The 8-bit registers used with register addressing are
AH, AL, BH, BL, CH, CL, DH, and DL
• The 16-bit registers used with register addressing are
AX, BX, CX, DX, SP, BP, SI, and DI
• The 16-bit segment register used with register addressing are
CS, ES, DS, SS, FS, and GS
• In the 80386 and above, the extended 32-bit registers used with register addressing are
EAX, EBX, ECX, EDX, ESP, EBP, EDI, and ESI
• In the 64-bit mode of the Pentium 4, the registers used with register addressing are
RAX, RBX, RCX, RDX, RSP, RBP, RDI, RSI, and R8 through R15

5. List the 16-bit registers and 32-bit registers that are used in the indirect-data
addressing mode.
16 bit register used in the indirect-data addressing mode are
BX, DI, SI and BP
32 bit register used in the indirect-data addressing mode are
EAX, EBX, ECX, EDX, EDI, ESI and EBP
6. Sketch the operation for the following instruction indicating the contents of registers,
assuming that the source content is A9H for byte movement operations and B8C7H for
word movement operations:
(a) MOV AH, BL
AH AL
AX A9H
A9H
BX A9H
BL
(b) MOV R8B, CL
R8 R8B (8bits)
A9H
A9H

CL
CX A9H
(c) MOV CH, CL
CH CL

CX A9H A9H

A9H

(d) MOV DX, AX


AH AL
AX
B8H C7H
BX
B8C7H
CX

DX
B8H C7H
DH DL

(e) MOV R10W, SP


R10W (16 bits)

R10
B8C7H
B8C7H
SP B8C7H
(f) MOV BP, BX
BH BL

BX B8H C7H B8C7H

BP
B8C7H
7. Sketch the operation for the following instruction indicating the content of destination
register:
(a) MOV DX,4563H
DH DL
DX 4563H
45H 63H
(b) MOV AX, 32
AH AL
AX 00H 20H 0020H

(c) MOV CL, 10101010B


CH CL
CX AAH AAH

(d) MOV R15D, 4563H

R15D (32 bits)

R15 00004563H
00004563H

(e) MOV BL,'b'

BH BL

BX 62H Ascii ‘b’ (62H)

(f) MOV DI,'ab'

DI Ascii ‘ba’ Ascii ‘ab’

8. Suppose that DS=1000H, SS=2000H, BX=0300H, BP=1000H, SI=0250H, and DI=0100H.


Determine the memory address accessed by each of the following instructions,
assuming real mode operation:
(a) MOV [1059H], AL (b) MOV CX, [DI] (c) MOV [BP], DX
(d) MOV AL, [BX+DI] (e) MOV [SI+100H], AX (f) MOV AL, [BX+SI+200H]
Sketch the operation for the above instructions indicating the contents of registers and
memory locations, assuming that the source content is 3DH for byte movement
operations and 4AC0H for word movement operations.

(a) MOV [1059H], AL

Start address = data segment *10H = 1000H*10H = 10000H

End address = 10000H+FFFFH = 1FFFFH

Physical address (real memory location) = start address + offset = 10000H+1059H = 11059H
AH AL

AX 3DH 3Dh 3DH 11059H

1059H 11059H
+
10000H

DS*10H

(b) MOV CX, [DI]

Start address = data segment *10H = 1000H*10H = 10000H

End address = 10000H+FFFFH = 1FFFFH

Physical address (real memory location) = start address + offset = 10000H+0100H = 10100H

CH CL 4AH 10101H
CX 4AH C0H 4AC0H C0H 10100H
4AH C0H

DI 0100H 0100H + 10100H

DS*10 10000H

(c) MOV [BP], DX

Start address = stack segment *10H = 2000H*10H = 20000H

End address = 20000H+FFFFH = 2FFFFH

Physical address (real memory location) = start address + offset = 20000H+1000H = 21000H
DH DL 4AH 21001H

DX 4AC0H C0H 21000H


4AH C0H

BP 1000H 1000H + 21000H

20000H

SS*10

(d) MOV AL, [BX+DI]

Start address = data segment *10H = 1000H*10H = 10000H


End address = 10000H+FFFFH = 1FFFFH
Physical address (real memory location) = start address + offset = 10000H+0300H+0100H = 10400H

AH AL

AX 3DH 3DH 3DH 10400H

BX 03H 00H 0300H

DI 0100H 0100H + 0400H 10400H


+

DS*10 10000H

(e) MOV [SI+100H], AX


Start address = data segment *10H = 1000H*10H = 10000H
End address = 10000H+FFFFH = 1FFFFH
Physical address (real memory location) = start address + offset = 10000H+0250H+100H = 10350H

AH AL 4AH 10351H
4AH C0H
AX C0H 10350H

SI 0250H + 0350H + 10350H


0250H
100H DS*10 10000H
(f) MOV AL, [BX+SI+200H]
Start address = data segment *10H = 1000H*10H = 10000H
End address = 10000H+FFFFH = 1FFFFH
Physical address (real memory location) = start address + offset = 10000H+0300H+0250H+200H =
10750H

AH AL
AX 3DH 3DH 3DH 10750H

BX 03H 00H 0300H

SI 0250H 0250H + 0550H 0750H + 10750H


+

200H DS*10 10000H

S-ar putea să vă placă și