Time for another update.
First, to close off the previous topic (SYNC-less and RDY-less decoding on the Master 128), it turns out this is actually possible. It involves predicting when the Master 128 would use RDY to insert wait states (based on the address accessed) and having the decoder do the same. This is behaviour enabled with a "--machine=master" command line flag. While not in any way generic, it proves this is possible if needed. The additional code is
quite small.
Next, I worked on one of the loose ends: supporting Decimal Mode. This is now in place, and the decoder correctly track all the eight different variations of Bruce Clark's BCD tests (including all flags, and illegal inputs). This works on the 6502 and the 65C02, where the extra cycle needs to be accomadated.
After that, I've been trying to prove the SYNC-less decoder by running Klaus Dormann's 6502 and 65C02 functional tests. This found bugs in:
- TRB/TSB, where I was grabbing the operand from the wrong cycle
- BBR/BBS, where the sequence of bus cycles was not quite as expected (the fetch of the third byte of the instruction is somewhat delayed)
- plus a few other instructions which had incorrect cycle counts (transcription errors on my part).
Rather frustratingly, at least on my system, the FX2 driver for Sigrok seems to give up randomly after ~30s of capture. This prevents the capture of a complete run of Klaus's test suite (which takes just over a minute on the Master, and 2 minutes on the Electron). The reason, I think, is that asynchronous capture of 16 bits @ 12MHz is a significant load on both the USB bus, and on the system. There is also very little buffering on the FX2 device itself. If it were possible to capture synchronously, on the falling edge of Phi2, then the data rate (and file size) would be reduced 6x.
After reading around a bit more, I stumbled across the
fx2pipe utility which purports to support synchronous captures from the FX2. A
few changes are needed to allow this to compile on a modern Linux system (Ubuntu 16.04). Plus a
change to capture on the falling edge, rather than the rising clock edge.
Using fx2pipe it's possible to capture indefinitely, and so I've been successful in verifying against the complete Dormann tests.
It's also possible (if slightly crazy) to use fx2pipe and decode6502 in a pipe that runs continuously:
Code:
fx2pipe -d=1d50:608d -a 2>/dev/null | ./decode6502 -s -h -y --sync= --phi2= | egrep "FEE1|FEE3|FEE5|FEE7"
More details on some of the above can be found
elsewhere.
Dave