PROGRAMMING MODEL
70
AACCUMULATOR
70
YINDEX REGISTER Y
70
XINDEX REGISTER X
1570
PCHPCLPROGRAM COUNTER
70
01SSTACK POINTER
70
NV-BDIZCPROCESSOR STATUS REGISTER "P"
NEGATIVE
OVERFLOW
BREAK COMMAND
DECIMAL MODE
INTERRUPT DISABLE
ZERO
CARRY
INSTRUCTION NOTATION
A Accumulator FIGURE 1. ASL – SHIFT ONE BIT LEFT
  • C
  • 7
  • 6
  • 5
  • 4
  • 3
  • 2
  • 1
  • 0
  • 0
FIGURE 2. LSR – SHIFT ONE BIT RIGHT
  • 0
  • 7
  • 6
  • 5
  • 4
  • 3
  • 2
  • 1
  • 0
  • C
FIGURE 3. ROL – ROTATE ONE BIT LEFT
  • C
  • 7
  • 6
  • 5
  • 4
  • 3
  • 2
  • 1
  • 0
  • C
FIGURE 4. ROR – ROTATE ONE BIT RIGHT
  • C
  • 7
  • 6
  • 5
  • 4
  • 3
  • 2
  • 1
  • 0
  • C
NOTE 1. BIT – TEST BITS Bit 6 and 7 are transfered to the status register.
If the result of A ∧ M is zero then Z=1, else Z=0.
X, Y Index Registers
M Memory
CBorrow
P Processor Status Register
S Stack Pointer
Change
No Change
+ Add
Logical AND
- Subtract
Logical Exclusive OR
Transfer From Stack
Transfer To Stack
Transfer To
Transfer To
Logical OR
PC Program Counter
PCH Program Counter High
PCL Program Counter Low
Oper Operand
# Immediate Addressing Mode
Name
Description
Operation Addressing
Mode
Assembly
Language
Form
HEX
OP
Code
No.
Bytes
"P" Status Reg.
N Z C I D V
ADC
Add memory to accumulator with carry A + M + C → A Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
ADC #Oper
ADC Oper
ADC Oper,X
ADC Oper
ADC Oper,X
ADC Oper,Y
ADC (Oper,X)
ADC (Oper),Y
69
65
75
6D
7D
79
61
71
2
2
2
3
3
3
2
2
✓ ✓ ✓ – – ✓
AND
"AND" memory with accumulator A ∧ M → A Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
AND #Oper
AND Oper
AND Oper,X
AND Oper
AND Oper,X
AND Oper,Y
AND (Oper,X)
AND (Oper),Y
29
25
35
2D
3D
39
21
31
2
2
2
3
3
3
2
2
✓ ✓ – – – –
ASL
Shift left one bit
(Memory or Accumulator)
(See Figure 1) Accumulator
Zero Page
Zero Page,X
Absolute
Absolute,X
ASL A
ASL Oper
ASL Oper,X
ASL Oper
ASL Oper,X
0A
06
16
0E
1E
1
2
2
3
3
✓ ✓ ✓ – – –
BCC
Branch on carry clear Branch on C=0 Relative BCC Oper 90 2 – – – – – –
BCS
Branch on carry set Branch on C=1 Relative BCS Oper B0 2 – – – – – –
BEQ
Branch on result zero Branch on Z=1 Relative BEQ Oper F0 2 – – – – – –
BIT
Test bits in memory with accumulator A ∧ M
M7 → N
M6 → V
Zero Page
Absolute
BIT Oper
BIT Oper
24
2C
2
3
M7 ✓ – – – M6
BMI
Branch on result minus Branch on N=1 Relative BMI Oper 30 2 – – – – – –
BNE
Branch on result not zero Branch on Z=0 Relative BNE Oper D0 2 – – – – – –
BPL
Branch on result plus Branch on N=0 Relative BPL Oper 10 2 – – – – – –
BRK
Force break interrupt Forced Interrupt
PC + 2 ↓
P ↓
Implied BRK 00 1 – – – 1 – –
BVC
Branch on overflow clear Branch on V=0 Relative BVC Oper 50 2 – – – – – –
Name
Description
Operation Addressing
Mode
Assembly
Language
Form
HEX
OP
Code
No.
Bytes
"P" Status Reg.
N Z C I D V
BVS
Branch on overflow set Branch on V=1 Relative BVS Oper 70 2 – – – – – –
CLC
Clear carry flag 0 → C Implied CLC 18 1 – – 0 – – –
CLD
Clear decimal mode 0 → D Implied CLD D8 1 – – – – 0 –
CLI
Clear interrupt disable 0 → I Implied CLI 58 1 – – – 0 – –
CLV
Clear overflow flag 0 → V Implied CLV B8 1 – – – – – 0
CMP
Compare memory and accumulator A - M Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
CMP #Oper
CMP Oper
CMP Oper,X
CMP Oper
CMP Oper,X
CMP Oper,Y
CMP (Oper,X)
CMP (Oper),Y
C9
C5
D5
CD
DD
D9
C1
D1
2
2
2
3
3
3
2
2
✓ ✓ ✓ – – –
CPX
Compare memory and index X X - M Immediate
Zero Page
Absolute
CPX #Oper
CPX Oper
CPX Oper
E0
E4
EC
2
2
3
✓ ✓ ✓ – – –
CPY
Compare memory and index Y Y - M Immediate
Zero Page
Absolute
CPY #Oper
CPY Oper
CPY Oper
C0
C4
CC
2
2
3
✓ ✓ ✓ – – –
DEC
Decrement memory by one M - 1 → M Zero Page
Zero Page,X
Absolute
Absolute,X
DEC Oper
DEC Oper,X
DEC Oper
DEC Oper,X
C6
D6
CE
DE
2
2
3
3
✓ ✓ – – – –
DEX
Decrement index X by one X - 1 → X Implied DEX CA 1 ✓ ✓ – – – –
DEY
Decrement index Y by one Y - 1 → Y Implied DEY 88 1 ✓ ✓ – – – –
EOR
"Exclusive OR" memory with accumulator A ⊻ M → A Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
EOR #Oper
EOR Oper
EOR Oper,X
EOR Oper
EOR Oper,X
EOR Oper,Y
EOR (Oper,X)
EOR (Oper),Y
49
45
55
4D
5D
59
41
51
2
2
2
3
3
3
2
2
✓ ✓ – – – –
Name
Description
Operation Addressing
Mode
Assembly
Language
Form
HEX
OP
Code
No.
Bytes
"P" Status Reg.
N Z C I D V
INC
Increment memory by one M + 1 → M Zero Page
Zero Page,X
Absolute
Absolute,X
INC Oper
INC Oper,X
INC Oper
INC Oper,X
E6
F6
EE
FE
2
2
3
3
✓ ✓ – – – –
INX
Increment index X by one X + 1 → X Implied INX E8 1 ✓ ✓ – – – –
INY
Increment index Y by one Y + 1 → Y Implied INY C8 1 ✓ ✓ – – – –
JMP
Jump to new location PC + 1 → PCL
PC + 2 → PCH
Absolute
(Indirect)
JMP Oper
JMP (Oper)
4C
6C
3
3
– – – – – –
JSR
Jump to new location saving return address PC + 2 ↓
PC + 1 → PCL
PC + 2 → PCH
Absolute JSR Oper 20 3 – – – – – –
LDA
Load accumulator with memory M → A Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
LDA #Oper
LDA Oper
LDA Oper,X
LDA Oper
LDA Oper,X
LDA Oper,Y
LDA (Oper,X)
LDA (Oper),Y
A9
A5
B5
AD
BD
B9
A1
B1
2
2
2
3
3
3
2
2
✓ ✓ – – – –
LDX
Load index X with memory M → X Immediate
Zero Page
Zero Page,Y
Absolute
Absolute,Y
LDX #Oper
LDX Oper
LDX Oper,Y
LDX Oper
LDX Oper,Y
A2
A6
B6
AE
BE
2
2
2
3
3
✓ ✓ – – – –
LDY
Load index Y with memory M → Y Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
LDY #Oper
LDY Oper
LDY Oper,X
LDY Oper
LDY Oper,X
A0
A4
B4
AC
BC
2
2
2
3
3
✓ ✓ – – – –
LSR
Shift right one bit
(memory or accumulator)
(See Figure 2) Accumulator
Zero Page
Zero Page,X
Absolute
Absolute,X
LSR A
LSR Oper
LSR Oper,X
LSR Oper
LSR Oper,X
4A
46
56
4E
5E
1
2
2
3
3
0 ✓ ✓ – – –
NOP
No operation No operation Implied NOP EA 1 – – – – – –
Name
Description
Operation Addressing
Mode
Assembly
Language
Form
HEX
OP
Code
No.
Bytes
"P" Status Reg.
N Z C I D V
ORA
"OR" memory with accumulator A ∨ M → A Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
ORA #Oper
ORA Oper
ORA Oper,X
ORA Oper
ORA Oper,X
ORA Oper,Y
ORA (Oper,X)
ORA (Oper),Y
09
05
15
0D
1D
19
01
11
2
2
2
3
3
3
2
2
✓ ✓ – – – –
PHA
Push accumulator on stack A ↓ Implied PHA 48 1 – – – – – –
PHP
Push processor status on stack P ↓ Implied PHP 08 1 – – – – – –
PLA
Pull accumulator from stack A ↑ Implied PLA 68 1 ✓ ✓ – – – –
PLP
Pull processor status from stack P ↑ Implied PLP 28 1 From Stack
ROL
Rotate one bit left
(memory or accumulator)
(See Figure 3) Accumulator
Zero Page
Zero Page,X
Absolute
Absolute,X
ROL A
ROL Oper
ROL Oper,X
ROL Oper
ROL Oper,X
2A
26
36
2E
3E
1
2
2
3
3
✓ ✓ ✓ – – –
ROR
Rotate one bit right
(memory or accumulator)
(See Figure 4) Accumulator
Zero Page
Zero Page,X
Absolute
Absolute,X
ROR A
ROR Oper
ROR Oper,X
ROR Oper
ROR Oper,X
6A
66
76
6E
7E
1
2
2
3
3
✓ ✓ ✓ – – –
RTI
Return from interrupt P ↑
PC ↑
Implied RTI 40 1 From Stack
RTS
Return from subroutine PC ↑
PC + 1 → PC
Implied RTS 60 1 – – – – – –
SBC
Subtract memory from accumulator with borrow A - M - C → A Immediate
Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
SBC #Oper
SBC Oper
SBC Oper,X
SBC Oper
SBC Oper,X
SBC Oper,Y
SBC (Oper,X)
SBC (Oper),Y
E9
E5
F5
ED
FD
F9
E1
F1
2
2
2
3
3
3
2
2
✓ ✓ ✓ – – ✓
Name
Description
Operation Addressing
Mode
Assembly
Language
Form
HEX
OP
Code
No.
Bytes
"P" Status Reg.
N Z C I D V
SEC
Set carry flag 1 → C Implied SEC 38 1 – – 1 – – –
SED
Set decimal mode 1 → D Implied SED F8 1 – – – – 1 –
SEI
Set interrupt disable 1 → I Implied SEI 78 1 – – – 1 – –
STA
Store accumulator in memory A → M Zero Page
Zero Page,X
Absolute
Absolute,X
Absolute,Y
(Indirect,X)
(Indirect),Y
STA Oper
STA Oper,X
STA Oper
STA Oper,X
STA Oper,Y
STA (Oper,X)
STA (Oper),Y
85
95
8D
9D
99
81
91
2
2
3
3
3
2
2
– – – – – –
STX
Store index X in memory X → M Zero Page
Zero Page,Y
Absolute
STX Oper
STX Oper,Y
STX Oper
86
96
8E
2
2
3
– – – – – –
STY
Store index Y in memory Y → M Zero Page
Zero Page,X
Absolute
STY Oper
STY Oper,X
STY Oper
84
94
8C
2
2
3
– – – – – –
TAX
Transfer accumulator to index X A → X Implied TAX AA 1 ✓ ✓ – – – –
TAY
Transfer accumulator to index Y A → Y Implied TAY A8 1 ✓ ✓ – – – –
TSX
Transfer stack pointer to index X S → X Implied TSX BA 1 ✓ ✓ – – – –
TXA
Transfer index X to accumulator X → A Implied TXA 8A 1 ✓ ✓ – – – –
TXS
Transfer index X to stack pointer X → S Implied TXS 9A 1 – – – – – –
TYA
Transfer index Y to accumulator Y → A Implied TYA 98 1 ✓ ✓ – – – –
HEX OPERATION CODES
00BRK 40RTI 80 C0CPYImmediate
01ORA(Indirect,X)41EOR(Indirect,X)81STA(Indirect,X)C1CMP(Indirect,X)
02 42 82 C2
03 43 83 C3
04 44 84STYZero Page C4CPYZero Page
05ORAZero Page 45EORZero Page 85STAZero Page C5CMPZero Page
06ASLZero Page 46LSRZero Page 86STXZero Page C6DECZero Page
07 47 87 C7
08PHP 48PHA 88DEY C8INY
09ORAImmediate 49EORImmediate 89 C9CMPImmediate
0AASLAccumulator 4ALSRAccumulator 8ATXA CADEX
0B 4B 8B CB
0C 4CJMPAbsolute 8CSTYAbsolute CCCPYAbsolute
0DORAAbsolute 4DEORAbsolute 8DSTAAbsolute CDCMPAbsolute
0EASLAbsolute 4ELSRAbsolute 8ESTXAbsolute CEDECAbsolute
0F 4F 8F CF
10BPL 50BVC 90BCC D0BNE
11ORA(Indirect),Y51EOR(Indirect),Y91STA(Indirect),YD1CMP(Indirect),Y
12 52 92 D2
13 53 93 D3
14 54 94STYZero Page,X D4
15ORAZero Page,X 55EORZero Page,X 95STAZero Page,X D5CMPZero Page,X
16ASLZero Page,X 56LSRZero Page,X 96STXZero Page,Y D6DECZero Page,X
17 57 97 D7
18CLC 58CLI 98TYA D8CLD
19ORAAbsolute,Y 59EORAbsolute,Y 99STAAbsolute,Y D9CMPAbsolute,Y
1A 5A 9ATXS DA
1B 5B 9B DB
1C 5C 9C DC
1DORAAbsolute,X 5DEORAbsolute,X 9DSTAAbsolute,X DDCMPAbsolute,X
1EASLAbsolute,X 5ELSRAbsolute,X 9E DEDECAbsolute,X
1F 5F 9F DF
20JSRAbsolute 60RTS A0LDYImmediate E0CPXImmediate
21AND(Indirect,X)61ADC(Indirect,X)A1LDA(Indirect,X)E1SBC(Indirect,X)
22 62 A2LDXImmediate E2
23 63 A3 E3
24BITZero Page 64 A4LDYZero Page E4CPXZero Page
25ANDZero Page 65ADCZero Page A5LDAZero Page E5SBCZero Page
26ROLZero Page 66RORZero Page A6LDXZero Page E6INCZero Page
27 67 A7 E7
28PLP 68PLA A8TAY E8INX
29ANDImmediate 69ADCImmediate A9LDAImmediate E9SBCImmediate
2AROLAccumulator 6ARORAccumulator AATAX EANOP
2B 6B AB EB
2CBITAbsolute 6CJMP(Indirect) ACLDYAbsolute ECCPXAbsolute
2DANDAbsolute 6DADCAbsolute ADLDAAbsolute EDSBCAbsolute
2EROLAbsolute 6ERORAbsolute AELDXAbsolute EEINCAbsolute
2F 6F AF EF
30BMI 70BVS B0BCS F0BEQ
31AND(Indirect),Y71ADC(Indirect),YB1LDA(Indirect),YF1SBC(Indirect),Y
32 72 B2 F2
33 73 B3 F3
34 74 B4LDYZero Page,X F4
35ANDZero Page,X 75ADCZero Page,X B5LDAZero Page,X F5SBCZero Page,X
36ROLZero Page,X 76RORZero Page,X B6LDXZero Page,Y F6INCZero Page,X
37 77 B7 F7
38SEC 78SEI B8CLV F8SED
39ANDAbsolute,Y 79ADCAbsolute,Y B9LDAAbsolute,Y F9SBCAbsolute,Y
3A 7A BATSX FA
3B 7B BB FB
3C 7C BCLDYAbsolute,X FC
3DANDAbsolute,X 7DADCAbsolute,X BDLDAAbsolute,X FDSBCAbsolute,X
3EROLAbsolute,X 7ERORAbsolute,X BELDXAbsolute,Y FEINCAbsolute,X
3F 7F BF FF