# W65C816S Table 5-4 — Opcode Matrix
Format per entry: `$xx MNEM mode cyc,bytes`
`*` = new opcode on W65C816S (not in 65C02)
`+` = existing opcode with new W65C816S features
**Cycle count assumptions:**
- Branches not taken
- No page boundary crossings (emulation mode)
- M=1 and X=1 (8-bit accumulator and index registers)
- BRK and COP: emulation mode
- RTI: native mode
**Cycle count footnotes (additive):**
1. +1 cycle (and +1 byte for immediate) when M=0 or X=0 (16-bit mode)
2. +1 cycle if Direct Register low byte (DL) ≠ 0
3. RTI/interrupt: +1 cycle in native mode (for PBR push/pull)
4. +1 cycle for indexing across page boundary, or any write, or X=0
5. +1 cycle if branch taken
6. +1 cycle if branch crosses page boundary in emulation mode (E=1)
7. −1 cycle in emulation mode (E=1)
---
### Row $0x
```
$00 BRK s 7,2 + (note 3,7)
$01 ORA (d,x) 6,2 (note 2,1)
$02 COP s 7,2 * (note 3,7)
$03 ORA d,s 4,2 (note 1)
$04 TSB d 5,2 (note 2,1)
$05 ORA d 3,2 (note 2,1)
$06 ASL d 5,2 (note 2,1)
$07 ORA [d] 6,2 * (note 2,1)
$08 PHP s 3,1
$09 ORA # 2,2 (note 1)
$0A ASL A 2,1
$0B PHD s 4,1 *
$0C TSB a 6,3 (note 1)
$0D ORA a 4,3 (note 1)
$0E ASL a 6,3 (note 1)
$0F ORA al 5,4 * (note 1)
```
---
### Row $1x
```
$10 BPL r 2,2 (note 5,6)
$11 ORA (d),y 5,2 (note 2,4,1)
$12 ORA (d) 5,2 * (note 2,1)
$13 ORA (d,s),y 7,2 * (note 1)
$14 TRB d 5,2 (note 2,1)
$15 ORA d,x 4,2 (note 2,1)
$16 ASL d,x 6,2 (note 2,1)
$17 ORA [d],y 6,2 * (note 2,1)
$18 CLC i 2,1
$19 ORA a,y 4,3 (note 4,1)
$1A INC A 2,1 +
$1B TCS i 2,1 *
$1C TRB a 6,3 (note 1)
$1D ORA a,x 4,3 (note 4,1)
$1E ASL a,x 7,3 (note 1)
$1F ORA al,x 5,4 * (note 1)
```
---
### Row $2x
```
$20 JSR a 6,3
$21 AND (d,x) 6,2 (note 2,1)
$22 JSL al 8,4 *
$23 AND d,s 4,2 (note 1)
$24 BIT d 3,2 (note 2,1)
$25 AND d 3,2 (note 2,1)
$26 ROL d 5,2 (note 2,1)
$27 AND [d] 6,2 * (note 2,1)
$28 PLP s 4,1
$29 AND # 2,2 (note 1)
$2A ROL A 2,1
$2B PLD s 5,1 *
$2C BIT a 4,3 (note 1)
$2D AND a 4,3 (note 1)
$2E ROL a 6,3 (note 1)
$2F AND al 5,4 * (note 1)
```
---
### Row $3x
```
$30 BMI r 2,2 (note 5,6)
$31 AND (d),y 5,2 (note 2,4,1)
$32 AND (d) 5,2 * (note 2,1)
$33 AND (d,s),y 7,2 * (note 1)
$34 BIT d,x 4,2 + (note 2,1)
$35 AND d,x 4,2 (note 2,1)
$36 ROL d,x 6,2 (note 2,1)
$37 AND [d],y 6,2 * (note 2,1)
$38 SEC i 2,1
$39 AND a,y 4,3 (note 4,1)
$3A DEC A 2,1 +
$3B TSC i 2,1 *
$3C BIT a,x 4,3 + (note 4,1)
$3D AND a,x 4,3 (note 4,1)
$3E ROL a,x 7,3 (note 1)
$3F AND al,x 5,4 * (note 1)
```
---
### Row $4x
```
$40 RTI s 7,1 (note 3,7)
$41 EOR (d,x) 6,2 (note 2,1)
$42 WDM i 2,2 *
$43 EOR d,s 4,2 (note 1)
$44 MVP xyc 7,3 * (per byte moved)
$45 EOR d 3,2 (note 2,1)
$46 LSR d 5,2 (note 2,1)
$47 EOR [d] 6,2 * (note 2,1)
$48 PHA s 3,1 (note 1)
$49 EOR # 2,2 (note 1)
$4A LSR A 2,1
$4B PHK s 3,1 *
$4C JMP a 3,3
$4D EOR a 4,3 (note 1)
$4E LSR a 6,3 (note 1)
$4F EOR al 5,4 * (note 1)
```
---
### Row $5x
```
$50 BVC r 2,2 (note 5,6)
$51 EOR (d),y 5,2 (note 2,4,1)
$52 EOR (d) 5,2 * (note 2,1)
$53 EOR (d,s),y 7,2 * (note 1)
$54 MVN xyc 7,3 * (per byte moved)
$55 EOR d,x 4,2 (note 2,1)
$56 LSR d,x 6,2 (note 2,1)
$57 EOR [d],y 6,2 * (note 2,1)
$58 CLI i 2,1
$59 EOR a,y 4,3 (note 4,1)
$5A PHY s 3,1 + (note 1)
$5B TCD i 2,1 *
$5C JMP al 4,4 *
$5D EOR a,x 4,3 (note 4,1)
$5E LSR a,x 7,3 (note 1)
$5F EOR al,x 5,4 * (note 1)
```
---
### Row $6x
```
$60 RTS s 6,1
$61 ADC (d,x) 6,2 (note 2,1)
$62 PER s 6,3 *
$63 ADC d,s 4,2 (note 1)
$64 STZ d 3,2 + (note 2)
$65 ADC d 3,2 (note 2,1)
$66 ROR d 5,2 (note 2,1)
$67 ADC [d] 6,2 * (note 2,1)
$68 PLA s 4,1 (note 1)
$69 ADC # 2,2 (note 1)
$6A ROR A 2,1
$6B RTL s 6,1 *
$6C JMP (a) 5,3
$6D ADC a 4,3 (note 1)
$6E ROR a 6,3 (note 1)
$6F ADC al 5,4 * (note 1)
```
---
### Row $7x
```
$70 BVS r 2,2 (note 5,6)
$71 ADC (d),y 5,2 (note 2,4,1)
$72 ADC (d) 5,2 * (note 2,1)
$73 ADC (d,s),y 7,2 * (note 1)
$74 STZ d,x 4,2 + (note 2)
$75 ADC d,x 4,2 (note 2,1)
$76 ROR d,x 6,2 (note 2,1)
$77 ADC [d],y 6,2 * (note 2,1)
$78 SEI i 2,1
$79 ADC a,y 4,3 (note 4,1)
$7A PLY s 4,1 + (note 1)
$7B TDC i 2,1 *
$7C JMP (a,x) 6,3 +
$7D ADC a,x 4,3 (note 4,1)
$7E ROR a,x 7,3 (note 1)
$7F ADC al,x 5,4 * (note 1)
```
---
### Row $8x
```
$80 BRA r 2,2 + (note 5,6)
$81 STA (d,x) 6,2 (note 2,1)
$82 BRL r16 4,3 *
$83 STA d,s 4,2 (note 1)
$84 STY d 3,2 (note 2)
$85 STA d 3,2 (note 2,1)
$86 STX d 3,2 (note 2)
$87 STA [d] 6,2 * (note 2,1)
$88 DEY i 2,1
$89 BIT # 2,2 + (note 1)
$8A TXA i 2,1
$8B PHB s 3,1 *
$8C STY a 4,3
$8D STA a 4,3 (note 1)
$8E STX a 4,3
$8F STA al 5,4 * (note 1)
```
---
### Row $9x
```
$90 BCC r 2,2 (note 5,6)
$91 STA (d),y 6,2 (note 2,1)
$92 STA (d) 5,2 * (note 2,1)
$93 STA (d,s),y 7,2 * (note 1)
$94 STY d,x 4,2 (note 2)
$95 STA d,x 4,2 (note 2,1)
$96 STX d,y 4,2 (note 2)
$97 STA [d],y 6,2 * (note 2,1)
$98 TYA i 2,1
$99 STA a,y 5,3 (note 1)
$9A TXS i 2,1
$9B TXY i 2,1 *
$9C STZ a 4,3 +
$9D STA a,x 5,3 (note 1)
$9E STZ a,x 5,3 +
$9F STA al,x 5,4 * (note 1)
```
---
### Row $Ax
```
$A0 LDY # 2,2 (note 1)
$A1 LDA (d,x) 6,2 (note 2,1)
$A2 LDX # 2,2 (note 1)
$A3 LDA d,s 4,2 (note 1)
$A4 LDY d 3,2 (note 2,1)
$A5 LDA d 3,2 (note 2,1)
$A6 LDX d 3,2 (note 2,1)
$A7 LDA [d] 6,2 * (note 2,1)
$A8 TAY i 2,1
$A9 LDA # 2,2 (note 1)
$AA TAX i 2,1
$AB PLB s 4,1 *
$AC LDY a 4,3 (note 1)
$AD LDA a 4,3 (note 1)
$AE LDX a 4,3 (note 1)
$AF LDA al 5,4 * (note 1)
```
---
### Row $Bx
```
$B0 BCS r 2,2 (note 5,6)
$B1 LDA (d),y 5,2 (note 2,4,1)
$B2 LDA (d) 5,2 * (note 2,1)
$B3 LDA (d,s),y 7,2 * (note 1)
$B4 LDY d,x 4,2 (note 2,1)
$B5 LDA d,x 4,2 (note 2,1)
$B6 LDX d,y 4,2 (note 2,1)
$B7 LDA [d],y 6,2 * (note 2,1)
$B8 CLV i 2,1
$B9 LDA a,y 4,3 (note 4,1)
$BA TSX i 2,1
$BB TYX i 2,1 *
$BC LDY a,x 4,3 (note 4,1)
$BD LDA a,x 4,3 (note 4,1)
$BE LDX a,y 4,3 (note 4,1)
$BF LDA al,x 5,4 * (note 1)
```
---
### Row $Cx
```
$C0 CPY # 2,2 (note 1)
$C1 CMP (d,x) 6,2 (note 2,1)
$C2 REP # 3,2 *
$C3 CMP d,s 4,2 (note 1)
$C4 CPY d 3,2 (note 2,1)
$C5 CMP d 3,2 (note 2,1)
$C6 DEC d 5,2 (note 2,1)
$C7 CMP [d] 6,2 * (note 2,1)
$C8 INY i 2,1
$C9 CMP # 2,2 (note 1)
$CA DEX i 2,1
$CB WAI i 3,1 * (then halts until interrupt)
$CC CPY a 4,3 (note 1)
$CD CMP a 4,3 (note 1)
$CE DEC a 6,3 (note 1)
$CF CMP al 5,4 * (note 1)
```
---
### Row $Dx
```
$D0 BNE r 2,2 (note 5,6)
$D1 CMP (d),y 5,2 (note 2,4,1)
$D2 CMP (d) 5,2 * (note 2,1)
$D3 CMP (d,s),y 7,2 * (note 1)
$D4 PEI d 6,2 * (note 2)
$D5 CMP d,x 4,2 (note 2,1)
$D6 DEC d,x 6,2 (note 2,1)
$D7 CMP [d],y 6,2 * (note 2,1)
$D8 CLD i 2,1
$D9 CMP a,y 4,3 (note 4,1)
$DA PHX s 3,1 + (note 1)
$DB STP i 3,1 * (then halts clock until RESB)
$DC JML [a] 6,3 *
$DD CMP a,x 4,3 (note 4,1)
$DE DEC a,x 7,3 (note 1)
$DF CMP al,x 5,4 * (note 1)
```
---
### Row $Ex
```
$E0 CPX # 2,2 (note 1)
$E1 SBC (d,x) 6,2 (note 2,1)
$E2 SEP # 3,2 *
$E3 SBC d,s 4,2 (note 1)
$E4 CPX d 3,2 (note 2,1)
$E5 SBC d 3,2 (note 2,1)
$E6 INC d 5,2 (note 2,1)
$E7 SBC [d] 6,2 * (note 2,1)
$E8 INX i 2,1
$E9 SBC # 2,2 (note 1)
$EA NOP i 2,1
$EB XBA i 3,1 *
$EC CPX a 4,3 (note 1)
$ED SBC a 4,3 (note 1)
$EE INC a 6,3 (note 1)
$EF SBC al 5,4 * (note 1)
```
---
### Row $Fx
```
$F0 BEQ r 2,2 (note 5,6)
$F1 SBC (d),y 5,2 (note 2,4,1)
$F2 SBC (d) 5,2 * (note 2,1)
$F3 SBC (d,s),y 7,2 * (note 1)
$F4 PEA s 5,3 *
$F5 SBC d,x 4,2 (note 2,1)
$F6 INC d,x 6,2 (note 2,1)
$F7 SBC [d],y 6,2 * (note 2,1)
$F8 SED i 2,1
$F9 SBC a,y 4,3 (note 4,1)
$FA PLX s 4,1 + (note 1)
$FB XCE i 2,1 *
$FC JSR (a,x) 8,3 +
$FD SBC a,x 4,3 (note 4,1)
$FE INC a,x 7,3 (note 1)
$FF SBC al,x 5,4 * (note 1)
```