Click on any of following links to go straight to the information for that instruction.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BBR, BBS, RMB & SMB are note compatible with 65816 CPU |
A,Z,C,N = A+M+C
This instruction adds the contents of a memory location to the accumulator together with the carry bit. If overflow occurs the carry bit is set, this enables multiple byte addition to be performed.
Processor Status after use:
C | Carry Flag | Set if overflow in bit 7 |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Set if sign bit is incorrect |
N | Negative Flag | Set if bit 7 set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) |
$72 |
2 |
5 |
See also: SBC
A,Z,N = A&M
A logical AND is performed, bit by bit, on the accumulator contents using the contents of a byte of memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) |
$32 |
2 |
5 |
A,Z,C,N = M*2 or M,Z,C,N = M*2
This operation shifts all the bits of the accumulator or memory contents one bit left. Bit 0 is set to 0 and bit 7 is placed in the carry flag. The effect of this operation is to multiply the memory contents by 2 (ignoring 2's complement considerations), setting the carry if the result will not fit in 8 bits.
Processor Status after use:
C | Carry Flag | Set to contents of old bit 7 |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Accumulator |
|
|
2 |
Zero Page |
|
|
5 |
Zero Page,X |
|
|
6 |
Absolute |
|
|
6 |
Absolute,X |
|
|
7 |
This a actually a set of 8 instructions. Each tests a specific bit of a byte held on zero page and causes a branch of the bit is resest (0). For example:
BBR7 VALUE, ISPOSITIVE
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Bit 0, Relative | $0F | 3 | 4 (+1 if to a new page) |
Bit 1, Relative | $1F | 3 | 4 (+1 if to a new page) |
Bit 2, Relative | $2F | 3 | 4 (+1 if to a new page) |
Bit 3, Relative | $3F | 3 | 4 (+1 if to a new page) |
Bit 4, Relative | $4F | 3 | 4 (+1 if to a new page) |
Bit 5, Relative | $5F | 3 | 4 (+1 if to a new page) |
Bit 6, Relative | $6F | 3 | 4 (+1 if to a new page) |
Bit 7, Relative |
|
3 |
4 (+1 if to a new page) |
See also: BBS
This a actually a set of 8 instructions. Each tests a specific bit of a byte held on zero page and causes a branch of the bit is set (1). For example:
BBS7 VALUE, ISNEGATIVE
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Bit 0, Relative | $8F | 3 | 4 (+1 if to a new page) |
Bit 1, Relative | $9F | 3 | 4 (+1 if to a new page) |
Bit 2, Relative | $AF | 3 | 4 (+1 if to a new page) |
Bit 3, Relative | $BF | 3 | 4 (+1 if to a new page) |
Bit 4, Relative | $CF | 3 | 4 (+1 if to a new page) |
Bit 5, Relative | $DF | 3 | 4 (+1 if to a new page) |
Bit 6, Relative | $EF | 3 | 4 (+1 if to a new page) |
Bit 7, Relative |
|
3 |
4 (+1 if to a new page) |
See also: BBR
If the carry flag is clear then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BCS
If the carry flag is set then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BCC
If the zero flag is set then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BNE
A & M, N = M7, V = M6
This instructions is used to test if one or more bits are set in a target memory location. The mask pattern in A is ANDed with the value in memory to set or clear the zero flag, but the result is not kept. Bits 7 and 6 of the value from memory are copied into the N and V flags.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if the result if the AND is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Set to bit 6 of the memory value |
N | Negative Flag | Set to bit 7 of the memory value |
Addressing Mode |
|
|
Cycles |
Immediate | $89 | 2 | 3 |
Zero Page |
|
|
3 |
Zero Page,X | $34 | 2 | 3 |
Absolute |
|
|
4 |
Absolute, X |
$3C |
3 |
4 |
If the negative flag is set then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BPL
If the zero flag is clear then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BEQ
If the negative flag is clear then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BMI
Adds the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
3 (+1 if to a new page) |
See also: JMP
The BRK instruction forces the generation of an interrupt request. The program counter and processor status are pushed on the stack then the IRQ interrupt vector at $FFFE/F is loaded into the PC and the break flag in the status set to one.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Set to 1 |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
7 |
The interpretation of a BRK depends on the operating system. On the BBC Microcomputer it is used by language ROMs to signal run time errors but it could be used for other purposes (e.g. calling operating system functions, etc.).
If the overflow flag is clear then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BVS
If the overflow flag is set then add the relative displacement to the program counter to cause a branch to a new location.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Relative |
|
|
2 (+1 if branch succeeds +2 if to a new page) |
See also: BVC
C = 0
Set the carry flag to zero.
C | Carry Flag | Set to 0 |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: SEC
D = 0
Sets the decimal mode flag to zero.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Set to 0 |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
NB:
The state of the decimal flag is uncertain when the CPU is powered
up and it is not reset when an interrupt is generated. In both
cases you should include an explicit CLD to ensure that the flag
is cleared before performing addition or subtraction.
See also: SED
I = 0
Clears the interrupt disable flag allowing normal interrupt requests to be serviced.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Set to 0 |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: SEI
V = 0
Clears the overflow flag.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Set to 0 |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
Z,C,N = A-M
This instruction compares the contents of the accumulator with another memory held value and sets the zero and carry flags as appropriate.
Processor Status after use:
C | Carry Flag | Set if A >= M |
Z | Zero Flag | Set if A = M |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) | $D2 | 2 |
Z,C,N = X-M
This instruction compares the contents of the X register with another memory held value and sets the zero and carry flags as appropriate.
Processor Status after use:
C | Carry Flag | Set if X >= M |
Z | Zero Flag | Set if X = M |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Absolute |
|
|
4 |
Z,C,N = Y-M
This instruction compares the contents of the Y register with another memory held value and sets the zero and carry flags as appropriate.
Processor Status after use:
C | Carry Flag | Set if Y >= M |
Z | Zero Flag | Set if Y = M |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Absolute |
|
|
4 |
M,Z,N = M-1
Subtracts one from the value held at a specified memory location setting the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if result is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Accumulator |
$3A |
1 |
2 |
Zero Page |
|
|
5 |
Zero Page,X |
|
|
6 |
Absolute |
|
|
6 |
Absolute,X |
|
|
7 |
X,Z,N = X-1
Subtracts one from the X register setting the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if X is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of X is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
Y,Z,N = Y-1
Subtracts one from the Y register setting the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if Y is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of Y is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
A,Z,N = A^M
An exclusive OR is performed, bit by bit, on the accumulator contents using the contents of a byte of memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) | $52 | 2 | 5 |
M,Z,N = M+1
Adds one to the value held at a specified memory location setting the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if result is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Accumulator | $1A | 1 | 2 |
Zero Page |
|
|
5 |
Zero Page,X |
|
|
6 |
Absolute |
|
|
6 |
Absolute,X |
|
|
7 |
X,Z,N = X+1
Adds one to the X register setting the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if X is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of X is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
Y,Z,N = Y+1
Adds one to the Y register setting the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if Y is zero |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of Y is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
Sets the program counter to the address specified by the operand.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Absolute |
|
|
3 |
(Indirect) |
|
|
5 |
(Absolute, X) | $7C | 3 | 6 |
See also: BRA
NB:
An original 6502 has does not correctly fetch the target address
if the indirect vector falls on a page boundary (e.g. $xxFF where
xx is and value from $00 to $FF). In this case fetches the LSB
from $xxFF as expected but takes the MSB from $xx00. This is fixed
in some later chips like the 65C02 so for compatibility always
ensure the indirect vector is not at the end of the page.
The JSR instruction pushes the address (minus one) of the return point on to the stack and then sets the program counter to the target memory address.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Absolute |
|
|
6 |
See also: RTS
A,Z,N = M
Loads a byte of memory into the accumulator setting the zero and negative flags as appropriate.
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of A is set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) | $B2 | 2 |
X,Z,N = M
Loads a byte of memory into the X register setting the zero and negative flags as appropriate.
C | Carry Flag | Not affected |
Z | Zero Flag | Set if X = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of X is set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,Y |
|
|
4 |
Absolute |
|
|
4 |
Absolute,Y |
|
|
4 (+1 if page crossed) |
Y,Z,N = M
Loads a byte of memory into the Y register setting the zero and negative flags as appropriate.
C | Carry Flag | Not affected |
Z | Zero Flag | Set if Y = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of Y is set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
A,C,Z,N = A/2 or M,C,Z,N = M/2
Each of the bits in A or M is shift one place to the right. The bit that was in bit 0 is shifted into the carry flag. Bit 7 is set to zero.
Processor Status after use:
C | Carry Flag | Set to contents of old bit 0 |
Z | Zero Flag | Set if result = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Accumulator |
|
|
2 |
Zero Page |
|
|
5 |
Zero Page,X |
|
|
6 |
Absolute |
|
|
6 |
Absolute,X |
|
|
7 |
The NOP instruction causes no changes to the processor other than the normal incrementing of the program counter to the next instruction.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
A,Z,N = A|M
An inclusive OR is performed, bit by bit, on the accumulator contents using the contents of a byte of memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
3 |
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) | $12 | 2 | 5 |
Pushes a copy of the accumulator on to the stack.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
3 |
See also: PLA
Pushes a copy of the status flags on to the stack.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
3 |
See also: PLP
Pushes a copy of the X register on to the stack.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
$DA |
|
3 |
See also: PLX
Pushes a copy of the Y register on to the stack.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
3 |
See also: PLY
Pulls an 8 bit value from the stack and into the accumulator. The zero and negative flags are set as appropriate.
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of A is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
4 |
See also: PHA
Pulls an 8 bit value from the stack and into the processor flags. The flags will take on new states as determined by the value pulled.
Processor Status after use:
C | Carry Flag | Set from stack |
Z | Zero Flag | Set from stack |
I | Interrupt Disable | Set from stack |
D | Decimal Mode Flag | Set from stack |
B | Break Command | Set from stack |
V | Overflow Flag | Set from stack |
N | Negative Flag | Set from stack |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
4 |
See also: PHP
Pulls an 8 bit value from the stack and into the X register. The zero and negative flags are set as appropriate.
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of A is set |
Addressing Mode |
|
|
Cycles |
Implied |
$FA |
|
4 |
See also: PHX
Pulls an 8 bit value from the stack and into the Y register. The zero and negative flags are set as appropriate.
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of A is set |
Addressing Mode |
|
|
Cycles |
Implied |
$7A |
|
4 |
See also: PHY
This a actually a set of 8 instructions. Each resets a specific bit of a byte held on zero page. For example:
RMB5 VALUE
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Bit 0, Zero Page | $07 | 3 | 5 |
Bit 1, Zero Page | $17 | 3 | 5 |
Bit 2, Zero Page | $27 | 3 | 5 |
Bit 3, Zero Page | $37 | 3 | 5 |
Bit 4, Zero Page | $47 | 3 | 5 |
Bit 5, Zero Page | $57 | 3 | 5 |
Bit 6, Zero Page | $67 | 3 | 5 |
Bit 7, Zero Page |
|
3 |
5 |
See also: SMB
Move each of the bits in either A or M one place to the left. Bit 0 is filled with the current value of the carry flag whilst the old bit 7 becomes the new carry flag value.
Processor Status after use:
C | Carry Flag | Set to contents of old bit 7 |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Accumulator |
|
|
2 |
Zero Page |
|
|
5 |
Zero Page,X |
|
|
6 |
Absolute |
|
|
6 |
Absolute,X |
|
|
7 |
Move each of the bits in either A or M one place to the right. Bit 7 is filled with the current value of the carry flag whilst the old bit 0 becomes the new carry flag value.
Processor Status after use:
C | Carry Flag | Set to contents of old bit 0 |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of the result is set |
Addressing Mode |
|
|
Cycles |
Accumulator |
|
|
2 |
Zero Page |
|
|
5 |
Zero Page,X |
|
|
6 |
Absolute |
|
|
6 |
Absolute,X |
|
|
7 |
The RTI instruction is used at the end of an interrupt processing routine. It pulls the processor flags from the stack followed by the program counter.
Processor Status after use:
C | Carry Flag | Set from stack |
Z | Zero Flag | Set from stack |
I | Interrupt Disable | Set from stack |
D | Decimal Mode Flag | Set from stack |
B | Break Command | Set from stack |
V | Overflow Flag | Set from stack |
N | Negative Flag | Set from stack |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
6 |
The RTS instruction is used at the end of a subroutine to return to the calling routine. It pulls the program counter (minus one) from the stack.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
6 |
See also: JSR
A,Z,C,N = A-M-(1-C)
This instruction subtracts the contents of a memory location to the accumulator together with the not of the carry bit. If overflow occurs the carry bit is clear, this enables multiple byte subtraction to be performed.
Processor Status after use:
C | Carry Flag | Clear if overflow in bit 7 |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Set if sign bit is incorrect |
N | Negative Flag | Set if bit 7 set |
Addressing Mode |
|
|
Cycles |
Immediate |
|
|
2 |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
4 (+1 if page crossed) |
Absolute,Y |
|
|
4 (+1 if page crossed) |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
5 (+1 if page crossed) |
(Ind. Zero Page) | $F2 | 2 | 5 |
See also: ADC
C = 1
Set the carry flag to one.
C | Carry Flag | Set to 1 |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: CLC
D = 1
Set the decimal mode flag to one.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Set to 1 |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: CLD
I = 1
Set the interrupt disable flag to one.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Set to 1 |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: CLI
This a actually a set of 8 instructions. Each sets a specific bit of a byte held on zero page. For example:
SMB5 VALUE
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Bit 0, Zero Page | $87 | 3 | 5 |
Bit 1, Zero Page | $97 | 3 | 5 |
Bit 2, Zero Page | $A7 | 3 | 5 |
Bit 3, Zero Page | $B7 | 3 | 5 |
Bit 4, Zero Page | $C7 | 3 | 5 |
Bit 5, Zero Page | $D7 | 3 | 5 |
Bit 6, Zero Page | $E7 | 3 | 5 |
Bit 7, Zero Page |
|
3 |
5 |
See also: RMB
M = A
Stores the contents of the accumulator into memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
Absolute,X |
|
|
5 |
Absolute,Y |
|
|
5 |
(Indirect,X) |
|
|
6 |
(Indirect),Y |
|
|
6 |
(Ind. Zero Page) | $92 | 2 | 5 |
The processor halts until a hardware reset is applied.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
$DB |
|
3 |
M = X
Stores the contents of the X register into memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Zero Page |
|
|
3 |
Zero Page,Y |
|
|
4 |
Absolute |
|
|
4 |
M = Y
Stores the contents of the Y register into memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Zero Page |
|
|
3 |
Zero Page,X |
|
|
4 |
Absolute |
|
|
4 |
M = 0
Stores a zero byte value into memory.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Zero Page |
$64 |
|
3 |
Zero Page,X |
$74 |
|
4 |
Absolute |
$9C |
|
4 |
Absolute,X |
$9E |
|
5 |
X = A
Copies the current contents of the accumulator into the X register and sets the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if X = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of X is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: TXA
Y = A
Copies the current contents of the accumulator into the Y register and sets the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if Y = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of Y is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: TYA
Z = M & A
M = M & ~A
The memory byte is tested to see if it contains any of the bits indicated by the value in the accumulator then the bits are reset in the memory byte.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if the memory value held any of the specified bits |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Zero Page |
|
|
5 |
Absolute |
|
|
6 |
See also: TSB
Z = M & A
M = M | A
The memory byte is tested to see if it contains any of the bits indicated by the value in the accumulator then the bits are set in the memory byte.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if the memory value held any of the specified bits |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Zero Page |
|
|
5 |
Absolute |
|
|
6 |
See also: TRB
X = S
Copies the current contents of the stack register into the X register and sets the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if X = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of X is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: TXS
A = X
Copies the current contents of the X register into the accumulator and sets the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of A is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: TAX
S = X
Copies the current contents of the X register into the stack register.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: TSX
A = Y
Copies the current contents of the Y register into the accumulator and sets the zero and negative flags as appropriate.
Processor Status after use:
C | Carry Flag | Not affected |
Z | Zero Flag | Set if A = 0 |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Not affected |
V | Overflow Flag | Not affected |
N | Negative Flag | Set if bit 7 of A is set |
Addressing Mode |
|
|
Cycles |
Implied |
|
|
2 |
See also: TAY
The processor pauses at the current location until the next interrupt occurs.
C | Carry Flag | Not affected |
Z | Zero Flag | Not affected |
I | Interrupt Disable | Not affected |
D | Decimal Mode Flag | Not affected |
B | Break Command | Set to 1 |
V | Overflow Flag | Not affected |
N | Negative Flag | Not affected |
Addressing Mode |
|
|
Cycles |
Implied |
$CB |
|
3 |
<< Back |
|