The HuC6280 CPU

The PC-Engine uses a special version of the well-known 6502 CPU. It has additional Opcodes, more addressing-modes and a memory management unit (MMU). This is a list of Opcodes, that are available with the Hu6502 CPU.

Add With Carry (ADC)

Function Add the data located at the effective address specified by the operand to the contents of the accumulator. Add one to the result if the carry flag is set, and store the final result in the accumulator. This opcode takes one extra cycle to complete if the decimal mode flag D is set.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateADC #nn69 nn22
Zero PageADC ZZ65 ZZ24
Zero Page, XADC ZZ, X75 ZZ24
IndirectADC (ZZ)72 ZZ27
Indexed Indirect, XADC (ZZ, X)61 ZZ27
Indirect Indexed, YADC (ZZ), Y71 ZZ27
AbsoluteADC hhll6D ll hh35
Absolute, XADC hhll, X7D ll hh35
Absolute, YADC hhll, Y79 ll hh35

Flags Affected
NVTBDIZC
NV0---ZC

And Accumulator with Memory (AND)

Function Bitwise logical AND the data located at the effective address specified by the operand with the contents of the accumulator. Each bit in the accumulator is ANDed with the corresponding bit in memory, with the result being stored in the respective accumulator bit.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateAND #nn29 nn22
Zero PageAND ZZ25 ZZ24
Zero Page, XAND ZZ, X35 ZZ24
IndirectAND (ZZ)32 ZZ27
Indexed Indirect, XAND (ZZ, X)21 ZZ27
Indirect Indexed, YAND (ZZ), Y31 ZZ27
AbsoluteAND hhll2D ll hh35
Absolute, XAND hhll, X3D ll hh35
Absolute, YAND hhll, Y39 ll hh35

Flags Affected
NVTBDIZC
N-0---Z-

Shift Memory or Accumulator Left (ASL)

Function Shift the contents of the location specified by the operand left one bit. That is, bit one takes on the value originally found in bit zero, bit two takes the value originally in bit one, and so on; bit 7 is transferred into the carry flag; bit 0 is cleared. The arithmetic result of the operation is an unsigned multiplication by two.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageASL ZZ06 ZZ26
Zero Page, XASL ZZ, X16 ZZ26
AbsoluteASL hhll0E ll hh37
Absolute, XASL hhll, X1E ll hh37
AccumulatorASL A0A12

Flags Affected
NVTBDIZC
N-0---ZC

Branch on Bit Reset (BBRi)

Function The i th bit value in zero page memory location ZZ is tested. If it is clear, a branch is taken; if it is set, the instruction immediately following the three-byte BBRi instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch .

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero Page, RelativeBBR0 ZZ, hhll0F ZZ rr36
Zero Page, RelativeBBR1 ZZ, hhll1F ZZ rr36
Zero Page, RelativeBBR2 ZZ, hhll2F ZZ rr36
Zero Page, RelativeBBR3 ZZ, hhll3F ZZ rr36
Zero Page, RelativeBBR4 ZZ, hhll4F ZZ rr36
Zero Page, RelativeBBR5 ZZ, hhll5F ZZ rr36
Zero Page, RelativeBBR6 ZZ, hhll6F ZZ rr36
Zero Page, RelativeBBR7 ZZ, hhll7F ZZ rr36

Flags Affected
NVTBDIZC
--0-----

Branch on Carry Clear (BCC)

Function The carry flag in the status register is tested. If it is clear, a branch is taken; if it is set, the instruction immediately following the two-byte BCC instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . Note that BCC determines if the result of a comparison is less than; therefore, BCC is sometimes written as BLT (Branch if Less Than). This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBCC hhll90 rr22

Flags Affected
NVTBDIZC
--0-----

Branch on Bit Set (BBSi)

Function The i th bit value in zero page memory location ZZ is tested. If it is set, a branch is taken; if it is clear, the instruction immediately following the three-byte BBSi instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch .

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero Page, RelativeBBS0 ZZ, hhll8F ZZ rr36
Zero Page, RelativeBBS1 ZZ, hhll9F ZZ rr36
Zero Page, RelativeBBS2 ZZ, hhllAF ZZ rr36
Zero Page, RelativeBBS3 ZZ, hhllBF ZZ rr36
Zero Page, RelativeBBS4 ZZ, hhllCF ZZ rr36
Zero Page, RelativeBBS5 ZZ, hhllDF ZZ rr36
Zero Page, RelativeBBS6 ZZ, hhllEF ZZ rr36
Zero Page, RelativeBBS7 ZZ, hhllFF ZZ rr36

