Gamepad

From VO-EM Wiki
Jump to: navigation, search

The gamepad resides in the 4 bytes from 0xFFFF FF00 to 0xFFFF FFF4.

It consists of four buttons and a dpad, currently which by default are mapped as follows:

DPAD:     Arrow keys
Z:        'A' button
X:        'B' button
S:        'Select' button
Spacebar: 'Start' button

Reading the gamepad

The gamepad's data is organized as follows:

HHHH HHHH  VVVV VVVV  0000 00BA  0000 00SS
                                        ET  
    0          1          2          3 
[HHHH HHHH]orizontal 
This will contain all 0s if the left and right gamepad keys are not pressed. It will contain 1111 1111 if left is pressed (-1) and 0000 0001 if right is pressed (1)
[VVVV VVVV]ertical 
Much like horizontal, this contains 0 if up and down are not pressed, -1 if up is pressed and 1 if down is pressed.
[B] 
contains 1 if B is pressed
[A] 
contains 1 if A is pressed
[SE]lect 
contains 1 if select is pressed
[ST]art 
contains 1 if start is pressed

Writing to the gamepad

The gamepad only accepts 32 bit writes (sw). Writing to the gamepad does not change the data it shows; instead, it changes the IRQ priority level for the device.