Docsity

Microprocessor Programming - 8086 Instruction set, Study notes of Microprocessors

Partial preview of the text

Download Microprocessor Programming - 8086 Instruction set and more Study notes Microprocessors in PDF only on Docsity!

8086 Instruction set

Assembly Language

  • (^) Machine-Specific Programming Language that has one to one correspondence between statements and native machine language It represents complete instruction set of specific machine.
  • (^) IBM-PC Assembly Language
    • (^) refers to instruction set of 8086, 8088, 80186, 80286, 80386, 80486, and Pentium Processors. It is upward compatible.

Assembler

  • (^) An Assembler is a systems Level Program that translates assembly language source code into machine language code.
  • (^) Hand Coding : Manual conversion of each assembly language instruction called mnemonic to equivalent machine code is called hand coding. Assembly Language Instruction ADD AX, BX (Op-code) (Destination operand) (Source operand)

From Assembly to Machine Code

  • (^) An instruction can be coded with 1 to 6 bytes
  • (^) **Byte 2 has three fields
  • Mode field (MOD)[2bits] used to identify the mode of** **addressing along with R/M field
  • Register field (REG) used to identify the register for the first** **operand[3bits]
  • Register/memory field (R/M field)[3bits] used along with** mode bytes to identify the Addressing mode

3bits Register Field

Types of Instructions

  • (^) Data Transfer Instructions
  • (^) Arithmetic Instructions
  • (^) Logical Instructions
  • (^) Shift and Rotate Instructions
  • (^) Machine control instructions
  • (^) String Instruction
  • (^) Branch group of instructions

Data Transfer Instructions

  • (^) MOV
    • (^) Move byte or word to register or memory
  • (^) IN, OUT
    • (^) Input byte or word from port, output word to port
  • (^) LEA
    • (^) Load effective address
  • (^) LDS, LES
    • (^) Load pointer using data segment, extra segment
  • (^) PUSH, POP
    • (^) Push word onto stack, pop word off stack
  • (^) XCHG
    • (^) Exchange byte or word
  • (^) XLAT
    • (^) Translate byte using look-up table

Shift and Rotate Instructions

• SHL, SHR

  • (^) Logical shift left, right byte or word by 1 or CL
  • (^) SAL, SAR
  • (^) Arithmetic shift left, right byte or word by 1 or CL
  • (^) ROL, ROR
  • (^) Rotate left, right byte or word by 1 or CL
  • (^) RCL, RCR
  • (^) Rotate left, right through carry byte or word by 1 or CL

Arithmetic Instructions

  • (^) ADD, SUB
    • (^) Add, subtract byte or word
  • (^) ADC, SBB
    • (^) Add, subtract byte or word and carry (borrow)
  • (^) INC, DEC
    • (^) Increment, decrement byte or word
  • (^) NEG
    • (^) Negate byte or word (two's complement)
  • (^) CMP
    • (^) Compare byte or word (subtract without storing)

Control Transfer Instructions

  • (^) JMP : Unconditional jump
  • (^) JA (JNBE) : Jump if above (not below or equal)
  • (^) JAE (JNB) : Jump if above or equal (not below)
  • (^) JB (JNAE) : Jump if below (not above or equal)
  • (^) JBE (JNA) : Jump if below or equal (not above)
  • (^) JE (JZ) : Jump if equal (zero)
  • (^) JG (JNLE) : Jump if greater (not less or equal)
  • (^) JGE (JNL) : Jump if greater or equal (not less)
  • (^) JL (JNGE) : Jump if less (not greater nor equal)

Control Transfer Instructions

  • (^) JLE (JNG) : Jump if less or equal (not greater)
  • (^) JC, JNC : Jump if carry set, carry not set
  • (^) JO, JNO : Jump if overflow, no overflow
  • (^) JS, JNS : Jump if sign, no sign
  • (^) JNP (JPO) : Jump if no parity (parity odd)
  • (^) JP (JPE) : Jump if parity (parity even)
  • (^) LOOP : Loop unconditional, count in CX
  • (^) LOOPE (LOOPZ) Loop if equal (zero), count in CX
  • (^) LOOPNE (LOOPNZ) Loop if not equal (not zero), count in CX
  • (^) JCXZ : Jump if CX equals zero

String Instructions

  • (^) MOVS : Move byte or word string
  • (^) MOVSB, MOVSW :Move byte , word string
  • (^) CMPS : Compare byte or word string
  • (^) SCAS : Scan byte or word string
  • (^) LODS, STOS: Load, store byte or word string
  • (^) REP : Repeat
  • (^) REPE, REPZ : Repeat while equal, zero
  • (^) REPNE, REPNZ: Repeat while not equal (zero)

Processor Control Instructions

  • (^) STC, CLC, CMC Set, clear, complement carry flag
  • (^) S T D , C L D Set, clear direction flag
  • (^) S T I, C L I Set, clear interrupt enable flag
  • (^) LAHF, SAHF Load AH from flags, store AH into flags
  • (^) PUSHF, POPF Push flags onto stack, pop flags off stack
  • (^) E S C Escape to external processor interface
  • (^) LOCK Lock bus during next instruction
  • (^) NOP No operation (do nothing)
  • (^) WAIT Wait for signal on TEST input
  • (^) H L T Halt processor