8085 Microprocessor:
Flags, Instruction
Formats, and
Addressing Modes
Overview
• - Flag and Flag Register
• - Instruction Formats
• - Addressing Modes
8085 Flag Register
• - 8-bit register
• - Affects execution of conditional instructions
• - Common Flags:
• - Sign (S)
• - Zero (Z)
• - Auxiliary Carry (AC)
• - Parity (P)
• - Carry (CY)
8085 Flag Register Structure
S Z - AC - P - CY
• D7 D6 D5 D4 D3 D2 D1 D0
• - 3 bits unused
• - Flags updated after arithmetic/logical
operations
Functions of Each Flag
S Z - AC - P - CY
• S - Set if MSB of result is 1 (negative)
• Z - Set if result is zero
• AC - Carry from bit 3 to bit 4
• P - Set if even number of 1s
• CY - Set if carry/borrow occurs
Instruction Formats
• 8085 has 3 formats:
• 1. One-byte instruction
• 2. Two-byte instruction
• 3. Three-byte instruction
One-byte Instructions
• - Opcode and operand in a single byte
• - Examples:
• - MOV A, B (Copies the contents of register B into
register A.)
• - ADD C (Adds the contents of register C to the
Accumulator A.)
Two-byte Instructions
• - First byte: Opcode
• - Second byte: 8-bit data
• - Example:
• - MVI A, 32H(Moves the immediate value
32H (hexadecimal) into the accumulator A.)
Three-byte Instructions
•- First byte: Opcode
•- Second & Third: 16-bit address
•- Example:
• - LXI H, 2050H (Loads the H-L register pair
with the 16-bit address 2050H.)
• - LDA 3000H (Loads the accumulator with the
content of memory location 3000H.)
Addressing Modes in 8085
• 1. Immediate
• 2. Register
• 3. Direct
• 4. Indirect
• 5. Implicit
Immediate Addressing
• - Operand is part of instruction
• - Example:
• - MVI A, 0FH ( Loads the immediate value
OFH into register A.)
Register Addressing
• - Operand stored in register
• - Example:
• - MOV B, C (Copies contents of register C into
register B.)
• - ADD D ( Adds the contents of register D to
accumulator A.)
Direct Addressing
• - Address specified directly
• - Example:
• - LDA 2050H (Loads A with content from
memory location 2050H.
• - STA 3000H(Stores contents of accumulator
A into memory location 3000H.
Indirect Addressing
• - Address stored in register pair (HL or DE)
• - Example:
• - MOV A, M(M refers to memory pointed by
HL pair; moves content of memory to A.
• - LDAX D (Loads A with content of memory
whose address is in register pair DE.)
Implicit Addressing
• - Operand implied in the instruction
• - Example:
• - CMA (Complements the content of the
accumulator (A = ~A).
• - RRC (Rotates the accumulator right by one
bit; bit 0 goes to bit 7 and Carry flag.
Summary Table
• Flags: S, Z, AC, P, CY in 8-bit register
• Instruction Format: 1, 2, 3-byte instructions
• Addressing Modes: Immediate, Register,
Direct, Indirect, Implicit