Gameport devices changing PC speed?

Getting old DOS games working on modern hardware. (DOSBox topics belong in DOSBox areas below, not here).

Gameport devices changing PC speed?

Postby jwt27 » 2013-5-23 @ 23:03

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.
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-24 @ 14:49

Just tried it again... Now it only runs at full speed with the Gamepad Pro and steering wheel connected, not with the PC Gamepad.
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby idspispopd » 2013-5-24 @ 16:28

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.
idspispopd
Oldbie
 
Posts: 1210
Joined: 2012-2-15 @ 21:08
Location: Hamburg / Germany

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-24 @ 16:35

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.
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-24 @ 17:01

WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby NewRisingSun » 2013-5-24 @ 18:35

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.
NewRisingSun
Oldbie
 
Posts: 852
Joined: 2005-9-02 @ 02:26

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-24 @ 19:40

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?
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby NewRisingSun » 2013-5-24 @ 20:11

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.
NewRisingSun
Oldbie
 
Posts: 852
Joined: 2005-9-02 @ 02:26

Re: Gameport devices changing PC speed?

Postby Mau1wurf1977 » 2013-5-24 @ 22:56

I hears that throttle introduces joystick drift. Can you observe the same behaviour without throttle?
User avatar
Mau1wurf1977
l33t++
 
Posts: 7652
Joined: 2010-8-27 @ 04:15
Location: Western Australia

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-25 @ 13:35

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.
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby Davros » 2013-5-25 @ 15:17

p3 @ 616 are you overclocking the isa bus ???
Guardian of the Sacred Five Terabyte's of Gaming Goodness
User avatar
Davros
l33t
 
Posts: 2632
Joined: 2004-3-01 @ 03:08

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-25 @ 15:26

FSB is at 112MHz so I think the ISA bus goes up a bit as well.
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby Calvero » 2013-5-25 @ 21:50

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.
Calvero
Member
 
Posts: 126
Joined: 2007-8-02 @ 13:30

Re: Gameport devices changing PC speed?

Postby Davros » 2013-5-25 @ 22:01

Have you tried not overclocking
some devices dont like it causes timing issues
Guardian of the Sacred Five Terabyte's of Gaming Goodness
User avatar
Davros
l33t
 
Posts: 2632
Joined: 2004-3-01 @ 03:08

Re: Gameport devices changing PC speed?

Postby Mau1wurf1977 » 2013-5-25 @ 23:01

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.
User avatar
Mau1wurf1977
l33t++
 
Posts: 7652
Joined: 2010-8-27 @ 04:15
Location: Western Australia

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-26 @ 21:23

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.
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby Mau1wurf1977 » 2013-5-26 @ 23:35

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.
User avatar
Mau1wurf1977
l33t++
 
Posts: 7652
Joined: 2010-8-27 @ 04:15
Location: Western Australia

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-26 @ 23:49

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?
WANTED - Manuals/drivers for:
  • Tecmar Graphics Master
  • Paradise Autoswitch EGA 350 (EGA1A)
User avatar
jwt27
Oldbie
 
Posts: 1628
Joined: 2011-8-15 @ 02:19
Location: Fryslân

Re: Gameport devices changing PC speed?

Postby Mau1wurf1977 » 2013-5-27 @ 06:07

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.
User avatar
Mau1wurf1977
l33t++
 
Posts: 7652
Joined: 2010-8-27 @ 04:15
Location: Western Australia

Re: Gameport devices changing PC speed?

Postby NewRisingSun » 2013-5-27 @ 14:52

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.
NewRisingSun
Oldbie
 
Posts: 852
Joined: 2005-9-02 @ 02:26

Next

Return to DOS

Who is online

Users browsing this forum: No registered users and 2 guests