2.2 Joypad


**Joypad defines**

J_START = Start button
J_SELECT = Select button
J_B = B
J_A = A
J_DOWN = Down arrow on joypad
J_UP = Up arrow on joypad
J_LEFT = Left arrow on joypad
J_RIGHT = Right arrow on joypad

int joypad();
joypad() returns a byte containing which buttons from the joypad defines are pressed

int waitpad(int mask);
waitpad(mask) stops executing the program until the button(s) specified in mask are pressed.

void waitpadup();
waitpadup() stops executing the program until all buttons on the pad are released.


example:

int i,x,y;

i = joypad();
if(i & J_START) pause();
if(i & J_UP) y--;
if(i & J_DOWN) y++;
if(i & J_LEFT) x--;
if(i & J_RIGHT) x++;