Implied
In the implied addressing mode, the address containing the operand is implicitly stated in the operation code of the instruction.
Bytes: 1
Instruction | Opcode | No. Cycles |
---|---|---|
BRK | $00 | 7 |
CLC | $18 | 2 |
CLD | $D8 | 2 |
CLI | $58 | 2 |
CLV | $B8 | 2 |
DEX | $CA | 2 |
DEY | $88 | 2 |
INX | $E8 | 2 |
INY | $C8 | 2 |
NOP | $EA | 2 |
PHA | $48 | 3 |
PHP | $08 | 3 |
PLA | $68 | 4 |
PLP | $28 | 4 |
RTI | $40 | 6 |
RTS | $60 | 6 |
SEC | $38 | 2 |
SED | $F8 | 2 |
SEI | $78 | 2 |
TAX | $AA | 2 |
TAY | $A8 | 2 |
TSX | $BA | 2 |
TXA | $8A | 2 |
TXS | $9A | 2 |
TYA | $98 | 2 |
AccumulatorA
This form of addressing is represented with a one byte instruction, implying an operation on the accumulator.
Bytes: 1
Instruction | Opcode | No. Cycles |
---|---|---|
ASL A | $0A | 2 |
LSR A | $4A | 2 |
ROL A | $2A | 2 |
ROR A | $6A | 2 |
Immediate#$nn
In immediate addressing, the operand is contained in the second byte of the instruction, with no further memory addressing required.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
ADC #$nn | $69 | 2 |
AND #$nn | $29 | 2 |
CMP #$nn | $C9 | 2 |
CPX #$nn | $E0 | 2 |
CPY #$nn | $C0 | 2 |
EOR #$nn | $49 | 2 |
LDA #$nn | $A9 | 2 |
LDX #$nn | $A2 | 2 |
LDY #$nn | $A0 | 2 |
ORA #$nn | $09 | 2 |
SBC #$nn | $E9 | 2 |
Absolute$nnnn
In absolute addressing, the second byte of the instruction specifies the eight low order bits of the effective address while the third byte specifies the eight high order bits. Thus, the absolute addressing mode allows access to the entire 65 K bytes of addressable memory.
Bytes: 3
Instruction | Opcode | No. Cycles |
---|---|---|
ADC $nnnn | $6D | 4 |
AND $nnnn | $2D | 4 |
ASL $nnnn | $0E | 6 |
BIT $nnnn | $2C | 4 |
CMP $nnnn | $CD | 4 |
CPX $nnnn | $EC | 4 |
CPY $nnnn | $CC | 4 |
DEC $nnnn | $CE | 6 |
EOR $nnnn | $4D | 4 |
INC $nnnn | $EE | 6 |
JMP $nnnn | $4C | 3 |
JSR $nnnn | $20 | 6 |
LDA $nnnn | $AD | 4 |
LDX $nnnn | $AE | 4 |
LDY $nnnn | $AC | 4 |
LSR $nnnn | $4E | 6 |
ORA $nnnn | $0D | 4 |
ROL $nnnn | $2E | 6 |
ROR $nnnn | $6E | 6 |
SBC $nnnn | $ED | 4 |
STA $nnnn | $8D | 4 |
STX $nnnn | $8E | 4 |
STY $nnnn | $8C | 4 |
X-Indexed Absolute$nnnn,X
This form of addressing is used in conjunction with the X index register. The effective address is formed by adding the contents of X to the address contained in the second and third bytes of the instruction. This mode allows the index register to contain the index or count value and the instruction to contain the base address. This type of indexing allows any location referencing and the index to modify multiple fields resulting in reduced coding and execution time.
Note on the MOS 6502:
The value at the specified address, ignoring the addressing mode's X offset, is read (and discarded) before the final address is read. This may cause side effects in I/O registers.
Bytes: 3
Instruction | Opcode | No. Cycles |
---|---|---|
ADC $nnnn,X | $7D | 4+p |
AND $nnnn,X | $3D | 4+p |
ASL $nnnn,X | $1E | 7 |
CMP $nnnn,X | $DD | 4+p |
DEC $nnnn,X | $DE | 7 |
EOR $nnnn,X | $5D | 4+p |
INC $nnnn,X | $FE | 7 |
LDA $nnnn,X | $BD | 4+p |
LDY $nnnn,X | $BC | 4+p |
LSR $nnnn,X | $5E | 7 |
ORA $nnnn,X | $1D | 4+p |
ROL $nnnn,X | $3E | 7 |
ROR $nnnn,X | $7E | 7 |
SBC $nnnn,X | $FD | 4+p |
STA $nnnn,X | $9D | 5 |
p: =1 if page is crossed.
Y-Indexed Absolute$nnnn,Y
This form of addressing is used in conjunction with the Y index register. The effective address is formed by adding the contents of Y to the address contained in the second and third bytes of the instruction. This mode allows the index register to contain the index or count value and the instruction to contain the base address. This type of indexing allows any location referencing and the index to modify multiple fields resulting in reduced coding and execution time.
Note on the MOS 6502:
The value at the specified address, ignoring the addressing mode's Y offset, is read (and discarded) before the final address is read. This may cause side effects in I/O registers.
Bytes: 3
Instruction | Opcode | No. Cycles |
---|---|---|
ADC $nnnn,Y | $79 | 4+p |
AND $nnnn,Y | $39 | 4+p |
CMP $nnnn,Y | $D9 | 4+p |
EOR $nnnn,Y | $59 | 4+p |
LDA $nnnn,Y | $B9 | 4+p |
LDX $nnnn,Y | $BE | 4+p |
ORA $nnnn,Y | $19 | 4+p |
SBC $nnnn,Y | $F9 | 4+p |
STA $nnnn,Y | $99 | 5 |
p: =1 if page is crossed.
Absolute Indirect($nnnn)
The second byte of the instruction contains the low order eight bits of a memory location. The high order eight bits of that memory location is contained in the third byte of the instruction. The contents of the fully specified memory location is the low order byte of the effective address. The next memory location contains the high order byte of the effective address which is loaded into the sixteen bits of the program counter.
Note on the MOS 6502:
The indirect jump instruction does not increment the page address when the indirect pointer crosses a page boundary. JMP ($xxFF) will fetch the address from $xxFF and $xx00.
Bytes: 3
Instruction | Opcode | No. Cycles |
---|---|---|
JMP ($nnnn) | $6C | 5 |
Zero Page$nn
The zero page instructions allow for shorter code and execution times by only fetching the second byte of the instruction and assuming a zero high address byte. Careful use of the zero page can result in significant increase in code efficiency.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
ADC $nn | $65 | 3 |
AND $nn | $25 | 3 |
ASL $nn | $06 | 5 |
BIT $nn | $24 | 3 |
CMP $nn | $C5 | 3 |
CPX $nn | $E4 | 3 |
CPY $nn | $C4 | 3 |
DEC $nn | $C6 | 5 |
EOR $nn | $45 | 3 |
INC $nn | $E6 | 5 |
LDA $nn | $A5 | 3 |
LDX $nn | $A6 | 3 |
LDY $nn | $A4 | 3 |
LSR $nn | $46 | 5 |
ORA $nn | $05 | 3 |
ROL $nn | $26 | 5 |
ROR $nn | $66 | 5 |
SBC $nn | $E5 | 3 |
STA $nn | $85 | 3 |
STX $nn | $86 | 3 |
STY $nn | $84 | 3 |
X-Indexed Zero Page$nn,X
This form of addressing is used in conjunction with the X index register. The effective address is calculated by adding the second byte to the contents of the index register. Since this is a form of "Zero Page" addressing, the content of the second byte references a location in page zero. Additionally, due to the “Zero Page" addressing nature of this mode, no carry is added to the high order 8 bits of memory and crossing of page boundaries does not occur.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
ADC $nn,X | $75 | 4 |
AND $nn,X | $35 | 4 |
ASL $nn,X | $16 | 6 |
CMP $nn,X | $D5 | 4 |
DEC $nn,X | $D6 | 6 |
EOR $nn,X | $55 | 4 |
INC $nn,X | $F6 | 6 |
LDA $nn,X | $B5 | 4 |
LDY $nn,X | $B4 | 4 |
LSR $nn,X | $56 | 6 |
ORA $nn,X | $15 | 4 |
ROL $nn,X | $36 | 6 |
ROR $nn,X | $76 | 6 |
SBC $nn,X | $F5 | 4 |
STA $nn,X | $95 | 4 |
STY $nn,X | $94 | 4 |
Y-Indexed Zero Page$nn,Y
This form of addressing is used in conjunction with the Y index register. The effective address is calculated by adding the second byte to the contents of the index register. Since this is a form of "Zero Page" addressing, the content of the second byte references a location in page zero. Additionally, due to the “Zero Page" addressing nature of this mode, no carry is added to the high order 8 bits of memory and crossing of page boundaries does not occur.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
LDX $nn,Y | $B6 | 4 |
STX $nn,Y | $96 | 4 |
X-Indexed Zero Page Indirect($nn,X)
In indexed indirect addressing, the second byte of the instruction is added to the contents of the X index register, discarding the carry. The result of this addition points to a memory location on page zero whose contents is the low order eight bits of the effective address. The next memory location in page zero contains the high order eight bits of the effective address. Both memory locations specifying the high and low order bytes of the effective address must be in page zero.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
ADC ($nn,X) | $61 | 6 |
AND ($nn,X) | $21 | 6 |
CMP ($nn,X) | $C1 | 6 |
EOR ($nn,X) | $41 | 6 |
LDA ($nn,X) | $A1 | 6 |
ORA ($nn,X) | $01 | 6 |
SBC ($nn,X) | $E1 | 6 |
STA ($nn,X) | $81 | 6 |
Zero Page Indirect Y-Indexed($nn),Y
In indirect indexed addressing, the second byte of the instruction points to a memory location in page zero. The contents of this memory location is added to the contents of the Y index register, the result being the low order eight bits of the effective address. The carry from this addition is added to the contents of the next page zero memory location, the result being the high order eight bits of the effective address.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
ADC ($nn),Y | $71 | 5+p |
AND ($nn),Y | $31 | 5+p |
CMP ($nn),Y | $D1 | 5+p |
EOR ($nn),Y | $51 | 5+p |
LDA ($nn),Y | $B1 | 5+p |
ORA ($nn),Y | $11 | 5+p |
SBC ($nn),Y | $F1 | 5+p |
STA ($nn),Y | $91 | 6 |
p: =1 if page is crossed.
Relative$nnnn
Relative addressing is used only with branch instructions and establishes a destination for the conditional branch.
The second byte of-the instruction becomes the operand which is an “Offset" added to the contents of the lower eight bits of the program counter when the counter is set at the next instruction. The range of the offset is —128 to +127 bytes from the next instruction.
Bytes: 2
Instruction | Opcode | No. Cycles |
---|---|---|
BCC $nnnn | $90 | 2+t+p |
BCS $nnnn | $B0 | 2+t+p |
BEQ $nnnn | $F0 | 2+t+p |
BMI $nnnn | $30 | 2+t+p |
BNE $nnnn | $D0 | 2+t+p |
BPL $nnnn | $10 | 2+t+p |
BVC $nnnn | $50 | 2+t+p |
BVS $nnnn | $70 | 2+t+p |
p: =1 if page is crossed.
t: =1 if branch is taken.
Load/Store |
Transfer |
Stack |
Shift |
Logic |
Arithmetic |
Arithmetic: Inc/Dec |
Control Flow |
Control Flow: Branch |
Flags |
KIL |
NOP |