JoyPad()

Last Modified: 9/3/2021

Returns the button state of a 3 or 6 button controller.

Arguments

NameTypeRequiredDescription
ControllerPort Integer No ControllerPort 0 is player 1, ControllerPort 1 is player 2.

Button Map

BitHexDecimalButton
0 &h001 1 Up
1 &h002 2 Down
2 &h004 4 Left
3 &h008 8 Right
4 &h010 16 B
5 &h020 32 C
6 &h040 64 A
7 &h080 128 Start
8 &h100 256 Z
9 &h200 512 Y
10 &h400 1024 X
11 &h800 2048 Mode

Example

Syntax: JoyPad([<ControllerPort>])
    While 1
        j = JoyPad()
        If j.7 Then
            Print "START"
            Exit While
        End If
        Sleep 1
    Wend
    End

Remarks

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.