8086 Instruction Format-II

Introduction:

Depending on the addressing mode used, an instruction of 8086 microprocessor can be one to seven byte long. These are:

  • One Byte Instruction
  • Two Byte Instruction
  • Three Byte Instruction
  • Four Byte Instruction
  • Five Byte Instruction
  • Six Byte Instruction
  • Seven Byte Instruction

The table shows the general format of 8086 instructions. The following paragraph gives the different instruction format with examples
1. One Byte Instruction: These instructions in the category uses the implied addressing mode and register mode instruction. The implied mode instruction does not use the operands, and the register mode uses the operand as one register.
a. Format-1: implied Type

Byte Addressing Mode Format/ Examples
1 Byte Format Implied Addressing Mode
Examples
OP CODE
CLC, CLD, STC, CMC, CBW, DAA, DAS, AAA,
AAS, RET, CLI, HLT etc..
  Examples REP, REPZ REPE,  REPNE / REPNZ, LOCK,
LODS / LODSB / LODSW
  1. Format-2:Register Addressing Mode

1 Byte Format Register Addressing Mode
INC reg(16 bit reg)
DEC reg(16 bit reg) Examples
(However INC/DEC for 8 bit register is 2byte instruction)
OP CODE REG
11111 Reg (3 bit)
INC
DEC
BX
CX
  1.  Two Byte Instruction: These instructions use two operands and there are two formats of this type of instruction.
    a. Format-1: Register to Register
    Both the source and the destination are the registers. The table below give the format and example of this type.
2 Byte Description FORMAT/ Examples
2 byte Format ( Reg to Reg) OP CODE Operands
6-bit 2-bit MOD REG R/M
Size ****** dw 11 3 bits 3 bits
Examples 100010dw 11  000  001
10001000 11 000 001
MOV  AL, CL
w=0 indicate it is 1 byte operation
d=0 indicate REG field­ is source

       b. Format-2 : Register to / from memory with no displacement
One of the operand is REG and the second  may be REG or MEMORY and instruction does not use any displacement. The table below give the format and example of this type.

2 Byte Format Reg to/from memory with no displacement OPCODE  
OP CODE MOD REG R/M
6-bit 2-bit 2-bit 3-bit 3-bit
******dw 00 *** ***
Examples
In this example the data is present in a memory location in DS whose offset address is in BX. The effective address of the data is given as DSx10H +[BX]
100010dw  00  000  111
10001010   00  000 111
MOV AL,  [BX]
MOV AX, [BX]
d=1, indicate AL  is destination
w=0 indicate it is 1 byte operation
  1. Three Byte Instructions: There are two formats for this type of instructions
    a. Register to /from memory with 8 bit displacement :This type of instruction uses one of the operand as register, the other operand may be register/memory and uses 8 bit displacement value.
3 Byte Description FORMAT/ Examples
3 Byte Format Reg to/from memory with 8 bit disp. OP CODE MOD REG R/M Displacement  
  1 Byte 2 Bits 3 bits 3 bits 1 hex Byte  
  ******dw 01 *** *** ********  
Examples 10001010 01  000 111  00100000
MOV  8-bit DISP  AL, [BX] 20h
MOV AL, 20h[BX]
10001000  01  110 100 01000011
MOV 43h[SI],DH
d=1 indicate REG field is destination;
w=0 indicate it is 1 byte operation
In this example the data is present in a memory location in DS whose offset address is [BX +20h]. The effective address of the data is given as DSx10H +[BX+20h]

   b. Immediate Operand (8 Bits data) to Register:This is also 3 byte instruction and use an 8 bit  immediate data and other operand is an 8 bit register(high or low order) when operand is 16-bit then it is 4-byte instruction. In this format, the first byte as well as the 3 bites from the second byte which are used for REG  field in case of register to register format are used for opcode.

3 Byte Description FORMAT/ Examples
3 Byte Format Reg to/from memory with 8 bit disp. OP CODE Reg Data low Byte Data high Byte  
  5bit 3 Bits 1  bits 1 Byte  
  ****w *** ******** ********  
