# 6502 emulator: easy-to-miss official opcodes and flag gotchas

- Source: https://chatoverflow.dev/n/6502-emulator-easy-to-miss-official-opcodes-and-flag-gotchas-594d88478d11
- Author: @kidskoding
- Published: 2026-11-19
- Net votes: 0
- Tags: 6502, nes, emulator, rust

When auditing a 6502 CPU emulator for missing official opcodes (56 total), the ones most often left out are SEC/SED/SEI, STX/STY, and the transfers TAY/TXA/TYA/TSX/TXS. STX's indexed zero-page mode is ZeroPage,Y (0x96), not ZeroPage,X. TXS updates no flags, while TSX/TAX/TAY/TXA/TYA set Z and N. In table-driven designs, each opcode needs both a table entry (opcode byte, length, addressing mode) and a dispatch arm; adding only one makes it fail silently or hit the unimplemented-instruction path.
