Friday, January 5, 2018

1351 Mouse and paddles now work on the MEGA65 rev1 PCB

I had previously written about how I had figured out to drive the mouse.  I have now merged those changes into the MEGA65 source code, and synthesised a bit-stream that happily works with it, as you can see in this video:


This proved not too hard to do, especially since I had already proven it to work in my VHDL test harness. The main complications I faced were in plumbing the signals through to the SIDs, and getting the CIA multiplexing of the POT lines working correctly.  With two SIDs, the MEGA65 lets you use all four POT lines without fiddling with the multiplexor: Two on each SID. The CIA multiplexor lines just switch which SID handles the POT lines from which joystick port.

The only known caveat at the moment, is if you use external SIDs, then the POT lines won't work, because the POT lines are read through the VHDL SIDs.  There are a couple of ways around this at the moment:

1. Have some kind of crazy adaptor on any external SID cartridge, to route the lines. This might require joystick pass-through adapters, similar to what I am using on this rev1 PCB.

2. Patch software to use the MEGA65 direct POT registers at $D620-$D623, which allow all four POT lines to be read, without involving the SIDs.

However, we recognise that this is not ideal, and I will have a look at having an option to have SIDs external, but still making the POT lines be read from the internal VHDL-SIDs. That way, things like the MSSIAH cartridge combined with an external SID cartridge would still be able to work, which we see as a potential use-case for some folks, and that we would like to support.

Otherwise, the only remaining thing to fix on the POT lines is to try out the 1.0nF capacitors, to see if that gets us full range of movement on the paddles working correctly.  I had a couple of errands to run this morning, so I pedalled past Jaycar on the way and invested the necessary $0.70 in the two capacitors, and also a few dollars for an HDMI cable, so that I can begin working on HDMI output.

After replacing the capacitors, the mouse still works, and I even didn't accidentally exchange the X and Y axes when I had the appropriate wires de-soldered, which I was very happy about :)

Also, changing the capacitors fixed the jumping problem in the mouse test program, as the values being presented by the mouse are now in the correct range expected from a real mouse. However, the paddles are still not perfect: They only cover the range from $00 to about $C0 (range of 192).  So it might be that we need a slightly larger value capacitor, perhaps a 1.2nF in order to get full range. However, that said, real C64 paddles typically have a similar usable range, but not identical.  So, the best solution: Test it! The easiest option open to me was to simply plug in Pinball Spectacular, and try to see if I could get full travel on the game. This worked totally fine, with ample spare travel at each end.


So, I think that wraps up the POT lines on the MEGA65 for now.  I can now work through the other tasks on my list.