LDA #$nn — Load literal value $nn into ALDA $nn — Load value at memory address $nn into ASTA $nn — Store A into memory address $nnADC #$nn — Add $nn to A (use CLC first for clean addition)ADC $nn — Add value at $nn to ASBC #$nn — Subtract $nn from A (use SEC first)SBC $nn — Subtract value at $nn from ACMP $nn — Compare A to $nn. Sets flags; does not change AAND #$nn / AND $nn — Bitwise AND. Keeps only bits set in both A and operandORA #$nn / ORA $nn — Bitwise OR. Sets bits in A where either operand has a 1EOR #$nn / EOR $nn — Bitwise XOR. Flips bits in A where operand has a 1BCS label — Branch if C=1 (carry set — A ≥ compared value)BCC label — Branch if C=0 (carry clear — A < compared value)BEQ label — Branch if Z=1 (result was zero / values were equal)BNE label — Branch if Z=0 (result was non-zero / values differ)BMI label — Branch if N=1 (result was negative, bit 7 set)BPL label — Branch if N=0 (result was positive or zero)SEC — Set carry flag (required before SBC)CLC — Clear carry flag (required before ADC chains)BRK — Halt execution. Program must reach BRK to pass testsLDX #$nn / LDX $nn — Load X register with valueLDY #$nn / LDY $nn — Load Y register with valueSTX $nn — Store X into memory. STY $nn — Store Y into memoryINX / DEX — Increment / Decrement X. Sets N, ZINY / DEY — Increment / Decrement Y. Sets N, ZTAX — Copy A→X. TAY — Copy A→Y. TXA — Copy X→A. TYA — Copy Y→ACPX #$nn / CPX $nn — Compare X to value. Sets N, Z, C (C=1 if X≥val)CPY #$nn / CPY $nn — Compare Y to value. Sets N, Z, C (C=1 if Y≥val)LDA $nn,X — Load from address ($nn + X), wraps in zero pageSTA $nn,X — Store A to address ($nn + X), zero page wrapLDA $nn,Y / STA $nn,Y — Same but indexed by YLDA ($nn),Y — Indirect indexed. Reads 16-bit pointer from $nn/$nn+1, adds Y for final addressSTA ($nn),Y — Store via indirect pointer + YLDA ($nn,X) — Indexed indirect. Adds X to $nn; reads 16-bit pointer from that addressSTA ($nn,X) — Store via pointer selected by $nn+XINC $nn — Increment memory byte. $FF wraps to $00. Sets N, ZDEC $nn — Decrement memory byte. $00 wraps to $FF. Sets N, ZBIT $nn — Test bits. Sets N=bit7, V=bit6, Z=(A AND mem)=0. Does not change AASL — Shift A left 1 bit (×2). Old bit 7 → C. ASL $nn — shift memoryLSR — Shift A right 1 bit (÷2). Old bit 0 → C. LSR $nn — shift memoryROL — Rotate A left through carry. bit 7→C, old C→bit 0. ROL $nn — rotate memoryROR — Rotate A right through carry. bit 0→C, old C→bit 7. ROR $nn — rotate memoryJSR label — Jump to subroutine at label. Pushes return address on stackRTS — Return from subroutine. Pops return address from stackJMP label — Unconditional jump. Does not push stackPHA — Push A onto stack. PLA — Pull A from stack (LIFO)NOP — No operation. 1 cycle, no effectSBC requires SEC first. ADC chains need CLC first to prevent carry leaking between additions.
Stack lives at $0100–$01FF. SP starts at $FF. Labels are case-sensitive.
All values wrap to 8-bit ($00–$FF). Memory $00–$FF is zero page only.
00 = off | nonzero = on