Content is user-generated and unverified.

Assembly Language Guide - 8085, 8086 & 8088 Comparison

Table of Contents

  1. Quick Overview
  2. Architecture Comparison
  3. Addressing Modes (Detailed)
  4. Instruction Sets - All Three Processors
  5. Processor Comparison Table
  6. Programming Examples

Quick Overview {#overview}

Assembly language uses mnemonics to represent machine instructions, providing direct hardware control with one-to-one correspondence to machine code.

Key Benefits: Faster execution, smaller program size, direct hardware access, essential for system programming and embedded systems.

Architecture Comparison {#architecture-comparison}

8085 Microprocessor

  • 8-bit processor with 16-bit address bus (64KB memory)
  • Registers: A, B, C, D, E, H, L + PC, SP, Flags
  • Register Pairs: BC, DE, HL (16-bit operations)
  • Clock: 3 MHz
  • Simple architecture - single processing unit

8086 Microprocessor

  • 16-bit processor with 20-bit address bus (1MB memory)
  • Dual-unit architecture: Execution Unit (EU) + Bus Interface Unit (BIU)
  • General Registers: AX, BX, CX, DX (can split into AL/AH, BL/BH, etc.)
  • Index Registers: SI, DI
  • Pointer Registers: SP, BP
  • Segment Registers: CS, DS, ES, SS
  • 6-byte instruction queue for pipelining
  • Clock: 5-10 MHz

8088 Microprocessor

  • 16-bit processor internally, 8-bit external data bus
  • Same internal architecture as 8086 (EU + BIU)
  • Same registers and addressing as 8086
  • 4-byte instruction queue (smaller than 8086)
  • Clock: 5-8 MHz
  • Used in original IBM PC

Addressing Modes (Detailed) {#addressing-modes}

8085 Addressing Modes (5 Types):

  1. Register: MOV A, B - operand in register
  2. Immediate: MVI A, 25H - operand in instruction
  3. Direct: LDA 2000H - operand address given directly
  4. Register Indirect: MOV A, M - address in register pair (HL)
  5. Implied: CMA - operand implied by instruction

8086/8088 Addressing Modes (8 Types):

1. Register Addressing

assembly
MOV AX, BX      ; AX ← BX
ADD AL, CL      ; AL ← AL + CL

2. Immediate Addressing

assembly
MOV AL, 25H     ; AL ← 25H
MOV BX, 1234H   ; BX ← 1234H

3. Direct Addressing

assembly
MOV AX, [1234H] ; AX ← [DS:1234H]
MOV [2000H], BL ; [DS:2000H] ← BL

4. Register Indirect Addressing

Valid registers: BX, SI, DI, BP Default segments: BX/SI/DI→DS, BP→SS

assembly
MOV AX, [BX]    ; AX ← [DS:BX]
MOV [SI], AL    ; [DS:SI] ← AL
MOV [BP], DX    ; [SS:BP] ← DX

5. Based Addressing (Base + Displacement)

Base registers: BX, BP

assembly
MOV AX, [BX+4]   ; AX ← [DS:BX+4]
MOV AL, [BP+6]   ; AL ← [SS:BP+6]
MOV [BX+100], CX ; [DS:BX+100] ← CX

6. Indexed Addressing (Index + Displacement)

Index registers: SI, DI

assembly
MOV AX, [SI+2]   ; AX ← [DS:SI+2]
MOV [DI+10], BL  ; [DS:DI+10] ← BL

7. Based Indexed Addressing (Base + Index)

Combinations: BX+SI, BX+DI, BP+SI, BP+DI

assembly
MOV AX, [BX+SI]     ; AX ← [DS:BX+SI]
MOV [BP+DI], AL     ; [SS:BP+DI] ← AL

8. Based Indexed with Displacement

Most complex: Base + Index + Displacement

assembly
MOV AL, [BX+SI+5]   ; AL ← [DS:BX+SI+5]
MOV [BP+DI+10], CX  ; [SS:BP+DI+10] ← CX

Physical Address Calculation (8086/8088):

Physical Address = Segment Register × 16 + Offset

Example: DS = 2000H, BX = 0150H
Physical Address = 2000H × 16 + 0150H = 20150H

Segment Override:

assembly
MOV AL, ES:[BX]      ; Use ES instead of default DS
MOV [SS:DI], CX      ; Use SS instead of default DS

Instruction Sets - All Three Processors {#instruction-sets}

8085 Instruction Set (78 Instructions)

Data Transfer (13 instructions):

assembly
MOV A, B        ; Move register to register
MVI A, 25H      ; Move immediate to register  
LDA 2000H       ; Load accumulator direct
STA 3000H       ; Store accumulator direct
LXI H, 2000H    ; Load register pair immediate
LDAX B          ; Load accumulator indirect
STAX D          ; Store accumulator indirect
PUSH H          ; Push register pair on stack
POP H           ; Pop register pair from stack
XTHL            ; Exchange top of stack with HL
SPHL            ; Copy HL to SP
PCHL            ; Jump to address in HL
XCHG            ; Exchange DE and HL

Arithmetic (11 instructions):

assembly
ADD B           ; Add register to A
ADC C           ; Add register to A with carry
SUB D           ; Subtract register from A
SBB E           ; Subtract register from A with borrow
INR A           ; Increment register
DCR B           ; Decrement register
DAD B           ; Add register pair to HL
ADI 25H         ; Add immediate to A
ACI 30H         ; Add immediate to A with carry
SUI 15H         ; Subtract immediate from A
SBI 20H         ; Subtract immediate from A with borrow

Logical (10 instructions):

assembly
ANA B           ; AND register with A
ANI 0FH         ; AND immediate with A
ORA C           ; OR register with A
ORI F0H         ; OR immediate with A
XRA D           ; XOR register with A
XRI AAH         ; XOR immediate with A
CMP E           ; Compare register with A
CPI 25H         ; Compare immediate with A
CMA             ; Complement A
CMC             ; Complement carry flag

Branch (17 instructions):

assembly
JMP 2000H       ; Unconditional jump
JZ 3000H        ; Jump if zero
JNZ 3000H       ; Jump if not zero
JC 3000H        ; Jump if carry
JNC 3000H       ; Jump if no carry
JP 3000H        ; Jump if positive
JM 3000H        ; Jump if minus
JPE 3000H       ; Jump if parity even
JPO 3000H       ; Jump if parity odd
CALL 5000H      ; Call subroutine
CC 5000H        ; Call if carry
CNC 5000H       ; Call if no carry
CZ 5000H        ; Call if zero
CNZ 5000H       ; Call if not zero
RET             ; Return from subroutine
RC              ; Return if carry
RNC             ; Return if no carry

Stack/Machine Control (7 instructions):

assembly
PUSH PSW        ; Push accumulator and flags
POP PSW         ; Pop accumulator and flags
EI              ; Enable interrupts
DI              ; Disable interrupts
HLT             ; Halt processor
NOP             ; No operation
RST 3           ; Restart (call to specific address)

8086 Instruction Set (Over 100 Instructions)

Data Transfer (14 main types):

assembly
MOV AX, BX      ; Move data
PUSH AX         ; Push on stack
POP BX          ; Pop from stack
XCHG AX, BX     ; Exchange
IN AL, 60H      ; Input from port
OUT 61H, AL     ; Output to port
LEA SI, [BX+4]  ; Load effective address
LDS SI, [BX]    ; Load pointer using DS
LES DI, [BX]    ; Load pointer using ES
LAHF            ; Load AH from flags
SAHF            ; Store AH to flags
PUSHF           ; Push flags
POPF            ; Pop flags
XLAT            ; Translate byte in AL

Arithmetic (16 main types):

assembly
ADD AX, BX      ; Addition
ADC CX, DX      ; Add with carry
SUB AX, BX      ; Subtraction
SBB CX, DX      ; Subtract with borrow
MUL BL          ; Unsigned multiply
IMUL CL         ; Signed multiply
DIV BL          ; Unsigned divide
IDIV CL         ; Signed divide
INC AX          ; Increment
DEC BX          ; Decrement
NEG AX          ; Two's complement
CMP AX, BX      ; Compare
AAA             ; ASCII adjust for addition
AAS             ; ASCII adjust for subtraction
AAM             ; ASCII adjust for multiplication
AAD             ; ASCII adjust for division

Logical (9 main types):

assembly
AND AX, BX      ; Logical AND
OR CX, DX       ; Logical OR
XOR AX, BX      ; Logical XOR
NOT BX          ; One's complement
SHL AL, 1       ; Shift left
SHR BL, CL      ; Shift right
SAL DL, 1       ; Arithmetic shift left
SAR DH, CL      ; Arithmetic shift right
TEST AL, 01H    ; Test bits (AND without storing)

String Operations (5 types):

assembly
MOVSB/MOVSW     ; Move string
CMPSB/CMPSW     ; Compare string
SCASB/SCASW     ; Scan string
LODSB/LODSW     ; Load string
STOSB/STOSW     ; Store string

Control Transfer (Many types):

assembly
JMP LABEL       ; Unconditional jump
JE/JZ LABEL     ; Jump if equal/zero
JNE/JNZ LABEL   ; Jump if not equal/not zero
JA/JNBE LABEL   ; Jump if above (unsigned)
JB/JNAE LABEL   ; Jump if below (unsigned)
JG/JNLE LABEL   ; Jump if greater (signed)
JL/JNGE LABEL   ; Jump if less (signed)
CALL PROC       ; Call procedure
RET             ; Return
LOOP LABEL      ; Loop with CX counter
INT 21H         ; Software interrupt
IRET            ; Interrupt return

8088 Instruction Set

Identical to 8086 - same mnemonics, same opcodes, same functionality. The only differences are:

  • Internal execution timing (due to 8-bit external bus)
  • Memory access patterns (fetches bytes instead of words when possible)

Processor Comparison Table {#comparison-table}

Feature808580868088
Architecture8-bit16-bit16-bit internal, 8-bit external
Data Bus8-bit16-bit8-bit
Address Bus16-bit20-bit20-bit
Memory Addressing64KB1MB1MB
Registers7 main registers14 main registers14 main registers
Register Pairs3 pairs (BC, DE, HL)Multiple combinationsMultiple combinations
Addressing Modes5 modes8 modes8 modes
Instruction QueueNone6 bytes4 bytes
PipeliningNoYes (fetch/execute)Yes (fetch/execute)
Instruction Set Size78 instructions100+ instructions100+ instructions
SegmentationNoYes (4 segments)Yes (4 segments)
Clock Speed3 MHz5-10 MHz5-8 MHz
Pins404040
Multiplication/DivisionSoftware onlyHardware MUL/DIVHardware MUL/DIV
String OperationsNoYesYes
Used InSimple embedded systemsHigh-end systemsIBM PC (original)

Key Architectural Differences:

Processing Units:

  • 8085: Single unit handles everything
  • 8086/8088: Dual units (EU + BIU) work in parallel

Memory Model:

  • 8085: Linear 64KB memory space
  • 8086/8088: Segmented 1MB memory (4 segments of 64KB each)

Performance:

  • 8085: Simple, predictable timing
  • 8086: Faster due to 16-bit operations and pipelining
  • 8088: Slower than 8086 due to 8-bit external bus, but same capabilities

Complexity:

  • 8085: Easiest to learn and program
  • 8086: Most complex but most powerful
  • 8088: Same complexity as 8086 but more compatible with 8-bit systems

Programming Examples {#programming-examples}

Example 1: Add Two Numbers

8085 Version:

assembly
        LDA 2000H       ; Load first number
        MOV B, A        ; Save in B
        LDA 2001H       ; Load second number  
        ADD B           ; Add B to A
        STA 2002H       ; Store result
        HLT             ; Stop

8086/8088 Version:

assembly
MOV AL, [2000H]     ; Load first number
ADD AL, [2001H]     ; Add second number
MOV [2002H], AL     ; Store result
HLT                 ; Stop

Example 2: Find Maximum of Array

8085 Version:

assembly
        LXI H, 2000H    ; Point to array
        MOV A, M        ; Load first element as max
        MVI B, 04H      ; Counter for remaining elements
LOOP:   INX H           ; Point to next element
        CMP M           ; Compare with current element
        JNC SKIP        ; Jump if A >= M
        MOV A, M        ; Update maximum
SKIP:   DCR B           ; Decrement counter
        JNZ LOOP        ; Continue if not zero
        STA 2005H       ; Store maximum
        HLT

8086/8088 Version:

assembly
LEA SI, ARRAY       ; Point to array
MOV AL, [SI]        ; Load first element
MOV CX, 4           ; Counter for remaining elements
INC SI              ; Point to next element
AGAIN:
    CMP AL, [SI]    ; Compare with current element
    JGE SKIP        ; Jump if AL >= [SI]
    MOV AL, [SI]    ; Update maximum
SKIP:
    INC SI          ; Point to next element
    LOOP AGAIN      ; Continue loop
MOV MAX, AL         ; Store result
HLT

Key Programming Differences:

  1. Memory Addressing: 8085 uses direct addresses, 8086/8088 use segmented addressing
  2. Loop Constructs: 8086/8088 have dedicated LOOP instruction
  3. Register Usage: 8086/8088 have more registers and flexible addressing
  4. Instruction Efficiency: 8086/8088 can perform more complex operations in single instructions

This focused guide emphasizes the critical concepts you need to master, especially the detailed addressing modes and comprehensive comparison of all three processors. The addressing modes section is particularly important as it forms the foundation for effective assembly programming in 8086/8088 systems.

Content is user-generated and unverified.
    Complete Assembly Language Guide - 8085 & 8086 | Claude