Flags Affected
NVTBDIZC
--0-----

Branch on Carry Set (BCS)

Function The carry flag in the status register is tested. If it is set, a branch is taken; if it is clear, the instruction immediately following the two-byte BCS instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . Note that BCC determines if the result of a comparison is greater than or equal to; therefore, BCC is sometimes written as BGE (Branch if Greater than or Equal). This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBCS hhllB0 rr22

Flags Affected
NVTBDIZC
--0-----

Branch on Equal (BEQ)

Function The zero flag in the status register is tested. If it is set, meaning that the last value tested (which affected the zero flag) was zero, a branch is taken; if it is clear, meaning the value tested was non-zero, the instruction immediately following the two-byte BEQ instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBEQ hhllF0 rr22

Flags Affected
NVTBDIZC
--0-----

Test Memory Bits against Accumulator (BIT)

Function BIT sets the status register flags based on the result of two different operations. First, it sets or clears the N flag to reflect the value of the high bit (bit 7) of the data located at the effective address specified by the operand, and sets or clears the V flag to reflect the contents of the next-to-highest bit (bit 6) of the data addressed. Second, it logically ANDs the data located at the effective address with the contents of the accumulator; it changes neither value, but sets the Z flag if the result is zero, or clears it if the result is non-zero.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateBIT #nn89 nn22
Zero PageBIT ZZ24 ZZ24
Zero Page, XBIT ZZ, X34 ZZ24
AbsoluteBIT hhll2C ll hh35
Absolute, XBIT hhll, X3C ll hh35

Flags Affected
NVTBDIZC
M7M60---Z-

Branch on Minus (BMI)

Function The negative flag in the status register is tested. If it is set, meaning the high bit of the value which most recently affected the N flag was set, a branch is taken. Since numbers are often stored in two's complement, this instruction can be used to detect negative numbers. If it is clear, the instruction immediately following the two-byte BMI instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBMI hhll30 rr22

Flags Affected
NVTBDIZC
--0-----

Branch on Not Equal (BNE)

Function The zero flag in the status register is tested. If it is clear, meaning that the last value tested (which affected the zero flag) was zero, a branch is taken; if it is set, meaning the value tested was non-zero, the instruction immediately following the two-byte BNE instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBNE hhllD0 rr22

Flags Affected
NVTBDIZC
--0-----

Branch on Plus (BPL)

Function The negative flag in the status register is tested. If it is clear, meaning the high bit of the value which most recently affected the N flag was cleared, a branch is taken. Since numbers are often stored in two's complement, this instruction can be used to detect positive numbers. If it is set, the instruction immediately following the two-byte BPL instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBPL hhll10 rr22

Flags Affected
NVTBDIZC
--0-----

Branch Always (BRA)

Function A branch is always taken; no testing is done. A one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . This branch requires one extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBRA hhll80 rr24

Flags Affected
NVTBDIZC
--0-----

Break (BRK)

Function Forces a software interrupt. BRK is unaffected by the I interrupt disable flag. Although BRK is a one-byte instruction, the program counter (which is pushed onto the stack by the instruction) is incremented by two; this lets you follow the break instruction with a one-byte signature byte indicating which break caused the interrupt. Be sure to pad BRK with a single byte to allow an RTI (return from interrupt) instruction to execute correctly. Multiple actions are invoked on a BRK. The program counter is incremented by 2. The high and low bytes of the program counter are pushed onto the stack in order, followed by the status register (P). The program counter is then loaded with the break vector stored at absolute address \$00FFF6-\$00FFF7. (Remember, the high byte is stored in \$00FFF7 and the low byte is stored in \$00FFF6.) The decimal flag D is cleared, and the I flag is set (to disable hardware IRQ interrupts) after a break is executed. Additionally, the break flag B in the status register value pushed onto the stack is set.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedBRK0018

Flags Affected
NVTBDIZC
--0101--

Branch to Subroutine (BSR)

Function Similar to the Jump to Subroutine (JSR) instruction, Branch to Subroutine allows execution of a subroutine. However, the offset is specified in relative mode instead of as an absolute address. This saves a byte, but takes one more clock cycle than JSR, so its use is discouraged. The current program counter is pushed onto the stack. A one-byte signed displacement, fetched from the second byte of the instruction, is added to the program counter. Once the subroutine address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the BSR . This opcode takes one extra cycle if a page boundary is crossed in calling the subroutine.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBSR hhll44 rr28

