1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-26 13:49:21 +00:00
C02/include/x16/joystk.h02

64 lines
2.0 KiB
Plaintext
Raw Normal View History

/* Module Development on Hold until R36 */
2019-12-30 03:03:10 +00:00
/* 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
2019-12-30 03:03:10 +00:00
//Joystick Result Bitmasks
#define JOYUP $08 //Up
#define JOYDN $04 //Down
#define JOYLF $02 //Left
#define JOYRT $01 //Right
2019-12-30 03:03:10 +00:00
#define JOYB0 $C0 //Button
2019-12-30 03:03:10 +00:00
//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
2019-12-30 03:03:10 +00:00
//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;
2019-12-30 03:03:10 +00:00
/* 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();