6502 Unsupported Opcodes

From VisualChips

(Difference between revisions)
Jump to: navigation, search
m (link to parent)
(small update)
Line 1: Line 1:
The 6502 is famous for doing interesting and sometimes useful things when the program includes invalid (or unspecified) opcodes.
The 6502 is famous for doing interesting and sometimes useful things when the program includes invalid (or unspecified) opcodes.
-
The visual6502 simulator can help when investigating what these opcodes do, and why - see below!
+
For a list of all opcodes and some explanation of what they do, see [[6502 all 256 Opcodes]].
 +
 
 +
The visual6502 simulator can help when investigating what these opcodes do, and why - see below for a few cases and pointers for exploration.
== examples ==
== examples ==
Line 29: Line 31:
* [http://bbc.nvg.org/doc/6502OpList.txt Full 6502 Opcode List Including Undocumented Opcodes] by J.G.Harston
* [http://bbc.nvg.org/doc/6502OpList.txt Full 6502 Opcode List Including Undocumented Opcodes] by J.G.Harston
* [http://www.pagetable.com/?p=517 Michael Steil's presentation at 27C3] (pagetable.com links to 6 sections on youtube)
* [http://www.pagetable.com/?p=517 Michael Steil's presentation at 27C3] (pagetable.com links to 6 sections on youtube)
 +
* [http://www.viceteam.org/plain/BUGS Vice BUGS document] mentions XAA being used in a Mastertronic loader
 +
* [http://www.atlantis-prophecy.org/recollection/?load=online&issue=1&sub=article&id=4 An examination of an early tape loader] by Fungus/Nostalgia/Onslaught

Revision as of 13:52, 6 January 2011

The 6502 is famous for doing interesting and sometimes useful things when the program includes invalid (or unspecified) opcodes.

For a list of all opcodes and some explanation of what they do, see 6502 all 256 Opcodes.

The visual6502 simulator can help when investigating what these opcodes do, and why - see below for a few cases and pointers for exploration.

examples

  • LAX will load both A and X - notice signals SBX and SBAC which control the writes to X and to A.
  • KIL will put the T-state counter into an unrecoverable state
  • XAA #$5A (also known as ANE) with A=FF
    • and with A=00 shows A is OR with 00 before AND with X and the immediate value

some background

Beware: different revisions of 6502 and versions from different manufacturers may have different behaviours.

For some of these opcodes, the chip does something logically predictable and our model has the same behaviour. But there may be opcodes which are not logically predictable, because they cause marginal voltages on the chip as different drivers fight one another, or a node which is undriven is sampled at a later time. In those cases, our visual6502 simulator, which is just a switch-level simulator with a couple of coarse heuristics for modelling contention and charge storage, won't do the same as a chip.

In fact, as some opcodes produce results which vary from one chip to another, no deterministic simulator could be 'accurate'. (A simulator could let you know that something is amiss)

But note that the underlying circuit data which we now have includes transistor strengths and an approximation of capacitative load: it could easily be extended for resistance and more accurate capacitance. So a more refined (lower level) simulation might shed more light on these undocumented opcodes. In fact, the FPGA model works differently - it moves charge from one node to another - and it might be more accurate for the difficult cases.

resources

Personal tools