VOGONS


Gameport devices changing PC speed?

Topic actions

First post, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie

This afternoon, the weirdest thing ever just happened.

I decided to try and get Lotus 3 working on my P3 rig. I tried that before and it didn't work, but I figured I could try harder.
On my P2-350, the game ran just fine with no slowdown tools. Now that I have upgraded it with a P3, overclocked to 616MHz (just to run Quake3, really), I get some invalid opcode error when starting the game. Now with most games I can slow the CPU down using FDAPM, but on this particular game, last time I tried, the speed is not constant, it will run but with a "hiccup" every second or so. The music slows down with the rest of the game. On higher FDAPM settings, the game just slows down altogether.

Now I tried it again this afternoon, with FDAPM, and to my surprise it worked flawlessly! No hiccups or anything like that, it just worked. I decided to race a lap, using the steering wheel of course. I still had the Gamepad Pro and PC Gamepad plugged in. The moment I disconnected them, the game and music suddenly slowed down to about half speed! Plugged in the wheel, still slow, plugged the Gamepads back in, and it ran at full speed again!

So I tried a few combinations:
- Gamepad Pro + PC Gamepad = full speed
- Gamepad Pro + steering wheel = full speed
- Gamepad Pro only = half speed
- PC Gamepad only = half speed
- Steering wheel only = half speed

Apparently I need to have two gameport devices connected to play this game on this CPU... That's certainly weird isn't it?

Just sharing this info with you guys... It might be useful for other games as well. Anyone knows what could cause this, anyway?

edit: small detail.. I used Throttle this time instead of FDAPM.

Reply 2 of 37, by idspispopd

User metadata
Rank Oldbie
Rank
Oldbie

The only thing I can think of is that reading from gameport devices is usually done by polling (I don't know if it is also possible to poll the port in intervals and use a timer, might lose precision this way). So polling the gameport uses CPU time which would slow down the system - and the absolute time used by polling is not dependent on the CPU speed.

But since your problem is fixed it may have been another problem.

Reply 3 of 37, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie

But why would polling take longer if there's nothing connected at all? And why does it take just as long with 0 or 1 devices connected, but not with 2?

I'm uploading a video right now to show you what happens.

Reply 5 of 37, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie

Polling takes longer when no device is attached because they way joystick polling works is the program writes a value to an I/O address, then counts how often it has to read the I/O address before the X/Y bit changes. That count then is the X and Y position, respectively. Without a device attached, the bit never changes, so the game waits either forever (resulting in a complete lock-up) or until the counter has reached an implausibly high value, typically a 16-bit rollover (at the 65,536th port read, the counter goes from 65,535 to 0).

Any joystick-supporting game will poll both joystick ports upon game start. If the reading counter rolls over, it will conclude that no device is attached, and the port will no longer be polled; if it does not roll over but produces a value, it will conclude that a joystick is attached and continuously poll it.

Well-written games will accept a joystick disconnect after the game has started by ceasing to poll whenever a counter rollover occurs. Lotus 3 apparently only checks for counter rollover upon program start, not later. Since a 16-bit rollover does take a few microseconds on legacy systems, this produces a noticeble slowdown, as the game will spend half of its time just waiting for a non-existent joystick response.

Reply 6 of 37, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie

Ah, now that makes sense. I thought the joystick port would just return an absolute value with the current positions. But then I have never programmed anything with the gameport so I didn't know that.

But it seems the game doesn't even check on startup if there are any controllers present. Even when starting the game with no controllers connected, it still runs slowly. As soon as I connect both controllers it speeds up again. The controls for both players are now set to the keyboard so it has no business checking the gameport anyway.

So I guess the only way to run this game now is to have two controllers connected at all times. Now I was wondering, would there be any other games suffering from the same problem, and would connecting something to the gameport be able to fix it?

Reply 7 of 37, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie

I was going to say to deselect the joystick in the game's control menu, but you wrote that you have already done that. Try deleting the config file altogether and see if that makes any difference.

Now I was wondering, would there be any other games suffering from the same problem

I'm not aware of any. It would seem like a good programming practice to give up on a device after you notice that you're not getting a response.

Reply 8 of 37, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

I hears that throttle introduces joystick drift. Can you observe the same behaviour without throttle?

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 9 of 37, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie
NewRisingSun wrote:

I was going to say to deselect the joystick in the game's control menu, but you wrote that you have already done that. Try deleting the config file altogether and see if that makes any difference.

That didn't do anything either. But it's not much of a problem really, just keep two controllers plugged in and it runs fine. It's just a bit odd.

NewRisingSun wrote:

I'm not aware of any. It would seem like a good programming practice to give up on a device after you notice that you're not getting a response.

True, but there might have been more lazy programmers around back then 😀

Mau1wurf1977 wrote:

I hears that throttle introduces joystick drift. Can you observe the same behaviour without throttle?

Without Throttle this game just crashes on the P3. I'd have to put the P2 back in to check that, but I don't remember it making any difference. I guess Throttle makes the port read take much longer or something, so this 'bug' in the game becomes noticable.

And what do you mean by 'joystick drift' exactly? That the joystick position starts drifting towards one side over time? I'd have to check that with some other game. Lotus does not show the exact joystick position, not even in the calibration screen.

Reply 12 of 37, by Calvero

User metadata
Rank Member
Rank
Member

Which version of Lotus 3 are you using? The game shows its version number when you quit the game. There are at least three version: version 14/07/93, 15/09/93 and 24/02/94.
Maybe a newer version doesn't have this gameport problem.

Reply 14 of 37, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

Are you using FreeDOS on that machine?

There are too many other variables IMO. Test with DOS 6.22 and no overclocking to be sure.

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 15 of 37, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie
Mau1wurf1977 wrote:

Are you using FreeDOS on that machine?

There are too many other variables IMO. Test with DOS 6.22 and no overclocking to be sure.

There aren't that many variables... It didn't do this with the P2-350 at stock speed and without using Throttle. So either the P3 does something different, overclocking the FSB messes something up, or Throttle slows down the port reading (or something else) too much.

Now I must say, even though Throttle does a good job of slowing the whole system down, it slows things down a bit.. inconsistently? Or whatever it's called.
For example, on the first Throttle setting, which is supposed to be 87.5% of full power, just a simple DIR or LS command already takes a few seconds, while without Throttle both commands are executed instantly. Resetting the soundcard using SETUPSA /S even takes a few minutes instead of two seconds. So I think it's just caused by using Throttle. Apparently there are no perfect slowdown tools.

I could try it without overclocking, although I recall this game already refused to run on a stock P3-450.
Using DOS 6.2 is not possible, I don't have it and last time I checked it was still not freeware.

Reply 16 of 37, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

The thing will throttle is that it disabled L1 cache. Now on a P3-340 that will give you a 386SX 16MHz if you have fast RAM. What you could do is just disable L1 cache in BIOS and skip using throttle.

I might try the game on my Time-Machine but it's not available on GOG.com yet I believe.

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 17 of 37, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie

I recall that I already tried it with disabled cache, but the game just slowed down way too much. Have to try that again with two controllers connected, maybe that will 'fix' it as well.

edit: Yes... that did the trick. It runs fine now with the CPU cache disabled. Disconnecting the controllers will still slow it down though.

BUT, disabling the cache does seem to work better than Throttle now. With Throttle, the game runs fine on single player mode but with two players it is waaay too slow. With the cache disabled, that problem is fixed, and from what I can tell both modes run at about the same speed now!

Calvero wrote:

Which version of Lotus 3 are you using? The game shows its version number when you quit the game. There are at least three version: version 14/07/93, 15/09/93 and 24/02/94.
Maybe a newer version doesn't have this gameport problem.

Mine shows 15/09/93. Do you know where I can get the newer version? Is there a patch available somewhere?

Reply 18 of 37, by Mau1wurf1977

User metadata
Rank l33t++
Rank
l33t++

Yea if you run 3dbench you will likely get a very low score of 6. That's why I recommend a Socket 7 platform for a MS-DOS Time-Machine. The Pentium 3 is either very fast or frustratingly slow with nothing in the middle.

My website with reviews, demos, drivers, tutorials and more...
My YouTube channel

Reply 19 of 37, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie

I have just run Lotus III version 14/07/93 on a Pentium II DOS machine with no joysticks attached at all. The music played at the correct speed. I did not use any slowdown utility; I first successfully ran it with the CPU's internal cache disabled, then at full speed after figuring out how to patch away the "invalid opcode error" (actually a divide overflow): open LOTUS.DAT with a hex editor, search for FB F7 F1 and replace with FB 90 90. It worked correctly (as far as I can tell) with that change applied at full machine speed.

Have you tried running the game on a different machine, with a different game controller card or at least with a different joystick cable? It's not out of the question that either the controller card or the cable might give the game false positives by reporting sponanteous bit changes.