Flags Affected
NVTBDIZC
--0-----

Branch if Overflow Set (BVS)

Function The overflow flag V in the status register is tested. If it is set, a branch is taken; if it is clear, the instruction immediately following the two-byte BVS instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . BVS is almost exclusively used to check that a two's complement arithmetic calculation has overflowed. This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBVS hhll70 rr22

Flags Affected
NVTBDIZC
--0-----

Branch if Overflow Clear (BVC)

Function The overflow flag V in the status register is tested. If it is clear, a branch is taken; if it is set, the instruction immediately following the two-byte BVC instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch . BVC is almost exclusively used to check that a two's complement arithmetic calculation has not overflowed. This opcode takes one extra cycle if the branch is taken, and another extra cycle if a page boundary is crossed in taking the branch.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
RelativeBVC hhll50 rr22

Flags Affected
NVTBDIZC
--0-----

Clear Carry Flag (CLC)

Function The carry flag C in the status register is set to 0.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLC1812

Flags Affected
NVTBDIZC
--0----0

Clear Accumulator (CLA)

Function The accumulator is set to \$#00.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLA6212

Flags Affected
NVTBDIZC
--0-----

Clear Decimal Flag (CLD)

Function The decimal flag D in the status register is set to 0, returning the processor to binary arithmetic mode.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLDD812

Flags Affected
NVTBDIZC
--0-0---

Clear Interrupt Disable Flag (CLI)

Function The interrupt disable flag I in the status register is set to 0. This re-enables hardware interrupt (IRQ) processing.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLI5812

Flags Affected
NVTBDIZC
--0--0--

Clear Overflow Flag (CLV)

Function The overflow flag V in the status register is set to 0.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLVB812

Flags Affected
NVTBDIZC
-00-----

Clear Y Register (CLY)

Function The Y register is set to #\$00.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLYC212

Flags Affected
NVTBDIZC
--0-----

Clear X Register (CLX)

Function The X register is set to #\$00.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCLX8212

Flags Affected
NVTBDIZC
--0-----

Compare X Register with Memory (CPX)

Function Subtract the data located at the effective address specified by the operand from the contents of the X register, setting the carry, zero, and negative flags based on the result, but without altering the contents of either the memory location or the accumulator. The comparison is of unsigned binary values only (decimal mode is ignored), and the result is not saved.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateCPX #nnE0 nn22
Zero PageCPX ZZE4 ZZ24
AbsoluteCPX hhllEC ll hh35

Flags Affected
NVTBDIZC
N-0---ZC

Change Speed High (CSH)

Function Sets the HuC6280 to "high speed," or normal speed mode. The only use for this instruction is after a system reset, to ensure that the processor is in its high speed mode.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCSHD41??

Flags Affected
NVTBDIZC
--0-----

Change Speed Low (CSL)

Function Sets the HuC6280 to low speed. The only use for this instruction appears to be for the US "country check" code; it does not appear anywhere else in HuC6280 code. Its use is discouraged.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedCSL541??

Flags Affected
NVTBDIZC
--0-----

Compare Accumulator with Memory (CMP)

Function Subtract the data located at the effective address specified by the operand from the contents of the accumulator, setting the carry, zero, and negative flags based on the result, but without altering the contents of either the memory location or the accumulator. The comparison is of unsigned binary values only (decimal mode is ignored), and the result is not saved.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateCMP #nnC9 nn22
Zero PageCMP ZZC5 ZZ24
Zero Page, XCMP ZZ, XD5 ZZ24
IndirectCMP (ZZ)D2 ZZ27
Indexed Indirect, XCMP (ZZ, X)C1 ZZ27
Indirect Indexed, YCMP (ZZ), YD1 ZZ27
AbsoluteCMP hhllCD ll hh35
Absolute, XCMP hhll, XDD ll hh35
Absolute, YCMP hhll, YD9 ll hh35

Flags Affected
NVTBDIZC
N-0---ZC

Decrement X (DEX)

Function Decrement by one the contents of the X register (subtract one from the value). DEX neither affects nor is affected by the carry flag.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedDEXCA12

Flags Affected
NVTBDIZC
N-0---Z-

Decrement (DEC)

