The MOS 6502, used in popular computers and gaming consoles, is known for its illegal opcodes, which perform useful functions despite not being officially defined. While there have been articles exploring and testing these opcodes, there seems to be no explanation as to their origin. This article aims to provide that explanation. The 6502 uses a 130×21 bit decode ROM, known as the PLA, to interpret instructions. By comparing the opcode and the current clock cycle, the PLA determines which lines to fire. Similar opcodes can share lines, leading to unexpected behavior. For instance, the opcode $AF behaves like a combination of LDA and LDX instructions. The article also delves into the “KIL” opcodes, which disable interrupts and halts the CPU. Exploring these illegal opcodes can provide insights into the internal design of the 6502.
https://www.pagetable.com/?p=39