JoyPad()
Previous  Next

Description: Returns the button state of a controller.

     Syntax:
     
JoyPad(<ControllerPort>)

Part
Description
<ControllerPort>
Required. This is the port the controller is plugged into the console. 0 is Controller/Player 1 and 1 is Controller/Player 2.

Notes: If you're using a 3 button controller, it's not safe to assume that the upper bits will be cleared as they may be set based on button combinations.

Bit
Hex
Decimal
Button
0
1
2
3
4
5
6
7
8
9
10
11
&H001
&H002
&H004
&H008
&H010
&H020
&H040
&H080
&H100
&H200
&H400
&H800
1
2
4
8
16
32
64
128
256
512
1024
2048
UP
DOWN
LEFT
RIGHT
B
C
A
START
Z
Y
X
MODE

Example:

        a = JoyPad(0)
        If a.7 Then Print "Start Button!"