GBDK libraries documentation
PrevChapter 5. LibrariesNext

Joypad - gb.h

Functions

joypad / waitpad / waitpadup

/* Joypad bits */

#define	J_START      0x80U
#define	J_SELECT     0x40U
#define	J_B          0x20U
#define	J_A          0x10U
#define	J_DOWN       0x08U
#define	J_UP         0x04U
#define	J_LEFT       0x02U
#define	J_RIGHT      0x01U

UBYTE
joypad(void);

UBYTE
waitpad(UBYTE mask);

void
waitpadup(void);
						

Description

The joypad() function reads the current status of the joypad. It does not block the current thread of control. The joypad status returned by the function uses one bit for each button, according to the definitions given above.

The waitpad() function waits for any button from a given mask to be pushed. The waitpadup() function waits for all buttons to be released.

Parameters

mask: set of buttons to wait for.

Returns

The joypad() and \waitpadup() functions return the joypad status.


PrevHomeNext
Graphics/Tile functionsUpHardware registers - hardware.h