tdlabac / MSX1_MiSTer

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

Issue with direct access to joystick ports #4

Closed aloyisus closed 2 years ago

aloyisus commented 2 years ago

Commit 7dbfa9f4de fixed most of the games I tested which were showing problems with the gamepad/cursors, thanks so much for that.

Unfortunately I am still finding some titles for which joystick input seems to be broken, for example: Feud (1987)(Bulldog)

Again, I had a look at the code and found the subroutine responsible for getting the joystick input. This time it appears that the game is getting the status of the joystick port directly, without going through the BIOS (which was the case previously).

I've put together another test .CAS file, along with the source, here: testnobios.zip This works as expected on openMSX, but on MiSTer it behaves as though the fire trigger is being held down.

The code which is used to get the status of the joystick into the accumulator looks like this:

ld  a,00fh
out (0a0h), a
in  a, (0a2h)
and 0afh
out (0a1h), a
ld  a,00eh
out (0a0h), a
in  a,(0a2h)

Thanks in advance for anything you are able to do, this MSX core is rapidly becoming my favourite. I wish I could make an attempt at fixing it myself, but I just don't know enough about FPGA yet :)

tdlabac commented 2 years ago

Hi,

Fix in next version. testnobios.zip tool is not working properly. It does not take into account the settings on PSG port B0 - B3. If there is a logic 0 on the port, the joystick button signal is software pressed. See diagram. I also recommend disabling interrupts during joystick state sampling. The mentioned game works properly with the joystick after the repair. My test tool

Fix tool

ld  a,00fh
out (0a0h), a
in  a, (0a2h)
and 0afh
or 03h
out (0a1h), a
ld  a,00eh
out (0a0h), a
in  a,(0a2h)

image

aloyisus commented 2 years ago

Ah, sorry for the dodgy example file. Thanks for fixing the issue and for the explanation :)