Function Decrement by one the contents of the location specified by the operand (subtract one from the value). DEC neither affects nor is affected by the carry flag.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageDEC ZZC6 ZZ26
Zero Page, XDEC ZZ, XD6 ZZ26
AbsoluteDEC hhllCE ll hh37
Absolute, XDEC hhll, XDE ll hh37
AccumulatorDEC A3A12

Flags Affected
NVTBDIZC
N-0---Z-

Compare Y Register with Memory (CPY)

Function Subtract the data located at the effective address specified by the operand from the contents of the Y register, setting the carry, zero, and negative flags based on the result, but without altering the contents of either the memory location or the accumulator. The comparison is of unsigned binary values only (decimal mode is ignored), and the result is not saved.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateCPY #nnC0 nn22
Zero PageCPY ZZC4 ZZ24
AbsoluteCPY hhllCC ll hh35

Flags Affected
NVTBDIZC
N-0---ZC

Exclusive OR Accumulator with Memory (EOR)

Function Bitwise logical Exclusive OR (XOR) the data located at the effective address specified by the operand with the contents of the accumulator. Each bit in the accumulator is XORed with the corresponding bit in memory, with the result being stored in the respective accumulator bit.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateEOR #nn49 nn22
Zero PageEOR ZZ45 ZZ24
Zero Page, XEOR ZZ, X55 ZZ24
IndirectEOR (ZZ)52 ZZ27
Indexed Indirect, XEOR (ZZ, X)41 ZZ27
Indirect Indexed, YEOR (ZZ), Y51 ZZ27
AbsoluteEOR hhll4D ll hh35
Absolute, XEOR hhll, X5D ll hh35
Absolute, YEOR hhll, Y59 ll hh35

Flags Affected
NVTBDIZC
N-0---Z-

Increment (INC)

Function Increments contents of the location specified by the operand (add one to the value). INC neither affects nor is affected by the carry flag.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageINC ZZE6 ZZ26
Zero Page, XINC ZZ, XF6 ZZ26
AbsoluteINC hhllEE ll hh37
Absolute, XINC hhll, XFE ll hh37
AccumulatorINC A1A12

Flags Affected
NVTBDIZC
N-0---Z-

Increment X (INX)

Function Increment by one contents of the X register (add one to the value). INX neither affects nor is affected by the carry flag.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedINXE812

Flags Affected
NVTBDIZC
N-0---Z-

Decrement Y (DEY)

Function Decrement by one the contents of the Y register (subtract one from the value). DEY neither affects nor is affected by the carry flag.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedDEY8812

Flags Affected
NVTBDIZC
N-0---Z-

Increment Y (INY)

Function Increment by one contents of the Y register (add one to the value). INY neither affects nor is affected by the carry flag.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedINYC812

Flags Affected
NVTBDIZC
N-0---Z-

Jump (JMP)

Function Transfer control to the address specified by the operand field. The program counter is loaded with the target address.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
AbsoluteJMP hhll4C ll hh34
Absolute IndirectJMP (hhll)6C ll hh37
Absolute Indirect XJMP hhll, X7C ll hh37

Flags Affected
NVTBDIZC
--0-----

Jump to Subroutine (JSR)

Function Transfer control to the subroutine at the location specified by the operand, after first pushing the current program counter value onto the stack as a return address. The value of the PC which is pushed onto the stack is the location of the last (third) byte of the JSR instruction, not the address of the next opcode.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
AbsoluteJSR hhll20 ll hh37

Flags Affected
NVTBDIZC
--0-----

Load Accumulator from Memory (LDA)

Function Load the accumulator with the data located at the effective address specified by the operand.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateLDA #nnA9 nn22
Zero PageLDA ZZA5 ZZ24
Zero Page, XLDA ZZ, XB5 ZZ24
IndirectLDA (ZZ)B2 ZZ27
Indexed Indirect, XLDA (ZZ, X)A1 ZZ27
Indirect Indexed, YLDA (ZZ), YB1 ZZ27
AbsoluteLDA hhllAD ll hh35
Absolute, XLDA hhll, XBD ll hh35
Absolute, YLDA hhll, YB9 ll hh35

Flags Affected
NVTBDIZC
N-0---Z-

Load X Register from Memory (LDX)

Function Load the X register with the data located at the effective address specified by the operand.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateLDX #nnA2 nn22
Zero PageLDX ZZA6 ZZ24
Zero Page, YLDX ZZ, YB6 ZZ24
AbsoluteLDX hhllAE ll hh35
Absolute, YLDX hhll, YBE ll hh35

