tdlabac / MSX1_MiSTer

GNU General Public License v2.0
21 stars 4 forks source link

Joystick input broken in some games #2

Closed aloyisus closed 2 years ago

aloyisus commented 2 years ago

I've found that with a few .CAS games, joystick or cursor key input doesn't work, leaving them unplayable. It certainly isn't the case for every game, but it does occur with a sizeable proportion including e.g.: Chiller (1985)(Mastertronic) Knight Tyme (1986)(Mastertronic Added Dimension) Disc Warrior (1984)(Alligata Software)

These titles are all generally compatible with the MSX1 standard, running fine on a real Toshiba HX-10 for example. I must admit I'm not very familiar with the Philips VG-8020 on which I believe this core is based, so it's possible that this could be some quirk of that machine's specification and not a bug in the MiSTer implementation. I have also tried these in openMSX configured to emulate VG-8020 hardware, but I don't know if this would be considered a useful comparison.

I disassembled one of these games, Knight Tyme, to see if there was anything which might shed any light on the problem. I extracted the subroutine which gets the status of the joystick ports and the cursor keys (via BIOS calls GTSTCK and GTTRIG), and then I found another subroutine which writes something to ports a0 and a1 (all I know is this has something to do with the PSG), and this appears to cause the problem by making GTTRIG always think the fire button is being pressed: ld a,007h out (0a0h),a ld a,0ffh out (0a1h),a ret

I compiled both subroutines into a minimal .CAS file which reproduces the problem on MiSTer, but works without problem on openMSX. I have yet to try it on real hardware (I no longer have access), but the example is extracted directly from a game which works on the HX-10, so it should be fine on real MSX. The .CAS file and source are attached. joytest.zip

Sorry I can't give much more than this. As I noted above, I'm not familiar with Philips VG-8020 so it's entirely possible that this is expected behaviour on that hardware.

dlabac commented 2 years ago

Fixed. commit #7dbfa9f4de5a878dd66234bda88fc75a84993a30

Thanx analyze problem.

wwark commented 2 years ago

The gamepad doesn't seem to work now with the last RBF. I'm using Rom file on my side. Thanks !