Author: mvac7 [mvac7303b@gmail.com]
Architecture: MSX
Format: C Object (SDCC .rel)
Programming language: C and Z80 assembler
This project is an Open Source library with basic functions for reading joystick controllers or cursor keys of MSX computers.
It uses the functions from the MSX BIOS, so it is designed to create applications in ROM format.
Use them for developing MSX applications using Small Device C Compiler (SDCC) compilator.
In the source code (\examples), you can find applications for testing and learning purposes.
This library is part of the MSX fR3eL Project.
Enjoy it!
- Small Device C Compiler (SDCC) v3.9 http://sdcc.sourceforge.net/
- Hex2bin v2.5 http://hex2bin.sourceforge.net/
I want to give a special thanks to all those who freely share their knowledge with the MSX developer community.
- Avelino Herrera > WEB
- Nerlaska > Blog
- Marq/Lieves!Tuore > Marq Lieves!Tuore
- Fubukimaru gitHub > Blog
- Andrear > Blog
- Ramones > MSXblog - MSXbanzai
- Sapphire/Z80ST > WEB
- BitVision > youTube
- Eric Boez > gitHub
- MSX Assembly Page > WEB
- Portar MSX Tech Doc > WEB
- MSX Resource Center > WEB
- Karoshi MSX Community (RIP 2007-2020)
- BlueMSX emulator >> WEB
- OpenMSX emulator >> WEB
- Meisei emulator >> ?
Label | value |
---|---|
CURSORKEYS | 0 |
JOYSTICKA | 1 |
JOYSTICKB | 2 |
Label | value |
---|---|
JOYSTICK_INACTIVE | 0 |
JOYSTICK_UP | 1 |
JOYSTICK_UP_RIGHT | 2 |
JOYSTICK_RIGHT | 3 |
JOYSTICK_DOWN_RIGHT | 4 |
JOYSTICK_DOWN | 5 |
JOYSTICK_DOWN_LEFT | 6 |
JOYSTICK_LEFT | 7 |
JOYSTICK_UP_LEFT | 8 |
Label | value |
---|---|
SPACEBAR_BUTTON | 0 |
KEYBOARD_BUTTON | 0 |
JOYSTICKA_BUTTONA | 1 |
JOYSTICKB_BUTTONA | 2 |
JOYSTICKA_BUTTONB | 3 |
JOYSTICKB_BUTTONB | 4 |
Label | value |
---|---|
BUTTON_UNPRESSED | 0 |
BUTTON_PRESSED | -1 |
Returns the joystick status.
char STICK(char joy)
[char] cursor/joystick device number
[char] state value
value | state |
---|---|
0 | inactive |
1 | up |
2 | up & right |
3 | right |
4 | down & right |
5 | down |
6 | down & left |
7 | left |
8 | up & left |
char joyval;
joyval = STICK(JOYSTICKA);
if (joyval!=JOYSTICK_INACTIVE){
switch (joyval)
{
case JOYSTICK_UP:
moveUp();
break;
case JOYSTICK_RIGHT:
moveRight();
break;
case JOYSTICK_DOWN:
moveDown();
break;
case JOYSTICK_LEFT:
moveDown();
break;
}
}
Returns the trigger status.
signed char STRIG(char joy)
[char] cursor/joystick button identifier
value | button |
---|---|
0 | space key |
1 | button 1 joy A |
2 | button 1 joy B |
3 | button 2 joy A |
4 | button 2 joy B |
[signed char] status value
value | description |
---|---|
0 | inactive |
-1 | when the space key or the joystick/mouse button is pressed down |
signed char press;
press = STRIG(KEYBOARD_BUTTON); //spacebar
if (press==BUTTON_UNPRESSED) press = STRIG(JOYSTICKA_BUTTONA);
if (press==BUTTON_PRESSED) Fire();