Flags Affected
NVTBDIZC
N-0---Z-

Load Y Register from Memory (LDY)

Function Load the Y register with the data located at the effective address specified by the operand.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateLDY #nnA0 nn22
Zero PageLDY ZZA4 ZZ24
Zero Page, XLDY ZZ, YB4 ZZ24
AbsoluteLDY hhllAC ll hh35
Absolute, XLDY hhll, YBC ll hh35

Flags Affected
NVTBDIZC
N-0---Z-

Logical Shift Memory or Accumulator Right (LSR)

Function Logical shift the contents of the location specified by the operand right one bit. That is, bit zero takes on the value originally found in bit one, bit one takes the value originally in bit two, and so on; bit 7 is cleared; bit 0 is transferred into the carry flag. The arithmetic result of the operation is an unsigned division by two.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageLSR ZZ46 ZZ26
Zero Page, XLSR ZZ, X56 ZZ26
AbsoluteLSR hhll4E ll hh37
Absolute, XLSR hhll, X5E ll hh37
AccumulatorLSR A4A ll hh12

Flags Affected
NVTBDIZC
0-0---ZC

Or Accumulator with Memory (ORA)

Function Bitwise logical OR the data located at the effective address specified by the operand with the contents of the accumulator. Each bit in the accumulator is ORed with the corresponding bit in memory, with the result being stored in the respective accumulator bit.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateORA #nn09 nn22
Zero PageORA ZZ05 ZZ24
Zero Page, XORA ZZ, X15 ZZ24
IndirectORA (ZZ)12 ZZ27
Indexed Indirect, XORA (ZZ, X)01 ZZ27
Indirect Indexed, YORA (ZZ), Y11 ZZ27
AbsoluteORA hhll0D ll hh35
Absolute, XORA hhll, X1D ll hh35
Absolute, YORA hhll, Y19 ll hh35

Flags Affected
NVTBDIZC
N-0---Z-

No Operation (NOP)

Function NOP performs no action, and is often used for timing loops or temporarily removing certain instructions.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedNOPEA12

Flags Affected
NVTBDIZC
--0-----

Push Accumulator (PHA)

Function Push the accumulator onto the stack.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PushPHA4813

Flags Affected
NVTBDIZC
--0-----

Push Processor Status Register (PHP)

Function Push the process status register P onto the stack.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PushPHP0813

Flags Affected
NVTBDIZC
--0-----

Push X Register (PHX)

Function Push the X register onto the stack.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PushPHXDA13

Flags Affected
NVTBDIZC
--0-----

Push Y Register (PHY)

Function Push the Y register onto the stack.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PushPHY5A13

Flags Affected
NVTBDIZC
--0-----

Pull Accumulator (PLA)

Function Pull the value on the top of the stack into the accumulator. The previous contents of the accumulator are destroyed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PullPLA6814

Flags Affected
NVTBDIZC
N-0---Z-

Pull Processor Status Register (PLP)

Function Pull the value on the top of the stack into the processor status register P. The previous contents of the status register are destroyed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PullPLP2814

Flags Affected
NVTBDIZC
Restored

Pull X Register (PLX)

Function Pull the value on the top of the stack into the X register. The previous contents of the X register are destroyed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PullPLXFA14

Flags Affected
NVTBDIZC
N-0---Z-

Pull Y Register (PLY)

Function Pull the value on the top of the stack into the Y register. The previous contents of the Y register are destroyed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack PullPLY7A14

Flags Affected
NVTBDIZC
N-0---Z-

Rotate Memory or Accumulator Left (ROL)

Function Rotate the contents of the location specified by the operand left one bit. That is, bit one takes on the value originally found in bit zero, bit two takes the value originally in bit one, and so on; bit 0 takes on the value in the carry flag; bit 7 is transferred into the carry.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageROL ZZ26 ZZ26
Zero Page, XROL ZZ, X36 ZZ26
AbsoluteROL hhll2E ll hh37
Absolute, XROL hhll, X3E ll hh37
AccumulatorROL A2A ll hh12

Flags Affected
NVTBDIZC
N-0---ZC

Reset Memory Bit i (RMBi)

Function Clear the specified bit in the zero page memory location specified in the operand. The bit to clear is specified by a number concatenated to the end of the mnemonic, resulting in 8 distinct Opcodes.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero pageRMB0 ZZ07 ZZ27
Zero pageRMB1 ZZ17 ZZ27
Zero pageRMB2 ZZ27 ZZ27
Zero pageRMB3 ZZ37 ZZ27
Zero pageRMB4 ZZ47 ZZ27
Zero pageRMB5 ZZ57 ZZ27
Zero pageRMB6 ZZ67 ZZ27
Zero pageRMB7 ZZ77 ZZ27

