Gameport devices changing PC speed?

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

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-27 @ 19:25

NewRisingSun wrote: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.


Wow, thank you so much, that fixed it! It runs without any slowdown tools now and I no longer need to have any controllers connected! And the framerate is just perfect, I don't recall this game ever running as smooth as it does now!

And you're right, I said "invalid opcode error" but that happened with some other game. Lotus crashed with a divide overflow. Is it the same bug as the well known Borland runtime error 200 that happens with certain other games?

How do you even find these fixes? I wouldn't have any idea where to look... And if I did I would probably be looking in the exe, not the dat file, lol.
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-27 @ 19:58

jwt27 wrote:and I no longer need to have any controllers connected!
But my version ran correctly even when I disabled the CPU's internal cache, while yours didn't, if I read your posts correctly. So the original issue wasn't solved, was it?
jwt27 wrote:How do you even find these fixes?
Ran the game in Microsoft CodeView; instead of bailing to DOS upon encountering the divide error, it will pause and highlight the offending machine instruction (see screenshot). You can see that to the left of the offending DIV instruction are the two bytes (F7 F1) that make up its machine code. I then searched for those two bytes in LOTUS.EXE. Finding nothing but noticing that LOTUS.EXE is extremely small, I expected that the main program code would be in LOTUS.DAT instead. Finding several instances of F7 F1 there, I took the last byte from the preceding instruction (FB) to search for the three-byte sequence FB F7 F1. Since this occurs only once in LOTUS.DAT, I knew that this would be the correct position. Now you only need to know that opcode 90 is NOP ("no operation"), so disabling the DIV instruction to avoid the divide error is as simple as replacing F7 F1 with two NOPs.

(I suppose the real hackers would be laughing their asses off if they saw that I'm using Microsoft CodeView instead of some leet debugger tool.)
jwt27 wrote:Is it the same bug as the well known Borland runtime error 200 that happens with certain other games?
I suppose so. It definitely looks like a system speed-specific calibration of some kind of Delay() library routine that does not seem to be used by the game itself.
Attachments
cv_001.png
cv_001.png (14.66 KiB) Viewed 834 times
NewRisingSun
Oldbie
 
Posts: 852
Joined: 2005-9-02 @ 02:26

Re: Gameport devices changing PC speed?

Postby Calvero » 2013-5-27 @ 20:30

jwt27 wrote:
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?


24/02/94 is the CD-ROM version. I don't think there's a patch available to update from one version to another.
Calvero
Member
 
Posts: 126
Joined: 2007-8-02 @ 13:30

Re: Gameport devices changing PC speed?

Postby 5u3 » 2013-5-28 @ 08:52

Nice fix, NewRisingSun :happy:

Now the game works on my K6-3 machine without having to disable the cache.

BTW, unlike the Borland TP lib runtime error, which only rears its head above 500 MHz on a K6-3, Lotus III always crashed on this CPU, even at low clock speeds like 120 MHz.

I never encountered any weird behaviour with the joystick though (game version 15/09/93).
User avatar
5u3
Oldbie
 
Posts: 1567
Joined: 2005-9-06 @ 12:23
Location: Vienna, Austria

Re: Gameport devices changing PC speed?

Postby jwt27 » 2013-5-28 @ 20:03

NewRisingSun wrote:But my version ran correctly even when I disabled the CPU's internal cache, while yours didn't, if I read your posts correctly. So the original issue wasn't solved, was it?

The problem is solved now it seems, it runs at full speed now regardless of how many controllers are connected. How that works, I have no idea.

NewRisingSun wrote:Ran the game in Microsoft CodeView; instead of bailing to DOS upon encountering the divide error, it will pause and highlight the offending machine instruction (see screenshot). You can see that to the left of the offending DIV instruction are the two bytes (F7 F1) that make up its machine code. I then searched for those two bytes in LOTUS.EXE. Finding nothing but noticing that LOTUS.EXE is extremely small, I expected that the main program code would be in LOTUS.DAT instead. Finding several instances of F7 F1 there, I took the last byte from the preceding instruction (FB) to search for the three-byte sequence FB F7 F1. Since this occurs only once in LOTUS.DAT, I knew that this would be the correct position. Now you only need to know that opcode 90 is NOP ("no operation"), so disabling the DIV instruction to avoid the divide error is as simple as replacing F7 F1 with two NOPs.

(I suppose the real hackers would be laughing their asses off if they saw that I'm using Microsoft CodeView instead of some leet debugger tool.)


Wow. That actually sounds pretty easy. Probably isn't if I tried it myself though XD.
That Codeview program looks useful, do you know where I can get it? (if it's freeware)

NewRisingSun wrote:I suppose so. It definitely looks like a system speed-specific calibration of some kind of Delay() library routine that does not seem to be used by the game itself.

I was just thinking it might have something to do with the gameport calibration, I'd imagine if the counter runs too fast it might miss the bit change on the gameport. Just tested that but it appears to work fine.
Also the wheel is pretty much useless in this game anyway, the steering is completely digital. I have to turn it almost all the way to one side to make the car change direction.
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 ruthan » 2018-8-16 @ 11:35

I know that this thread is old.. but i hope that someone who reads that you make to solve same problem with other games and perhaps it would be possible to write some patcher.
Here is my thread with other problematic *.exes attached..
viewtopic.php?f=61&t=61677&p=689973#p689973

Microsoft CodeView, looks nice..
Is somewhere some good tutorial how to use it, how to switch between game and debugger?
Im old goal oriented goatman, i care about facts and freedom, not about egos+prejudices. Hoarding=sickness. If you want respect, gain it by your behavior. I hate stupid SW limits, SW=virtual world, everything should be possible if you have enough HW.
User avatar
ruthan
Oldbie
 
Posts: 1094
Joined: 2013-3-07 @ 04:01
Location: Schwarz Wald-from France to Ukraine, from Denmark to Austria. Celts+German+Slavs melting pot.

Re: Gameport devices changing PC speed?

Postby ruthan » 2018-8-17 @ 09:01

I have tried to this fix on my X58 machine (floppy version) with which im able to make 97% of 170 dos games working with Yamaha or Vortex1 soundcard, details:
https://docs.zoho.com/sheet/published.d ... 2a9209e034

I can with it go ingame, intro is playing with music on Vortex1, but keyboard (PS2) is not working, i never had such problem with other game on same machine, probably other fix is needed.
Im old goal oriented goatman, i care about facts and freedom, not about egos+prejudices. Hoarding=sickness. If you want respect, gain it by your behavior. I hate stupid SW limits, SW=virtual world, everything should be possible if you have enough HW.
User avatar
ruthan
Oldbie
 
Posts: 1094
Joined: 2013-3-07 @ 04:01
Location: Schwarz Wald-from France to Ukraine, from Denmark to Austria. Celts+German+Slavs melting pot.

Re: Gameport devices changing PC speed?

Postby Scali » 2018-8-17 @ 09:29

Fun fact: In my Commodore PC10-III I had a QuickShot joystick card, which had a 3-way switch at the top, to select the CPU speed.
I suppose the idea here was that the switch change the discharge speed of the capacitors, so you could reduce CPU load, by requiring less absolute time to measure a full axis.
Still wouldn't solve the case of a disconnected device of course.
Image
Image
Scali
l33t
 
Posts: 4364
Joined: 2014-12-13 @ 14:24

Previous

Return to DOS

Who is online

Users browsing this forum: No registered users and 2 guests