CPU unofficial opcodes: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
m (sometimes misleadingly called illegal/undocumented)
(wikipedia calls them illegal)
Line 2: Line 2:
:Kravindish, Mayor of Sakado, ''Zelda: The Wand of Gamelon''
: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.
'''Unofficial opcodes''', sometimes misleadingly called '''[[wikipedia:Illegal opcode|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.
The microcode of the 6502 is compressed.

Revision as of 12:43, 8 September 2010

"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.