I thought that people on this forum might be interested in my CHESSmate Reproduction project. For details see: Commodore CHESSmate Reproduction | Hackaday.io
Nice project - very odd to see that aberrant behaviour though. Especially as you have 3 identical ROM dumps. Is it possible there’s an emulator bug?? I think most emulators these days pass Klaus Dormann’s test suite. For a C model, I’d go with Ian Piumarta’s lib6502/run6502 although of course other models are available.
Thanks! I was hoping that I might get some suggestions from this group. On the emulator side I have tried two different emulators. One was Python based that passes a couple of test suites. I know because I was having problems running BASIC on my Challenger 4P reproduction under it, and used the tests to ferret out a couple of problems with the emulator.
I going to dump the ROM from my original CHESSmate tomorrow so I’ll see what happens.
My only other thought at this point is that there is some tiny difference between execution on a 6504 vs a 6502.
I didn’t look at the source, but if it uses decimal mode you’re going to run into trouble with Mike Chambers’ emulation, since many of the versions I’ve seen don’t add or subtract BCD properly. I offered a rather terse public domain fix here:
Thanks Michael. I was using Mike Chambers emulation. When I started having issues I looked at Oscar Vermeulen’s version of Mike’s code and noticed he had applied a BCD patch as well. I just applied your version and I’m afraid there was no joy. Same behavior. If you can think of anything else I’m all ears.
That’s a great project, and a fantastic writeup. I’m still kicking myself for not going to the MCM-70 event in November: I can’t remember why I didn’t. So small is the Canadian retrocomputing crowd, I know most of the people in your pictures.
Peter Jennings’ writeup about the CHESSmate is glorious, especially the bits about Commodore never paying suppliers (rumoured to be how they acquired MOS) and the extended time spent with Bobby Fischer: Commodore CHESSmate - Peter Jennings
Nice project. I’ve made a few emulators and had a similar problem to yours more than once. Not the exact problem, but the problem of an emulator not matching the hardware. One way I have sorted the problem is to use an RP Pico to trace the execution of the code on the real hardware and compare that to the emulated code running. I attached a RP Pico directly to a Z80 running code and had it start tracing when it saw a certain address, buffering the trace to RAM. It then dumped the trace out of the USB when it was full. The trigger address allowed me to trace different blocks of code, moving on to new areas once I had verified execution against the emulator. The Pico is 5V tolerant enough that you can just attach the Pico to the address and data buses and some control signals, no level shifters required. As the Pico is operating in an input-only mode there’s little danger to the original hardware.
You should then be able to diff the two traces and see where the code execution diverges and pin down your problem.
Maybe something like this could help?
Thanks Stewart. It turns out that my asking him if he was ok with my doing a CHESSmate repo triggered him to write the article which I thoroughly enjoyed as well.
Great idea Andrew. I just acquired a 24-pin test clip and a bunch of test hook clips with leads to dump the ROM. Now I’ll have to get a 28-pin clip for the 6504. I have a Pi 4 with a level shifter hat that should do the trick.
That’s what I did for the Z80 version, I wired the Pico pins to a 40 pin test clip and put it on top of the Z80 (this was on a Casio FX9000P, when I made some memory cartridges and had to debug some problems).
Also, another approach, similar hardware shown here:
is to emulate the ROM itself using the Pico. This is a bit more invasive as the ROM is removed and the Pico replaces it. You then run the code and the ROM emulator captures the address and data for each run. If you do this on both working hardware (or a working emulator) and the non-working then you get two traces you can compare. A similar but slightly different approach.
Hope you find your problem. I’m interested to find out what it turns out to be.
I very much recommend @hoglet’s Protocol Decoder projects - originally 6502 but now also 6809 and Z80 versions. With a surprisingly small number of signals captured by a cheap logic analyser - maybe as few as 9 - the decoder models the state of the CPU and produces a trace which includes disassembly and all register contents, as and when they become determinate.
The one last sticking point was that I had requested an 18% interest on overdue payments. The “suit” from California pointed out that that was not necessary, because, of course, Commodore would always pay me promptly every quarter. I pointed out that if that was the case there could be no objection to the interest rate remaining in the contract, as nothing would ever be owed. He did not have an argument for that and we agreed that the clause would remain in the contract. I think I may have made more in interest than in royalties in the years that followed.
Preparation is the key to success. Before leaving Toronto, I had connected an acoustic coupler modem to the serial input/output of the Kim-1 system on my desk. Ray had a teletype machine with a modem. I called my wife and told her to turn on the computer and place the phone in the acoustic coupler. In California, we started the ASR33 teletype and pressed some keys. Incredibly, the Kim-1 responded as if the teletype was connected directly. A few changes were made to the source code. Micro-ADE was run to compile the changes. A dump of the binary file was transferred back over the phone line to the Teletype and punched on paper tape ready to be burned into a new set of PROMs. My Kim-1 in Toronto was certainly the only one in the world with dual floppy disks and an acoustic coupler running a unique copy of Micro-ADE capable of assembling the program.
First of all thanks to everyone for their helpful suggestions. I have mostly solved the issues I was having with my CHESSmate. Not the ROM image, not the emulator, just normal stupid programmer error. The gory details can be found here: