Featured Posts

Explain instructions format of 8086 microprocessor in detail.

Instructions format of 8086 microprocessor in detail.

      In 8086 all instruction will not be of same size. The instruction vary from 1 to 6 bytes in length. The length of instruction bytes is dependent  upon addressing mode used by programmer i.e. immediate, register relative, based indexed, relative based indexed and so on.

      Basically instruction bytes will contain information of :

  2. Addressing mode designations :
  • 2 byte Effective Address.
  • 1 or 2 byte displacement.
  • 1 or 2 byte immediate operand.
As shown in figure normally first byte is OPCODE byte, second byte normally specifies addressing mode.  Sometime it may also contain OPCODE part. After OPCODE and addressing mode bytes, we have following different cases :
  • No additional bytes 
  • A 2 byte EA ( for direct addressing mode.
  • A 1 or 2 byte immediate operand.
  • A 1 or 2 byte displacement followed by 1 or 2 byte immediate operand.
( REG - Register, MOD - Mode, R/M - Register or Memory DISP - Displacement, DATA - Immediate data. )

One - byte instruction - implied operand(s)
One - byte instruction - register mode
Register to Register

Register to/from memory with no displacement

Register to/from memory with displacement

Immediate operand to register

Immediate operand to memory with 16 bit displacement

       If a displacement or immediate operand is 2 bytes long, the low order byte always appears first, this is Intel standard.
Instruction format of 8086 microprocessor

       As shown in this figure the first six bits of multi byte instruction generally contains an opcode that identifies the basic instruction type i.e. ADD, XOR etc. The following bit, called the D field, generally specifies the direction of the operation.

        D = 1 means instruction source is specified in REG field.
        D = 0 meas instruction destination is specified in REG field.
The next following bit is W. This bit identifies between byte and word operation.
        W = 0 instruction operates on byte data
            = 1 instruction operates on word data
In this we have three single bit fields, S, V, Z.

      S bit : S bit is used in conjunction with W to indicate sign extension of immediate fields in arithmetic instructions.

     S = 0 No sign extension
        = 1 sign extended 8 bit immediate data to 16 bits if W = 1.

Therefore for 8 bit operations : S = W= 0
16 bit operation with a 16 bit immediate operand : S = 0, W = 1
16 bit operation with a sign extended 8 bit immediate operand : S =W = 1

     V bit :  Used by shift and rotate, to determine single and variable - bit shifts and rotate.

              V = 0 shift/rotate count is one
                 = 1 shift/rotate count is specified in CL register.

     Z bit : This bit is used as compare bit with zero flag in conditional repeat(REP) and loop instructions.

            Z = 0 Repeat/loop while zero flag is clear
               = 1 Repeat/loop while zero flag is set.

     MOD : The mode (MOD) field indicates whether one of the operands is in memory or whether both operands are register.

     REG : The register field identifies a register that is one of the instruction operands REG field depends upon W bit.

     R/M (Register or Momery)  : This field is of 3 bits. The meaning of R/M bits changes depending upon mode (MOD) field.

Post a Comment


www.posthatke.com. Powered by Blogger.
Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com