I've been using the Visual 6502 to validate the behaviour of various undocumented opcodes for my TTL 6502 project. As Dr. Jefyl predicted (
http://forum.6502.org/viewtopic.php?f=4&t=3493&p=44641), implementing these slippery devils without an authoritative guide is indeed proving ambitious. That said, the Visual 6502 has been very helpful in this regard. For example, LAX zp (opcode $A7) is supposed to load both the A and X registers from memory. A quick test on the Visual 6502 confirms this -
http://www.visual6502.org/JSSim/expert.html?graphics=f&steps=17&a=0000&d=a9fe8520a72000. In the final step we can see $FE is loaded both into the A and X registers exactly as it should be. I have run all undocumented opcodes I am aware of through the Visual 6502 in this way, and most work as expected, but not all ...
For example, opcode $4B did not perform as advertised. $4B is supposed to take an immediate argument, perform an AND with the accumulator and then shift the result right. The opcode is referred to as either ALR or ASR in various docs (
http://nesdev.com/undocumented_opcodes.txt or
http://www.oxyron.de/html/opcodes02.html). A test on my VIC 20 confirms this behaviour: AND followed by LSR. But the Visual 6502 shows something different. Here, the argument seems to be read but ignored. See:
http://www.visual6502.org/JSSim/expert.html?graphics=f&steps=11&a=0000&d=a9804b000000. LDA #$80, ALR #$00 should leave a 0 in the accumulator not $40. I ran the same test on my VIC 20 and sure enough, I get a zero for this sequence.
I also encountered problems with LAS ($BB) and ARR ($6B) on the Visual 6502. For ARR (A:=(A&#{imm})/2), once again the argument seems to be ignored (as with ALR above) so the result is equivalent to a ROR. LAS (A,X,S:={adr}&S) is interesting in that the right result is generated and transferred to A,X and SP as expected, but then in the next half cycle X and SP are restored and the high nibble of A is incremented. Puzzling - I did not test this thoroughly so I can't be definitive about what is happening there.
Interestingly, $AB seems to exhibit a similar ambiguity as ALR around an AND #imm operation. It is documented as ATX (A,X := A AND #imm) on
http://www.nesdev.com but as LAX (A,X := #imm) on
http://www.oxyron.de and labelled as "highly unstable". In this case, the Visual6502 respects the AND #imm operation yielding the ATX variant -
http://www.visual6502.org/JSSim/expert.html?graphics=f&steps=11&a=0000&d=a980Ab000000. Perhaps the "highly unstable" characterization has something to do with the AND #imm.
Now I know all bets are off with these undocumented opcodes, but this has me puzzled (and interested). I'm wondering if anyone has run into these quirks in the Visual 6502 before and can comment. Any insights would be much appreciated.