Flags Affected
NVTBDIZC
--0-----

Rotate Memory or Accumulator Right (ROR)

Function Rotate the contents of the location specified by the operand right one bit. That is, bit zero takes on the value originally found in bit one, bit one takes the value originally in bit two, and so on; bit 7 takes on the value in the carry flag; bit 0 is transferred into the carry.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageROR ZZ66 ZZ26
Zero Page, XROR ZZ, X76 ZZ26
AbsoluteROR hhll6E ll hh37
Absolute, XROR hhll, X7E ll hh37
AccumulatorROR A6A ll hh12

Flags Affected
NVTBDIZC
N-0---ZC

Return from Interrupt (RTI)

Function Pull the status register and the program counter from the stack in order. Normally used to return from an interrupt call (such as BRK), this instruction can also be used to pull the status register P, and the program counter low and high bytes from the stack into the P and program counter registers.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack (RTI)RTI4017

Flags Affected
NVTBDIZC
Restored

Return from Subroutine (RTS)

Function Pull the program counter from the stack, incrementing the 16-bit value by one before loading the program counter with it. The low byte of the program counter is pulled from the stack first, followed by the high byte.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Stack (RTS)RTS6017

Flags Affected
NVTBDIZC
--0-----

Swap Accumulator and X Register (SAX)

Function The values of the accumulator and the X Register are swapped.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSAX2213

Flags Affected
NVTBDIZC
--0-----

Swap Accumulator and Y Register (SAY)

Function The values of the accumulator and the Y Register are swapped.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSAY4213

Flags Affected
NVTBDIZC
--0-----

Subtract with Borrow from Accumulator (SBC)

Function Subtract the data located at the effective address specified by the operand to the contents of the accumulator. Subtract one more from the result if the carry flag is set, and store the final result in the accumulator. This opcode takes one extra cycle if the decimal mode flag D is set.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImmediateSBC #nnE9 nn22
Zero PageSBC ZZE5 ZZ24
Zero Page, XSBC ZZ, XF5 ZZ24
IndirectSBC (ZZ)F2 ZZ27
Indexed Indirect, XSBC (ZZ, X)E1 ZZ27
Indirect Indexed, YSBC (ZZ), YF1 ZZ27
AbsoluteSBC hhllED ll hh35
Absolute, XSBC hhll, XFD ll hh35
Absolute, YSBC hhll, YF9 ll hh35

Flags Affected
NVTBDIZC
NV0---ZC

Set Decimal Mode Flag (SED)

Function The decimal mode flag D in the status register is set to 1. This enables BCD arithmetic.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSEDF812

Flags Affected
NVTBDIZC
--0-1---

Set Carry Flag (SEC)

Function The carry flag C in the status register is set to 1.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSEC3812

Flags Affected
NVTBDIZC
--0----1

Set Interrupt Disable Flag (SEI)

Function The interrupt disable flag I in the status register is set to 1. This disables hardware interrupt processing.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSEI7812

Flags Affected
NVTBDIZC
--0--1--

Set T Flag (SET)

Function The T flag in the status register is set to 1. The T flag is called the "Memory Operation Flag;", when this flag is set all the instructions that normally use the A register act differently, I don't know exactly if all the instructions are affected but I'm sure for AND, EOR, OR & ADC. In place of using the A register the instruction use the memory location in ZP pointed by the X register, so for example if you use SET followed by ADC #10, the CPU will do ZP[X] = ZP[X] + 10.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSETF412

Flags Affected
NVTBDIZC
--1-----

Store HuC6270 No. 0 (ST0)

Function The immediate argument is stored in the HuC6270's address register. This command is equivalent to storing the immediate argument in \$1FE000. The HuC6270 "No. 0" register is also known as the HuC6270 Address/Status Register; more information is available in the HuC6270 summary. According to the Develo Book , this operation sets /CE7, A1, and A0 to logical LOW.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedST0 #nn03 nn24

Flags Affected
NVTBDIZC
--0-----

Store HuC6270 No. 1 (ST1)