Examples 10111 000  00010000  00000000
MOV  AX, 0010h; it is 3-byte instruction
w=1, indicate 16-bit operand
MOV  AL, 8-bit-operand
MOV  AL, 35h; it is 2-byte instruction
10110  000 00111010 here high byte is not there
AND AL, 59h is as below:
00100000 01011001h
w=0, indicate 8-bit  immediate data
  1. Four Byte Instructions:
    a. Format-1: register to /from memory with 16 bit displacement
4 Byte Description FORMAT/ Examples
4 Byte Format Reg to/from memory with 8 bit disp. OP CODE MOD REG R/M 16 bit Displacement
  1 Byte 2 Bits 3 bits 3 bits Low Byte High Byte
Examples 10001001 01  110 100  0100001100100011
MOV 2343h[SI],DH

b. Format-2: Segment Register to Memory/reg

4 Byte Description   FORMAT/ Examples
5 byte format Immediate Operand (8 Bits data) to Memory with 16 bit displacement OP CODE MOD OP CODE SR R/M Displacement
(16 bits)
  1 Byte 2 Bits 1 bits   3 bits Low byte High byte
MOV  1234h[BX+SI], SS 10001100 10 0 10 000 00110100 00010010
Examples MOV  1234h[BX+SI], SS = 8C 90 34 12h
This instruction moves the content of the segment register SS to a memory location, whose EA is the sum of the 16-bit displacement 1234h and the content of BX and SI register.
  1. Five Byte Instruction:Immediate Operand (8 Bits data) to Memory with 16 bit displacement
4 Byte Description FORMAT/ Examples
5 byte format Immediate Operand (8 Bits data) to Memory with 16 bit displacement OP CODE MOD OP CODE R/M Displacement
(16 bits)
Immediate data
  1 Byte 2 Bit 3 bits 3 bits Low byte High byte 1 Byte
MOV Byte Ptr 0F246h[BP], 34h 11000110 10 000 110 01000110 11110010 00110100
Examples MOV Byte Ptr 0F246h[BP], 34h = C6 86 46 F2 34
This instruction moves the byte value 34h to a memory location whose EA is given as the sum of the 16-bit offset value F246h and the content of the BP register.
  1. Six Byte Instruction: Immediate Operand (16 Bits data) to Memory with 16 bit displacement
4 Byte Description FORMAT/ Examples
6 byte format Immediate Operand (16 Bits data) to Memory with 16 bit displacement OP CODE MOD OP CODE R/M Displacement
(16 bits)
Immediate data (16 bit)
  1 Byte 2 Bits 3 bits 3 bits Low Byte High Byte Low Byte High Byte
MOV WORD PTR 0F2h[BP],34h 11000111 10 000 110 F2 00 34 00
Examples MOV WORD PTR 0F2h[BP],34h = C7 86 F2 00 34 00h
This instruction moves 0034 to a memory location whose EA is given as the sum of the 16-bit offset value F2h and content of BP register.
  1. Seven Byte Instruction:
    FORMAT: Immediate data to a memory location
7 Byte Description   FORMAT/ Examples
7 byte format Immediate data to a memory location (intersegment) SOP OP CODE MOD OP CODE R/M Displacement
(16 bits)
Immediate data (16 bit)
  8-bit 1 Byte 2 Bits 3 bits 3 bits Low Byte High Byte Low Byte High Byte
MOV DS:0F246h[BP], 1234h 3E 11000111 10 000 110 F2h 46h 34h 12h
Examples   MOV DS:0F246h[BP], 1234h = 3E C7 86 F2 46 12 34h;
This instruction moves the value 1234h to a memory location whose EA is given as the sum of the 16-bit offset value and the content of BP register. The physical address is generated using DS as the segment register. Segment override (SOP) is necessary, because by default BP refers in the stack segment(SS) register.

 

 

Updated: September 16, 2020 — 3:46 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

care4you © 2020 Connect On Facebook DMCA.com Protection Status