Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
9 views6 pages

Module2 - (4) - Instruction Set-Part1

Instruction Sets
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Module2 - (4) - Instruction Set-Part1

Instruction Sets
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

8086 INSTRUCTION SET

 Data Transfer Instructions


 Arithmetic Instructions
 Bit Manipulation Instructions (Logical instructions)
 String Instructions
 Control Transfer Instructions (Branch & Loop Instructions)
 Processor Control Instructions

1. Data Transfer Instructions

These instructions are used to transfer the data from the source operand to the destination
operand. Following are the list of instructions under this group −

Instruction to transfer a word

 MOV − Used to copy the byte or word from the source to the destination.
Eg.MOV AX,BX ; The data present in register BX is transferred to register AX
 PUSH − It allows the transfer of 16-bit data present in the memory or register to the top
of stack memory. The stack pointer SP is decremented by 2 after each execution of the
instruction.
Eg: PUSH AX ; It transfer 16-bit data present in AX register to the stack memory.
 POP − The data present in the stack memory is transferred to either 16-bit register or
memory location given in the operand and SP gets incremented by 2.
Eg POP AX ; The data present in the stack memory is transferred to 16-bit register AX .
 PUSHA − Used to put or push all the registers into the stack.
 POPA − Used to get words from the stack to all registers.
 XCHG − Used to exchange the data between two registers or a register to memory
location.
Eg: XCHG AX,BX ; exchange data between AX and BX

 XLAT – Traslate a byte in AL using in table in memory.The content of 8 bit memory


transferred to AL, the effective address of memory is given by the sum of BX and AL.

Instructions for input and output port transfer

 IN − Used to read a byte or word from the provided port to the accumulator.
IN AL,[07H]
 OUT − Used to send out a byte or word from the accumulator to the provided port.
Eg: OUT[DX],AX
Instructions to transfer the address

 LEA –(Load Effective Address) Used to load the Effective address of operand into the
provided register.
 LDS –Used to load DS register and other provided register from the memory
 LES − Used to load ES register and other provided register from the memory.

Instructions to transfer flag registers

 LAHF − Used to load AH with the low byte of the flag register.
 SAHF − Used to store AH register to low byte of the flag register.
 PUSHF − Used to copy the flag register at the top of the stack.
 POPF − Used to copy a word at the top of the stack to the flag register.

2. Arithmetic Instructions

These instructions are used to perform arithmetic operations like addition, subtraction,
multiplication, division etc.
Following is the list of instructions under this group – The D and S are destination and Source
respectively. D and S can be either register, data or memory address.

Instructions to perform addition

 ADD D,S − Used to add the provided byte to byte/word to word.


 ADC D,S− Used to add with carry.(Add byte+byte+Carry flag)
 INC D− Used to increment the provided byte/word by 1.
 AAA − Used to adjust ASCII after addition.
 DAA − Used to adjust the decimal after the addition operation.

Instructions to perform subtraction

 SUB D,S− Used to subtract the byte from byte/word from word.
 SBB D,S− Used to perform subtraction with borrow.(Byte-byte-carry flag)
 DEC D − Used to decrement the provided byte/word by 1.
 NEG D −Negate - Used to change the sign of the provided byte/word .(invert each bit of
a specified byte or word and add 1)
 CMP − Used to compare 2 provided byte/word.
 AAS − Used to adjust ASCII codes after subtraction.
 DAS − Used to adjust decimal after subtraction.
Instruction to perform multiplication

 MUL − Used to multiply unsigned byte by byte/word by word.


 IMUL − Used to multiply signed byte by byte/word by word.
 AAM − Used to adjust ASCII codes after multiplication.

Instructions to perform division

 DIV − Used to divide the unsigned word by byte or unsigned double word by word.
 IDIV − Used to divide the signed word by byte or signed double word by word.
 AAD − Used to adjust ASCII codes after division.
 CBW − Used to fill the upper byte of the word with the copies of sign bit of the lower
byte.
 CWD − Used to fill the upper word of the double word with the sign bit of the lower word.

3. Bit Manipulation Instructions or Logical Instructions

These instructions are used to perform operations where data bits are involved, i.e. operations
like logical, shift, etc.
Following is the list of instructions under this group −

Instructions to perform logical operation

 NOT –Logical Invert


Invert each bit of a byte or word.
Eg. If AL= 0000 0011 (03H)
NOT AL ; AL= 1111 1100 (FCH)
 AND – Logical AND
AND each bit in a byte/word with the corresponding bit in another byte/word.
Eg. AND BH,CL ; AND byte in CL with BH , result in BH
AND AX,00FFH ; (AX) = (AX) AND 00FFH ,used for mask upper 8 bits of AX.
 OR – Logical OR
OR each bit in a byte/word with the corresponding bit in another byte/word.
Eg. OR BH,CL ; OR byte in CL with BH , result in BH
OR AX,0FF00H ; (AX) = (AX) OR FF00H ,used for set upper 8 bits ,lower byte
unchanged.
 XOR – Logical XOR
Exclusive-OR operation over each bit in a byte/word with the corresponding bit in
another byte/word.
XOR BX,CX ; exclusive OR CX with BX and store the result in BX
CX= 0011 1101 0110 1001 (3D69H)
BX=0000 0000 1111 1111 (00FFH)
BX=0011 1101 1001 0110 (3D 96H)
 TEST – AND operands to update flags, without affecting operands. It is used to set
flags before a conditional JUMP instruction.
TEST AL,BH ; AND BH with AL, no result stored, update flags, PF,SF,ZF

Instructions to perform shift operations

 SHL/SAL – Shift logical Left or Shift Arithmetic Left)


Shift bits of a byte/word towards left and put zero(S) in LSBs.MSB shifted to carry flag.

SHL AL,01H ; Shift AL 1 bit position left.


MOV CL,04H ; CL=04H
SHL AL,CL ; Shift AL 4 bit position left .
OR
SAL AL,CL ; Shift AL 4 bit position left .

To shift more than one position use count register (CX,CL) to load required shift
positions.

 SHR − Used to shift bits of a byte/word towards the right and put zero(S) in MSBs.LSB
shifted to carry flag.
SHR BL,01H ; Shift BL 1 bit position right.
MOV CL,03H ; CL=03H
SHR BL,CL ; Shift BL 3 bit position right . To shift more than one position use count
register (CX,CL) to load required shift positions.

 SAR –SHIFT ARITHMETIC RIGHT


Used to shift bits of a byte/word towards the right and copy the old MSB into the new
MSB.


SAR BL,01H ; shift right Bl with one bit position right MSB not changed.

Instructions to perform rotate operations

 ROL – ROTATE LEFT WITHOUT CARRY


Used to rotate bits of byte/word towards the left, i.e. MSB to LSB and to Carry Flag
[CF].

 ROR – ROTATE RIGHT WITHOUT CARRY


Used to rotate bits of byte/word towards the right, i.e. LSB to MSB and to Carry Flag
ROR DL,01H ; rotate DL register one bit position right

 RCL − Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to LSB.

RCL AL,01H
 RCR − Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF to MSB.

RCR AL, 01H ; rotate AL register one bit position right through carry

MOV CL, 03H ; CL=03H

RCR AL, CL ; rotate AL register 3 bit position right through carry.

You might also like