Function The immediate argument is stored in the HuC6270's low data register. This command is equivalent to storing the immediate argument in \$1FE002. The HuC6270 "No. 1" register is also known as the HuC6270 Low Data Register; more information is available in the HuC6270 summary. According to the Develo Book , this operation sets /CE7 and A0 to logical LOW, while setting A1 to logical HIGH.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedST1 #nn13 nn24

Flags Affected
NVTBDIZC
--0-----

Store HuC6270 No. 2 (ST2)

Function The immediate argument is stored in the HuC6270's high data register. This command is equivalent to storing the immediate argument in \$1FE003. The HuC6270 "No. 2" register is also known as the HuC6270 High Data Register; more information is available in the HuC6270 summary. According to the Develo Book , this operation sets /CE7 to logical LOW, while setting A0 and A1 to logical HIGH.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedST2 #nn23 nn24

Flags Affected
NVTBDIZC
--0-----

Set Memory Bit i (SMBi)

Function Set the specified bit in the zero page memory location specified in the operand. The bit to clear is specified by a number concatenated to the end of the mnemonic, resulting in 8 distinct Opcodes.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero pageSMB0 ZZ87 ZZ27
Zero pageSMB1 ZZ97 ZZ27
Zero pageSMB2 ZZA7 ZZ27
Zero pageSMB3 ZZB7 ZZ27
Zero pageSMB4 ZZC7 ZZ27
Zero pageSMB5 ZZD7 ZZ27
Zero pageSMB6 ZZE7 ZZ27
Zero pageSMB7 ZZF7 ZZ27

Flags Affected
NVTBDIZC
--0-----

Store Accumulator to Memory (STA)

Function Stores the value in the accumulator to the effective address specified by the operand.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageSTA ZZ85 ZZ24
Zero Page, XSTA ZZ, X95 ZZ24
IndirectSTA (ZZ)92 ZZ27
Indexed Indirect, XSTA (ZZ, X)81 ZZ27
Indirect Indexed, YSTA (ZZ), Y91 ZZ27
AbsoluteSTA hhll8D ll hh35
Absolute, XSTA hhll, X9D ll hh35
Absolute, YSTA hhll, Y99 ll hh35

Flags Affected
NVTBDIZC
--0-----

Store X Register to Memory (STX)

Function Store the value in the X register to the effective address specified by the operand.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageSTX ZZ86 ZZ24
Zero Page, YSTX ZZ, Y96 ZZ24
AbsoluteSTX hhll8E ll hh35

Flags Affected
NVTBDIZC
--0-----

Store Y Register to Memory (STY)

Function Store the value in the Y register to the effective address specified by the operand.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageSTY ZZ84 ZZ24
Zero Page, XSTY ZZ, X94 ZZ24
AbsoluteSTY hhll8C ll hh35

Flags Affected
NVTBDIZC
--0-----

Store Zero to Memory (STZ)

Function Store the value #\$00 to the effective address specified by the operand. Very useful for initialising memory.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageSTZ ZZ64 ZZ24
Zero Page, XSTZ ZZ, X74 ZZ24
AbsoluteSTZ hhll9C ll hh35
Absolute, XSTZ hhll, X9E ll hh35

Flags Affected
NVTBDIZC
--0-----

Transfer Alternate Increment (TAI)

Function Execute a memory move where the source address alternates between two addresses, and the destination address increments with each loop cycle. This is an extremely powerful instruction, mainly used for transferring data from the special video memory (e.g., backgrounds, etc.) to the main memory.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Block MoveTAI SHSL,DHDL, LHLLF3 SL SH DL DH LL LH717 + 6x

Flags Affected
NVTBDIZC
--0-----

Swap X and Y Registers (SXY)

Function Swaps the values stored in the X and Y registers.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedSXY0213

Flags Affected
NVTBDIZC
--0-----

Transfer Accumulator to MPRi (TAMi)

