Skip to content
Advanced Microprocessor

Addressing Modes, Instruction Formats & Opcodes

The 5 addressing modes, 1/2/3-byte formats, arithmetic, logic, branch, and data transfer instruction classifications.

Knova editors12 min readQuick checkSources

Addressing Modes and Instruction Set of 8085

An instruction is a binary command given to the microprocessor to perform a specific task on given data. In 8085 assembly language, each instruction consists of two parts:

  1. Opcode (Operation Code): The binary pattern or mnemonic that specifies the task to be performed (e.g., MOV, ADD, JMP).
  2. Operand: The data, register, or memory address upon which the opcode operates.

Instruction Formats by Byte Size

Instructions in the 8085 are classified into three types based on memory footprint:

  • One-Byte Instructions: The opcode and operand are encoded together in a single 8-bit byte.
    • MOV A, B → → Opcode: 78H78\text{H} (1 byte)
    • ADD C → → Opcode: 81H81\text{H} (1 byte)
    • CMA → → Opcode: 2FH2\text{F}\text{H} (1 byte)
  • Two-Byte Instructions: The first byte represents the opcode, and the second byte specifies 8-bit immediate data or an 8-bit port address.
    • MVI A, 45H → → Byte 1: 3EH3\text{E}\text{H} (Opcode), Byte 2: 45H45\text{H} (Data)
    • IN 80H → → Byte 1: DBH\text{DB}\text{H} (Opcode), Byte 2: 80H80\text{H} (Port address)
  • Three-Byte Instructions: The first byte is the opcode, followed by a 16-bit address or 16-bit constant. In 8085 little-endian storage, the low-order byte is stored first, followed by the high-order byte.
    • LDA 2050H → → Byte 1: 3AH3\text{A}\text{H} (Opcode), Byte 2: 50H50\text{H} (Low Address), Byte 3: 20H20\text{H} (High Address)
    • LXI H, 3000H → → Byte 1: 21H21\text{H} (Opcode), Byte 2: 00H00\text{H} (Low Data), Byte 3: 30H30\text{H} (High Data)

The Five Addressing Modes

The term addressing mode refers to the method by which the operand of an instruction is specified. The 8085 features five primary addressing modes:

  1. Immediate Addressing Mode: The operand data is specified directly within the instruction itself.
    assembly
    1MVI A, 25H ; Load 8-bit literal 25H directly into register A
    2LXI H, 2050H ; Load 16-bit literal 2050H into HL register pair
    3ADI 05H ; Add 05H immediately to the Accumulator
  2. Register Addressing Mode: The operand resides in one of the internal registers (A,B,C,D,E,H,LA, B, C, D, E, H, L). Data moves between registers without accessing memory.
    assembly
    1MOV A, B ; Copy contents of register B into register A
    2ADD C ; Add contents of register C to Accumulator
    3XRA D ; Exclusive-OR register D with Accumulator
  3. Direct Addressing Mode: The 16-bit memory address containing the operand is explicitly provided in the second and third bytes of the instruction.
    assembly
    1LDA 2500H ; Load Accumulator with data stored at memory address 2500H
    2STA 3000H ; Store Accumulator contents into memory address 3000H
    3LHLD 4000H ; Load register L from [4000H] and register H from [4001H]
  4. Register Indirect Addressing Mode: The address of the memory operand is held in a 16-bit register pair (HL,BC,HL, BC, or DEDE). The instruction references the memory location through the pointer.
    assembly
    1MOV A, M ; Copy byte from memory address pointed to by [HL] into A
    2STAX B ; Store Accumulator into memory address pointed to by [BC]
    3LDAX D ; Load Accumulator from memory address pointed to by [DE]
    Fig 4.1: Indirect Memory Addressing Mechanism via Composite 16-Bit [HL] Pointer
    Fig 4.1: Indirect Memory Addressing Mechanism via Composite 16-Bit [HL] Pointer
  5. Implicit (Implied) Addressing Mode: The operand is implicit in the definition of the opcode; no separate operand field is specified.
    assembly
    1CMA ; Complement the Accumulator (A = NOT A)
    2RAL ; Rotate Accumulator Left through Carry
    3STC ; Set Carry Flag to 1
    4EI ; Enable hardware interrupts

