4.1 8086 Instruction Set
4.1 8086 Instruction Set
Example:
MOV CX, 037AH ; Move 037AH into the CX; 037A → CX
MOV AX, BX ; Copy the contents of register BX to AX ; BX → AX
MOV DL, [BX] ;Copy byte from memory at BX to DL ; DS*10+BX → DL
Example: Reg→Reg
MOV AL, 5
MOV AH, 2
XCHG AL, AH ; AL = 2, AH = 5
XCHG AL, AH ; AL = 5, AH = 2
Example: For the figure below. What is the result of executing the
following instruction?
XCHG AX, [0002]
Solution
The LEA instruction loads a 16-bit register with the offset address of the
data specified by the operand. The LDS and LES instructions load any
16-bit register with an offset address, and the DS, ES, or SS segment
register with a segment address.
Example:
LEA BX, PRICE ; Load BX with offset of PRICE in DS
LEA BP, SS:STAK ; Load BP with offset of STACK in SS
LEA CX, [BX][DI] ; Load CX with EA=BX + DI
LDS BX, [4326] ; copy the contents of the memory at displacement 4326H in DS to BL,
contents of the 4327H to BH. Copy contents of 4328H and 4329H in DS to
DS register.
Example 5: Assuming that (BX)=100H, DI=200H,
DS=1200H, SI= F002H, AX= 0105H, and the
following memory content. what is the result of
executing the following instructions?
a. LEA SI , [ DI + BX +2H]
b. MOV SI , [DI+BX+2H]
c. LDS CX, [300]
d. LES BX , [DI+AX]
Solution:
a. LEA SI , [DI + BX +2H]
SI= (DI) + (BX) + 2H=0200H+0100H+0002H= 0302H
b. MOV SI , [DI+BX+2H]
EA=(DI+BX+2H)= 0302H
PA=DS*10+EA=1200*10+0302=12302
SI = 80EFH
c. LDS CX , [300]
PA = DS*10+EA= 1200H*10+300H = 12300H
CX= AA11H and DS=80EFH
d. LES BX , [DI+AX]
EA = (DI+AX)= 0200H+0105H =0305H
PA= DS*10+EA = 1200H*10+0305H = 12305H
BX = 5A8DH and ES = C592H