Function Loads Memory Mapping Register i with the value in the accumulator. More about the MPR registers can be found in the Memory Mapping summary. It is possible to load more than one MPR at a time by setting more than one bit in the immediate argument to TAM.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTAMi (TAM #nn)53 ($2^i$)25

Flags Affected
NVTBDIZC
--0-----

Transfer Accumulator to X Register (TAX)

Function Transfer the value in the accumulator to register X.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTAXAA12

Flags Affected
NVTBDIZC
N-0---Z-

Transfer Accumulator to Y Register (TAY)

Function Transfer the value in the accumulator to register Y.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTAYA812

Flags Affected
NVTBDIZC
N-0---Z-

Transfer Increment Alternate (TIA)

Function Execute a memory move where the source address increments, and the destination address alternates between two addresses with each loop cycle. This is an extremely powerful instruction, mainly used for transferring data to the special video memory (e.g., backgrounds, etc.) from the main memory.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Block MoveTIA SHSL,DHDL, LHLLE3 SL SH DL DH LL LH717 + 6x

Flags Affected
NVTBDIZC
--0-----

Transfer Decrement Decrement (TDD)

Function Execute a memory move where the source and destination addresses decrement with each loop cycle. This is an extremely powerful instruction, mainly used for copying and moving data around in main memory.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Block MoveTDD SHSL,DHDL, LHLLC3 SL SH DL DH LL LH717 + 6x

Flags Affected
NVTBDIZC
--0-----

Transfer Increment None (TIN)

Function Execute a memory move where the source address increments with each loop cycle. This is an extremely powerful instruction, mainly used for transferring data from the special video memory (e.g., backgrounds, etc.) to the main memory.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Block MoveTIN SHSL,DHDL, LHLLD3 SL SH DL DH LL LH717 + 6x

Flags Affected
NVTBDIZC
--0-----

Transfer Increment Increment (TII)

Function Execute a memory move where the source and destination addresses increment with each loop cycle. This is an extremely powerful instruction, mainly used for copying and moving blocks of data around in main memory.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Block MoveTII SHSL,DHDL, LHLL73 SL SH DL DH LL LH717 + 6x

Flags Affected
NVTBDIZC
--0-----

Transfer MPRi to Accumulator (TMAi)

Function Transfers the value in Memory Mapping Register i to the accumulator. More information about the MPRs can be found on the Memory Mapping summary. Only one bit in the immediate argument can be set to 1.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTMAi (TMA #nn)43 ($2^i$)24

Flags Affected
NVTBDIZC
--0-----

Test and Reset Memory Bits Against Accumulator (TRB)

Function Logically AND together the complement of the value in the accumulator with the data at the effective address specified by the operand. Store the result at the memory location. This clears each bit for which the corresponding accumulator bit is set, making it an ideal opcode for masking data. N and V and Z are set as in the BIT opcode instruction. These flags are set based on the ANDing of the uncomplemented accumulator value with the memory value.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageTRB ZZ14 ZZ26
AbsoluteTRB hhll1C ll hh37

Flags Affected
NVTBDIZC
M7M60---Z-

Test and Set Memory Bits Against Accumulator (TSB)

Function Logically OR together the value in the accumulator with the data at the effective address specified by the operand. Store the result at the memory location. This sets each bit for which the corresponding accumulator bit is set, making it an ideal opcode for masking data. N and V and Z are set as in the BIT opcode instruction. These flags are set based on the ANDing of the accumulator value with the memory value.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Zero PageTSB ZZ04 ZZ26
AbsoluteTSB hhll0C ll hh37

Flags Affected
NVTBDIZC
M7M60---Z-

Test and Reset Memory Bits (TST)

Function Logically AND together the immediate operand with the data at the effective address specified by the operand. This sets each bit for which the corresponding immediate argument bit is set, making it an ideal opcode for masking data. N and V and Z are set as in the BIT opcode instruction.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
Imm. Zero PageTST #nn, ZZ83 nn ZZ37
Imm. Zero Page, XTST #nn, ZZ, XA3 nn ZZ37
Immediate AbsoluteTST #nn, hhll93 nn ll hh48
Imm. Absolute, XTST #nn, hhll, XB3 nn ll hh48

Flags Affected
NVTBDIZC
M7M60---Z-

Transfer Stack Pointer to X Register (TSX)

Function Transfer the value in the stack pointer S to the X register. The value of the stack pointer is not changed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTSXBA12

Flags Affected
NVTBDIZC
N-0---Z-

Transfer X Register to Accumulator (TXA)

Function Transfer the value in the X register to the accumulator. The value of the X register is not changed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTXA8A12

Flags Affected
NVTBDIZC
N-0---Z-

Function Transfer the value in the Y register to the accumulator. The value of the Y register is not changed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTYA9812

Flags Affected
NVTBDIZC
N-0---Z-

Transfer X Register to Stack Pointer (TXS)

Function Transfer the value in the X register to the stack pointer. The value of the X register is not changed.

Adressing Modes & Opcodes
Addressing ModeSyntaxOpcode# of bytes# of cycles
ImpliedTXS9A12

Flags Affected
NVTBDIZC
--0-----