Closed benderscruffy closed 2 weeks ago
It looks like it's reading C button presses as Start presses, and it's probably also reading B presses as A presses.
This game has strange code for reading controller inputs. For 3-button controllers, most games do something like this:
move.b #0x40, ($A10009) ; set TH pin to output and all other pins to input
move.b #0x00, ($A10003) ; set TH=low
nop ; wait for controller to update pins
nop
move.b ($A10003), d0 ; read A and Start
move.b #0x40, ($A10003) ; set TH=high
nop
nop
move.b ($A10003), d1 ; read B, C, and directional inputs
This game does this (abridged a bit to skip irrelevant instructions):
move.b #0x00, ($A10003) ; set TH=low
move.b #0x00, ($A10009) ; set TH pin to input???
nop ; wait for controller to update pins
nop
move.b ($A10003), d0 ; ???
move.b #0x40, ($A10003) ; set TH=high
move.b #0x40, ($A10009) ; set TH to output
nop
nop
move.b ($A10003), d1 ; read B, C, and directional inputs
It seems to expect the first read to function as if TH is low, which should return the status of the A and Start buttons. Right now TH in input mode functions the same as TH high so it's reading the B/C/direction inputs twice.
Making TH in input mode function the same as TH=low fixes this, but I'm struggling to think of an explanation for why this works on actual hardware.
Fixed with a solution that mostly makes sense to me:
C button doesnt work properly