1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 16:34:15 +00:00
C02/include/x16/joystk.h02
2020-04-27 12:45:06 -04:00

64 lines
2.0 KiB
Plaintext

/* Module Development on Hold until R36 */
/* Joystick Functions for Commander X-16 Computer *
* Supports Keyboard, NES, and SNES Controllers *
* A and B on Keyboard and SNES Controller and *
* A, B, X, Y on SNES Controller are all *
* mapped to the joystick button JOYB0 *
* Individual button status and Controller Type *
* are returned as extended results */
/* Keyboard to NES Controller Mappings *
* Key: Ctrl Alt Space Enter Up Down Left Right *
* NES: A B Select Start Up Down Left Right */
#define JYSTKS 2 //Number of Joysticks
//Joystick Result Bitmasks
#define JOYUP $08 //Up
#define JOYDN $04 //Down
#define JOYLF $02 //Left
#define JOYRT $01 //Right
#define JOYB0 $C0 //Button
//Extended Result Bitmasks
#define JOYBA $80 //A Button
#define JOYBB $40 //B Button
#define JOYSL $20 //Select
#define JOYST $10 //Start
#define JOYBL $08 //Left Button
#define JOYBR $04 //Right Button
#define JOYBX $02 //X Button
#define JOYBY $01 //Y Button
//Controller Types
#define JOYKBD $00 //Keyboard (NES Emulation)
#define JOYNES $01 //NES Controller
#define JOYSNS $02 //SNS Controller
struct joysts {char btnsts, extsts, status;};
struct joysts joy0, joy1;
/* Read Joystick Status *
* Args: j = Joystick Number *
* Returns: char j = Joystick Status *
* $FF = Not Present *
* char x = Extended Status *
* char t = Controller Type */
char joystk();
/* Get Joystick Raw Status *
* X16 Specific System Routine *
* Args: j = Joystick Number *
* Returns: char j = Joystick Raw Status Bits *
* char x = Extended Raw Status Bits *
* char t = Joystick Status *
* $FF = Not Present */
char joyget();
/* Query Joysticks and Save State *
* X16 Specific System Routine *
* Called by the default interrupt handler */
void joyscn();