Docsity

Instruction Set 8086, Slides of Microprocessor and Assembly Language Programming

Partial preview of the text

Download Instruction Set 8086 and more Slides Microprocessor and Assembly Language Programming in PDF only on Docsity!

Instruction Set- 8086

(Microprocessor)

ļ‚™ An instruction is a binary pattern

designed inside a microprocessor to

perform a specific function.

ļ‚™ The entire group of instructions that a

microprocessor supports is called

Instruction Set.

ļ‚™ 8086 has several instructions.

Instruction Set Of

ļ‚™ These instructions are used to transfer

the data from the source operand to the

destination operand.

ļ‚™ The operand can be a constant, memory

location, register or I/O port address.

ļ‚™ Following are the list of instructions

under this group:

Data Transfer Instruction

ļ‚™ MOV Des, Src:

ļ‚– (^) Src operand can be register, memory location or immediate operand. ļ‚– (^) Des can be register or memory operand. ļ‚– (^) Both Src and Des cannot be memory location at the same time. ļ‚– (^) E.g.: ļ‚™ (^) MOV CX, 037A H // move 037Ah into CX ļ‚™ (^) MOV AL, BL // move BL to AL ļ‚™ (^) MOV BX, [0301 H] // Move content of [0301h] into

Data Transfer Instruction

ļ‚™ XCHG Des, Src:

ļ‚– (^) This instruction exchanges Src with Des. ļ‚– (^) It is not supported to exchange two memory location. ļ‚– (^) E.g.: XCHG DX, AX

Data Transfer Instruction

ļ‚™ IN Accumulator, Port Address:

ļ‚– (^) It transfers the operand from specified port to accumulator register. ļ‚– (^) E.g.: IN AX, 0028 H // input a word from port 0028H to AX

ļ‚™ OUT Port Address, Accumulator:

ļ‚– (^) It transfers the operand from accumulator to specified port. ļ‚– (^) E.g.: OUT 0028 H, AX //copy the content of AX to 0028H ļ‚– (^) OUT 2CH, AX // Copy the contents of the AX to port 2Ch

Data Transfer Instruction

ļ‚™ (^) LES Des, Src: ļ‚– (^) It loads 32-bit pointer from memory source to destination register and ES. ļ‚– (^) The offset is placed in the destination register and the segment is placed in ES. ļ‚– (^) This instruction is very similar to LDS except that it initializes ES instead of DS. ļ‚– (^) E.g.: LES BX, [0301 H]

Data Transfer Instruction

ļ‚™ LAHF: It copies the lower byte of flag register to AH.

ļ‚– (^) This LAHF instruction was provided to make conversion of assembly language programs written for 8080 and 8085 to 8086 easier.

ļ‚™ SAHF:

ļ‚– (^) It copies the contents of AH to lower byte of flag register.

ļ‚™ PUSHF :

ļ‚– (^) Pushes flag register to top of stack.

ļ‚™ POPF :

ļ‚– (^) Pops the stack top to flag register.

Data Transfer Instruction

(Flag Transfer Register)

ļ‚™ (^) ADC Des, Src:

ļ‚– It adds the two operands with CF.

ļ‚– It adds the status of the carry flag into the result.

ļ‚– It affects AF, CF, OF, PF, SF, ZF flags.

ļ‚– E.g.:

ļ‚™ ADC AL, 74H // AL = AL + 74H + carry(1)
ļ‚™ ADC DX, AX
ļ‚™ ADC AX, [BX]

Arithmetic Instructions

Arithmetic Instructions

ļ‚™ INC Src:

ļ‚§ (^) It increments the byte or word by one. ļ‚§ (^) The operand can be a register or memory location. ļ‚§ (^) It affects AF, OF, PF, SF, ZF flags. ļ‚§ (^) CF is not affected.

ļ‚™ E.g.: AX = 7FFFh

ļ‚™ INC AX; after this; AX = 8000h

ļ‚™ DEC Src:

ļ‚§ (^) It decrements the byte or word by one. ļ‚§ (^) The operand can be a register or memory location. ļ‚§ (^) It affects AF, OF, PF, SF, ZF flags. ļ‚§ (^) CF is not affected. ļ‚§ (^) E.g.: DEC AX

ļ‚– (^) Other ASCII Instructions: ļ‚™ (^) AAS (ASCII Adjust after Subtraction) ļ‚™ (^) AAM (ASCII Adjust after Multiplication) ļ‚™ (^) AAD (ASCII Adjust Before Division)

Arithmetic Instructions

Arithmetic Instructions

ļ‚™ (^) AAS (ASCII Adjust after Subtraction)

ļ‚– Converts the result of

the subtraction of two

valid unpacked BCD

digits to a single valid

BCD number and takes

the AL register as an

implicit operand. The

operands must range

from 0 to 9.

ļ‚– E.g.

ļ‚™ MOV AX, 0901H; BCD

ļ‚™ (^) SUB AL, 9; Minus 9 ļ‚™ ļ‚™ (^) AAM (ASCII Adjust after Multiplication) ļ‚– (^) converts the result of the multiplication of two valid unpacked BCD digits into a valid 2-digit unpacked BCD number and takes AX as an implicit operand. The operand must be range in 0-

ļ‚– (^) AAM unpacks the result by dividing AX by 10, placing the quotient (MSD) in AH and the remainder (LSD) in AL. ļ‚– (^) Example: MOV AL, 5; MOV BL, 7 =MUL BL; Multiply AL by BL, result in AX ļ‚– (^) AAM; After AAM, AX =0305h (BCD 35)

Arithmetic Instructions

ļ‚™ (^) SUB Des, Src:

ļ‚– It subtracts a byte from

byte or a word from

word.

ļ‚– It affects AF, CF, OF, PF,

SF, ZF flags.

ļ‚– For subtraction, CF acts

as borrow flag.

ļ‚– E.g.:

ļ‚™ SUB AL, 74H

ļ‚™ SUB DX, AX

ļ‚™ SUB AX, [BX]

ļ‚™ (^) Subtracting unsigned number ļ‚– (^) CL = 10011100 = 156 decimal, BH = 00110111 = 55 decimal ļ‚– (^) SUB CL, BH; CL = 01100101 = 101 decimal ļ‚–CF, AF, SF, ZF = 0, PF = 1 ļ‚™ (^) Subtracting signed number ļ‚– (^) CL = 00101110 = + 46 decimal, BH = 01001010= + 74 decimal ļ‚– (^) SUB CL, BH; CL = 11100100 = - 28 decimal ļ‚–CF = 1, AF, ZF =0, SF = 1 result negative

ļ‚™ SBB(subtract with borrow) Des, Src:

ļ‚– (^) It subtracts the two operands and also the borrow from the result. i.e. carry flag is set to 1. ļ‚– (^) It affects AF, CF, OF, PF, SF, ZF flags. ļ‚– (^) E.g.: ļ‚™ (^) SBB AL, 74H //AL-74h- ļ‚™ (^) SBB DX, AX ļ‚™ (^) SBB AX, [BX]

Arithmetic Instructions