Instruction Classification by Function

The 8085's 74 instructions divide into five functional groups:

1. Data Transfer Group

Copies data from source to destination without modifying CPU flags:

  • MOV r1, r2 and MOV r, M / MOV M, r
  • MVI r, data and MVI M, data
  • LXI rp, data16 (Loads 16-bit immediate value into register pair BC,DE,HL,BC, DE, HL, or SPSP)
  • LDA addr and STA addr
  • LHLD addr and SHLD addr (Direct loading/storing of the HLHL pair)
  • XCHG (Exchanges HLHL with DEDE contents in a single machine cycle)
  • SPHL (Copies HLHL into Stack Pointer) and PCHL (Jumps to address in HLHL)

2. Arithmetic Group

Performs addition, subtraction, increment, decrement, and BCD conversion:

  • ADD r / ADD M (Adds register or memory to Accumulator)
  • ADC r (Add with Carry: A←A+r+CYA \leftarrow A + r + CY)
  • SUB r (Subtract: A←A−rA \leftarrow A - r, uses two's complement internally)
  • SBB r (Subtract with Borrow: A←A−r−CYA \leftarrow A - r - CY)
  • INR r / DCR r (Increment/Decrement 8-bit register, affects S,Z,AC,PS, Z, AC, P but not CYCY)
  • INX rp / DCX rp (Increment/Decrement 16-bit register pair, affects no flags)
  • DAD rp (Double Add: adds register pair to HLHL, setting only CYCY if overflow exceeds 16 bits)
  • DAA (Decimal Adjust Accumulator): Adjusts 8-bit binary sum into two 4-bit Packed BCD digits:
    • If the lower nibble (D3−D0D_3-D_0) exceeds 99 or if AC=1AC = 1, adds 06H06\text{H} to Accumulator.
    • If the upper nibble (D7−D4D_7-D_4) exceeds 99 or if CY=1CY = 1, adds 60H60\text{H} to Accumulator.

3. Logical Group

Performs bitwise logic, rotation, and comparisons:

  • ANA r / ANI data (Bitwise AND: sets AC=1AC=1, clears CY=0CY=0)
  • ORA r / ORI data (Bitwise OR: clears both ACAC and CYCY)
  • XRA r / XRI data (Bitwise XOR: clears both ACAC and CYCY; XRA A zeroes the Accumulator in 1 byte, 4T states)
  • CMP r / CPI data (Compares by subtracting operand from AA without saving result):
    A<operand  ⟹  CY=1,Z=0;A=operand  ⟹  Z=1,CY=0;A>operand  ⟹  CY=0,Z=0A < \text{operand} \implies CY=1, Z=0; \quad A = \text{operand} \implies Z=1, CY=0; \quad A > \text{operand} \implies CY=0, Z=0
  • RLC (Rotate Left without carry bit in loop) vs. RAL (Rotate Left through 9-bit carry loop).

4. Branching Group

Alters program sequential execution unconditionally or conditionally based on flag flip-flops:

  • Unconditional: JMP addr, CALL addr, RET
  • Conditional Jump: JZ (Jump if Zero, Z=1Z=1), JNZ (Z=0Z=0), JC (Jump if Carry, CY=1CY=1), JNC (CY=0CY=0), JP (Positive, S=0S=0), JM (Minus, S=1S=1), JPE (Parity Even, P=1P=1), JPO (Parity Odd, P=0P=0).

5. Machine Control Group

Controls processor execution and interrupts:

  • NOP (No Operation, consumes 4 clock states)
  • HLT (Halts CPU; exits only on Reset or Interrupt)
  • EI (Enable Interrupts) and DI (Disable Interrupts)
  • SIM (Set Interrupt Mask) and RIM (Read Interrupt Mask)
Try it
Addressing Mode Identification: Which addressing mode does the instruction STAX D utilize?

Sources

  1. 1.Intel 8085 Microprocessor Datasheet · reference · Intel (opens in a new tab)

Was this chapter useful?

Editors read every answer.

Star this chapter

Each star goes once to every reader who improved this chapter.

Finished reading?

Mark it to keep your place in the course.