Intel 8080 Instruction Set Reference¶
This document provides a complete reference for the Intel 8080 microprocessor instruction set.
Register Conventions¶
The following conventions are used throughout this document:
Symbol |
Description |
Registers |
|---|---|---|
|
Destination register (8-bit) |
See register fields below |
|
Source register (8-bit) |
See register fields below |
|
Register pair (16-bit) |
BC, DE, HL, SP |
|
Immediate operand |
8 or 16-bit value |
|
Memory address |
16-bit |
|
Port address |
8-bit |
|
Condition code |
See condition codes below |
Register Fields¶
8-bit registers are encoded as 3-bit fields:
Code |
Register |
Description |
|---|---|---|
|
A |
Accumulator |
|
B |
General purpose |
|
C |
General purpose |
|
D |
General purpose |
|
E |
General purpose |
|
H |
High byte of HL pair |
|
L |
Low byte of HL pair |
|
M |
Memory reference through HL |
Register Pairs¶
16-bit register pairs are encoded as 2-bit fields:
Code |
Pair |
Description |
|---|---|---|
|
BC |
B:C as 16-bit register |
|
DE |
D:E as 16-bit register |
|
HL |
H:L as 16-bit register |
|
SP |
Stack pointer (PSW for PUSH/POP) |
Condition Codes¶
Condition codes for conditional instructions:
Code |
Mnemonic |
Condition |
|---|---|---|
|
NZ |
Zero flag not set |
|
Z |
Zero flag set |
|
NC |
Carry flag not set |
|
C |
Carry flag set |
|
PO |
Parity odd (parity flag not set) |
|
PE |
Parity even (parity flag set) |
|
P |
Positive (sign flag not set) |
|
M |
Minus (sign flag set) |
Flag Legend¶
The following flags may be affected by instructions:
Flag |
Description |
Note |
|---|---|---|
|
Zero flag |
Set if result is zero |
|
Sign flag |
Set if result is negative |
|
Parity flag |
Set if result has even parity |
|
Carry flag |
Set if carry/borrow occurred |
|
Auxiliary carry |
For BCD operations |
Encoding Legend¶
For instructions that take operands:
db= Data byte (8-bit)lb= Low byte of 16-bit valuehb= High byte of 16-bit valuepa= Port address (8-bit)SSS= Source register field (3 bits)DDD= Destination register field (3 bits)RP= Register pair field (2 bits)CCC= Condition code field (3 bits)NNN= Restart vector (3 bits)
Flag Effects¶
The flag columns show which flags are affected:
Z= Zero flagS= Sign flagP= Parity flagC= Carry flagA= Auxiliary carry flag-= No flags affected
Instruction Set Reference¶
Data Transfer Instructions¶
Instruction |
Encoding |
Description |
|---|---|---|
|
|
Move register to register |
|
|
Move immediate to register |
|
|
Load register pair immediate |
|
|
Load A from memory |
|
|
Store A to memory |
|
|
Load HL from memory |
|
|
Store HL to memory |
|
|
Load indirect through BC or DE only |
|
|
Store indirect through BC or DE only |
|
|
Exchange DE and HL content |
Arithmetic Instructions¶
Instruction |
Encoding |
Flags |
Description |
|---|---|---|---|
|
|
ZSPCA |
Add register to A |
|
|
ZSPCA |
Add immediate to A |
|
|
ZSPCA |
Add register to A with carry |
|
|
ZSPCA |
Add immediate to A with carry |
|
|
ZSPCA |
Subtract register from A |
|
|
ZSPCA |
Subtract immediate from A |
|
|
ZSPCA |
Subtract register from A with borrow |
|
|
ZSPCA |
Subtract immediate from A with borrow |
|
|
ZSPA |
Increment register |
|
|
ZSPA |
Decrement register |
|
|
Increment register pair |
|
|
|
Decrement register pair |
|
|
|
C |
Add register pair to HL (16-bit) |
|
|
ZSPCA |
Decimal Adjust accumulator |
Logical Instructions¶
Instruction |
Encoding |
Flags |
Description |
|---|---|---|---|
|
|
ZSPCA |
AND register with A |
|
|
ZSPCA |
AND immediate with A |
|
|
ZSPCA |
OR register with A |
|
|
ZSPCA |
OR immediate with A |
|
|
ZSPCA |
Exclusive OR register with A |
|
|
ZSPCA |
Exclusive OR immediate with A |
|
|
ZSPCA |
Compare register with A |
|
|
ZSPCA |
Compare immediate with A |
Rotate and Shift Instructions¶
Instruction |
Encoding |
Flags |
Description |
|---|---|---|---|
|
|
C |
Rotate A left |
|
|
C |
Rotate A right |
|
|
C |
Rotate A left through carry |
|
|
C |
Rotate A right through carry |
Complement and Carry Instructions¶
Instruction |
Encoding |
Flags |
Description |
|---|---|---|---|
|
|
Complement A |
|
|
|
C |
Complement Carry flag |
|
|
C |
Set Carry flag |
Branch Instructions¶
Instruction |
Encoding |
Description |
|---|---|---|
|
|
Unconditional jump |
|
|
Conditional jump |
|
|
Unconditional subroutine call |
|
|
Conditional subroutine call |
|
|
Unconditional return from subroutine |
|
|
Conditional return from subroutine |
|
|
Restart (Call n*8) |
|
|
Jump to address in HL |
Stack Instructions¶
Instruction |
Encoding |
Description |
|---|---|---|
|
|
Push register pair on stack (RP=11 pushes PSW) |
|
|
Pop register pair from stack (RP=11 pops PSW, affects all registers) |
|
|
Swap HL with top word on stack |
|
|
Set SP to content of HL |
I/O Instructions¶
Instruction |
Encoding |
Description |
|---|---|---|
|
|
Read input port into A |
|
|
Write A to output port |
Control Instructions¶
Instruction |
Encoding |
Description |
|---|---|---|
|
|
Enable interrupts |
|
|
Disable interrupts |
|
|
Halt processor |
|
|
No operation |