| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Joystick Reading |
Hello All,
I have been using this code for reading the Joystick under Dos But I don't
think it is valid under OS/2 at least EMX/GCC reports errors about
undefined symbols. Can anyone point out what is the problem with it as it
is?
typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL;
#define BOOL(x) (!(!(x)))
struct joystick {
LOGICAL switch_0;
LOGICAL switch_1;
LOGICAL switch_2;
LOGICAL switch_3;
int pos_Ax;
int pos_Ay;
int pos_Bx;
int pos_By;
};
LOGICAL read_joystick(VOID)
{
union REGS regs;
regs.h.ah = 0x84; /* Read the switches */
regs.x.dx = 0;
int86(0x15, ®s, ®s);
if (regs.x.cflag)
return ERROR;
JoyStick.switch_0 = BOOL(regs.h.al & 0x10);
JoyStick.switch_1 = BOOL(regs.h.al & 0x20);
JoyStick.switch_2 = BOOL(regs.h.al & 0x40);
JoyStick.switch_3 = BOOL(regs.h.al & 0x80);
regs.h.ah = 0x84; /* Read positions */
regs.x.dx = 1;
int86(0x15, ®s, ®s);
if (regs.x.cflag)
return ERROR;
JoyStick.pos_Ax = regs.x.ax;
JoyStick.pos_Ay = regs.x.bx;
JoyStick.pos_Bx = regs.x.cx;
JoyStick.pos_By = regs.x.dx;
return 0;
}
--- Maximus/2 3.01
* Origin: Blue_Moon BBS ----> 00:00 to 05:00 Hrs Only! (1:153/9115)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1 @PATH: 153/9115 970 752 716 920 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.