The 8086 microprocessor is a 16-bit processor developed by Intel.
It processes data
faster and more efficiently than earlier processors.
Main Parts of 8086 Architecture:
The 8086 is divided into two main units:
   1. Bus Interface Unit (BIU) – Handles communication with memory and
      input/output devices.
   2. Execution Unit (EU) – Performs calculations and executes instructions.
1. Bus Interface Unit (BIU)
   • Fetches instructions from memory.
   • Stores instructions in a 6-byte queue (helps in faster execution).
   • Uses segment registers (Code, Data, Stack, Extra) to access memory
      efficiently.
2. Execution Unit (EU)
   • Decodes and executes instructions.
   • Contains ALU (Arithmetic Logic Unit) to perform calculations (addition,
      subtraction, etc.).
   • Uses general-purpose registers (AX, BX, CX, DX) to store temporary data.
   • Control unit manages the execution of instructions.
How It Works?
  1. BIU fetches instructions from memory and stores them in the queue.
  2. EU takes instructions from the queue, decodes, and executes them.
  3. ALU performs calculations when needed.
  4. The result is stored in registers or memory.
MINIMUM MODE
timing diagram of the 8086 microprocessor for a read operation
timing diagram of the 8086 microprocessor for a Write operation
Maximum Mode Read
Write
The Flag Register in the 8086 microprocessor is a 16-bit register that shows the
status of the processor after an operation. It has status flags (for results of operations)
and control flags (to control operations).
Types of Flags:
    1. Status Flags (Indicate Results)
           o CF (Carry Flag) → Set if there is a carry out in addition or a borrow in
              subtraction.
           o PF (Parity Flag) → Set if the number of 1s in the result is even.
           o AF (Auxiliary Carry Flag) → Set if there is a carry from the lower
              nibble (used in BCD operations).
           o ZF (Zero Flag) → Set if the result is zero.
           o SF (Sign Flag) → Set if the result is negative.
           o OF (Overflow Flag) → Set if the result is too large for the destination
              register.
    2. Control Flags (Control Processor Operations)
           o TF (Trap Flag) → Used for single-step debugging.
           o IF (Interrupt Flag) → Enables or disables interrupts.
           o DF (Direction Flag) → Used in string operations (0 for forward, 1 for
              backward).
Simple Explanation:
    • These flags help the processor make decisions after arithmetic and logical
       operations.
    • Some flags indicate results (like Zero Flag, Carry Flag).
    • Some control how instructions execute (like Interrupt Flag, Direction Flag).
ADDRESSING MODES
1. Immediate Addressing
    • The operand (data) is directly given in the instruction.
    • Example: MOV AL, 25H (Move 25H into AL).
2. Register Addressing
    • The operand is stored in a register.
    • Example: MOV AX, BX (Copy BX into AX).
3. Direct Addressing
    • The memory address of the operand is given directly in the instruction.
    • Example: MOV AL, [1234H] (Move data from memory 1234H to AL).
4. Register Indirect Addressing
    • The memory address is stored in a register.
    • Example: MOV AL, [BX] (Move data from memory location pointed by BX
      into AL).
5. Indexed Addressing
    • Uses an index register (SI or DI) to hold the memory address.
    • Example: MOV AL, [SI] (Move data from memory location in SI to AL).
6. Base Indexed Addressing
    • Combines a base register (BX or BP) with an index register (SI or DI) for
      memory access.
    • Example: MOV AL, [BX+SI] (Move data from memory BX+SI to AL).
7. Base Indexed with Displacement
    • Uses Base + Index + Displacement for complex memory access.
    • Example: MOV AL, [BX+SI+10H] (Move data from memory BX+SI+10H to
      AL).
8. Relative Addressing
   • Used for jump instructions, where the next instruction address is relative to
      the current instruction.
   • Example: JMP 10H (Jump to address 10H from the current location).