Lecture4 Thirdmicroprocessorc
Lecture4 Thirdmicroprocessorc
Lecture Four
8086 Instruction Set
General – Purpose Byte Special Address Simple Input And Flag Transfer
Or Word Transfer Transfer Output Port Instructions
Instructions Instruction Transfer
Instruction
MOV LEA IN LAHF
XCHG LDS OUT SAHF
XLAT LES PUSHF
PUSH POPF
POP
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
The Exchange instruction exchanges the contents of the register with the
contents of another register (or) the contents of the register with the
contents of the memory location. Direct memory to memory exchanges are
not supported. The both operands must be the same size and one of the
operand must always be a register.
Mnemonic Meaning Format Operation Flags Effected
Example:
XCHG CX, [037A]H ; [(DS* 10)+ 037A] CX
XCHG AX, [BX] ; [(DS* 10)+ BX] AX
XCHG DL, [BP+200H] ; [(SS* 10)+ BP +200] DL
XLAT exchanges the byte in AL register from the user table index to the
table entry, addressed by BX. It transfers 16 bit information at a time. The
no-operands form (XLATB) provides a "short form" of the XLAT instructions.
The PUSH and POP instructions are important instructions that store and retrieve
data from the LIFO (Last In First Out) stack memory. The general forms of PUSH and POP
instructions are as shown below:
Flags
Mnem. Meaning Format Operation Effected
PUSH Push word onto the stack PUSH S (SP) (SP-2) none
((SP)) (S)
POP Pop word off stack POP D D ((SP)) none
(SP) = (SP+2)
13
Lecture 4: 8086 Instruction Set
Assist. Prof. Dr. Hadeel N. Abdullah
IN and OUT Instruction
There are two different forms of IN and OUT instructions: the direct I/O
instructions and variable I/O instructions. Either of these two types of instructions can
be used to transfer a byte or a word of data. All data transfers take place between an
I/O device and the MPU’s accumulator register. The general form of this instruction is as
shown below:
Flags
Mnem. Meaning Format Operation Effected
Example:
IN AL,0C8H ;Input a byte from port 0C8H to AL
IN AX, 34H ;Input a word from port 34H to AX
OUT 3BH, AL ;Copy the contents of the AL to port 3Bh
OUT 2CH,AX ;Copy the contents of the AX to port 2Ch