Controller Inputs and NMI
Updated: June 09, 2023 at 19:29 CESTUse the following ports to read coin acceptor, joystick and button state.
$B000
(Read) - Joystick 1$B001
(Read) - Joystick 2$B002
(Read) - Other
Right | %00000001 |
Left | %00000010 |
Up | %00000100 |
Down | %00001000 |
Jump | %00010000 |
Right | %00000001 |
Left | %00000010 |
Up | %00000100 |
Down | %00001000 |
Jump | %00010000 |
P1 Coin | %00000001 |
P2 Coin | %00000010 |
P1 Start | %00000100 |
P2 Start | %00001000 |
Joystick 1 port is also used to enable / disable Non Maskable Interrupt.
⚠️ This is just a guess and has not been verified at the moment of writing.
$B000
(Write) - NMI On / Off
When NMI happens Z80 starts executing code at $0066
address which writes 0
to the register and jumps to VBLANK procedure. At VBLANK exit it is written with 1
value.
This seems to be solution to disable / enable NMI from code. As result another NMI is prevented from happening while VBLANK procedure is being processed.