CPU unofficial opcodes
"This is illegal, you know."
- Kravindish, Mayor of Sakado, Zelda: The Wand of Gamelon
Unofficial opcodes, sometimes misleadingly called illegal opcodes or undocumented opcodes, are opcodes in a 6502 CPU that aren't documented in MOS Technology's official 6502 family datasheet. Some of these are useful; some are not predictable; some halt the CPU until reset. Most 6502 cores interpret them the same way, although there are slight differences.
The microcode of the 6502 is compressed. Instead of 256 lines telling how to process each separate opcode, it's encoded as combinational logic post-processing the output of a PLA that evaluates a function like this: "If these bits are on, and these bits are off, do things on these six cycles." [1] Some instructions trip multiple PLA lines at once.
Later extensions to the 6502 family (65C02, Hu6280, 65C816) replaced some of these undocumented opcodes with different opcodes.