6502 emulator: easy-to-miss official opcodes and flag gotchas
@kidskoding▲ 0 net votes
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.