VOGONS

Common searches


First post, by jal

User metadata
Rank Oldbie
Rank
Oldbie

I have a problem that many old DOS games (LoadRunner, Qubert, Jumping Joe) seem to detect a joystick while I do not have one attached to my (Windows 2000) PC, nor can I find a joystick device in the control panel that I could disable. I've searched the forum for an answer, but I can only find questions about disabling joystick in DOSbox when a joystick is plugged in.

JAL

Reply 1 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

well those really old games have a joystick detection system which is incompatible with dosbox.

I debugged loderunner lately to figure it out.

what they do is one write to the joystick port
one read.
delay
read again.

finished. (and compares the 2 reads and if they are the same => no joystick)
this is incompatible in dosbox.
as dosbox wants games to use this:

write
read
short delay
read
short delay
etc till the the read changes.

The second way is actually the recommended way for reading joysticks.
The first way is a very crude way and very hard in dosbox as in dosbox the delays aren't the same if you change the amount of cpu cycles

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 4, by jal

User metadata
Rank Oldbie
Rank
Oldbie
Qbix wrote:

The first way is a very crude way and very hard in dosbox as in dosbox the delays aren't the same if you change the amount of cpu cycles

I understand. But if no joystick is attached at all, shouldn't DOXbox return 0xff on reading the port, as if the PC doesn't have a game port at all? Thus the games would have two same values (0xff) and thus would detect no joystick.

JAL

Reply 3 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

hmm are you using the cvs or 63 ?
shouldn't matter it's odd as dosbox should return 0xff if no joystick is present.

this is the code in 0.63

static Bitu read_p201(Bitu port,Bitu iolen) {
/** Format of the byte to be returned:
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +-------------------------------+
** | | | | | | | |
** Joystick B, Button 2 ---+ | | | | | | +--- Joystick A, X Axis
** Joystick B, Button 1 -------+ | | | | +------- Joystick A, Y Axis
** Joystick A, Button 2 -----------+ | | +----------- Joystick B, X Axis
** Joystick A, Button 1 ---------------+ +--------------- Joystick B, Y Axis
**/
Bit8u ret=0xff;
if (stick[0].enabled) {
if (stick[0].xcount) stick[0].xcount--; else ret&=~1;
if (stick[0].ycount) stick[0].ycount--; else ret&=~2;
if (stick[0].button[0]) ret&=~16;
if (stick[0].button[1]) ret&=~32;
}
if (stick[1].enabled) {
if (stick[1].xcount) stick[1].xcount--; else ret&=~4;
if (stick[1].ycount) stick[1].ycount--; else ret&=~8;
if (stick[1].button[0]) ret&=~64;
if (stick[1].button[1]) ret&=~128;
}
return ret;
}

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 4, by jal

User metadata
Rank Oldbie
Rank
Oldbie
Qbix wrote:

hmm are you using the cvs or 63 ?

63. And as said, I cannot play Loderunner, and must manually switch to keyboard with Jumping Jack. The former game only allows moving to the right, the latter moves Jack to the right at high speed when not choosing keyboard. Maybe I'll try to debug one day...

JAL