Closed bcampbell closed 10 months ago
Did you find the implementation of pce_joypad_read()?
I am not familiar with PC Engine to be intimate with that code, though briefly correlating against example code at https://www.chibiakumas.com/6502/platform2.php#LessonP14 , everything does check out. You could try copy-pasting the implementation of those functions to your own code and playing around with the constructs to see if you can find an issue.
The only thing that I find different is that the above code sleep 4x SXY instructions for 4x3 = 12 clock cycles, whereas the code I found on the above web page waits for a PHA+PLA+NOP+NOP = 3+4+2+2 = 11 clock cycles. Hrm, so that wouldn't explain a problem either.
There is a mention however
Before we can start reading, we need to initialize the 'Multitap' (the hardware that toggles the joypads)...
to do this we just write a #1 then #3 to port $1000... we need a short delay after each write....
Maybe that is what might be missing?
@asiekierka
The multitap handling is broken in some manner (and 6-button gamepad handling is not implemented at all).
You can easily verify this in Mednafen by setting pce.input.multitap
to 0, or in Ares by using the GUI.
I wrote a little PCE program to display the joypad value, and only the lower bits seem to work. Start, Select and the two fire buttons seem fine, but I get no directions.
It could be my emulator config... but when I run a game rom with the same commandline options the joypad seems to work fine.
Of course, github doesn't let me attach a C file... so here's my test program inlined!