VOGONS


Keen 4-5-6 choppy scrolling on EGA card

Topic actions

Reply 40 of 68, by dr.zeissler

User metadata
Rank l33t
Rank
l33t
Scali wrote:

An A2000 is a Commodore Amiga 2000.
An A2286/8 is a bridgeboard for the Amiga 2000, which contains a 286 CPU at 8 MHz for PC compatibility.
The Q700 is an Apple MacIntosh Quadra 700 I assume, given that he speaks of NuBus cards. NuBus was the expansion port on old Macs.

100% right scali.

Thx for the ccaves_test, I will test it soon.

Retro-Gamer 😀 ...on different machines

Reply 41 of 68, by Cga.8086

User metadata
Rank Member
Rank
Member
K1n9_Duk3 wrote:
I've finished the patches for keropi. See attached files. […]
Show full quote

I've finished the patches for keropi. See attached files.

Please note that these patches only work for one specific version of each game. That's version 1.4 (Apogee release) for Keen 4 and 5, and version 1.5 for Keen 6.

First of all, download CKPatch v0.11.3 here.

Download my patch scripts, then extract my patch scripts (PATCH?.TXT and CK?.BAT) into the game's directory. Also copy the corresponding CK?PATCH.EXE into that directory. To play the game, simply run the CK?.BAT file.

I'm not sure what happens when you try to run these patches on the wrong game version, so make sure you're using the correct version of the game when trying to run these patches. If I understand the syntax correctly, the patch scripts should only modify the code of the correct EXE, so if you try to run it on version 1.0, it should not change anything, but I haven't actually tested this.

By the way, I added the original assembly code as comments in the patch file, so you can see what's going on in the screen update code. If you know a bit about programming in assembly, you should be able to modify the patch for better results on your system.

Edit: If CKPatch shows an "unrecognized version" error, try unpacking the executable with UNP or UNLZEXE.

thanks, my card is a radeon 7000 PCI, and i really like it because the pc has no agp port
you think the patch will work? or it is only for fixing matrox issues

Reply 42 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

If your system has issues with the scrolling in Keen 4-6, why don't you just try the patch (or the Keen 4 demo on which the patch is based) and see for yourself?

There's no way for me to tell if the patch will fix the issue on your system. I don't even know if your system has any problems running these games to begin with.

Reply 43 of 68, by orbifant

User metadata
Rank Newbie
Rank
Newbie
K1n9_Duk3 wrote:

I've finished the patches for keropi. See attached files.

Can also confirm, this works for my Matrox G450 PCI as well. Thank you very much, this was most annoying and disappointing to discover after I finished my system. Glad this tearing is gone now.

I wonder if you @K1n9_Duk3 could provide another patch for Keen 6 V1.4 or if you could give a hint on how you got the offset address for VW_SetScreen?

Reply 44 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

Here's a modified patch script for Keen 6 (EGA) v1.4:

%ext ck6
%version 1.4

#replace the v1.4 delay code with the screen update code from the Keen 4 v1.0 demo
%patch $1E713
$55 # push bp
$8B $EC # mov bp, sp
$BA $DA $03 # mov dx, 3DAh
$FA # cli
# l1:
$EC # in al, dx
$A8 $01 # test al, 1
$74 $FB # jz l1
# l2:
$EC # in al, dx
$A8 $01 # test al, 1
$75 $FB # jnz l2
$8B $4E $06 # mov cx, [bp+arg_start]
$BA $D4 $03 # mov dx, 3D4h
$B0 $0C # mov al, 0Ch
$EE # out dx, al
$42 # inc dx
$8A $C5 # mov al, ch
$EE # out dx, al
$4A # dec dx
$B0 $0D # mov al, 0Dh
$EE # out dx, al
$8A $C1 # mov al, cl
$42 # inc dx
$EE # out dx, al
$C7 $06 $44 $EA $00 $00 # mov intcount, 0
# l3:
$8B $16 $44 $EA # mov dx, intcount
$83 $FA $09 # cmp dx, 9
$73 $19 # jnb l4
$FB # sti
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$FA # cli
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$90 # nop
$BA $DA $03 # mov dx, 3DAh
$EC # in al, dx
$A8 $08 # test al, 8
$74 $DE # jz l3
# l4:
$BA $C0 $03 # mov dx, 3C0h
$B0 $33 # mov al, 33h
$EE # out dx, al
Show last 12 lines
	$EB $00			#	jmp	$+2
$8A $46 $08 # mov al, [bp+arg_pan]
$EE # out dx, al
$FB # sti
$5D # pop bp
$CB # retf

#replace the start of VW_SetScreen() with a jump into the old code (see above)
%patch $1E794
$E9 $7C $FF

%end

Reply 45 of 68, by orbifant

User metadata
Rank Newbie
Rank
Newbie
K1n9_Duk3 wrote:
Here's a modified patch script for Keen 6 (EGA) v1.4: […]
Show full quote

Here's a modified patch script for Keen 6 (EGA) v1.4:

%ext ck6
...

Thank you very much. Works fine as expected 😀

Reply 46 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

You're welcome. And thanks for the feedback.

Reply 47 of 68, by vorob

User metadata
Rank Oldbie
Rank
Oldbie

Any chance to just upload patched full versions of games? Thx!

Reply 48 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

I'm most definitely not going to upload full versions of these games, neither patched nor unpatched. That would be illegal.

The point of using these patch scripts instead of providing fully patched executables is that the patching program can check if your game version matches the version the patch was made for. The graphics, sound and map files for these games are compressed and all the information necessary to decompress them is stored in the executable itself. This information varies for each game version, so copying a v1.4 executable into a non-v1.4 game folder will cause all kinds of issues.

If you need fully patched executables, then you need to use my patching utility and modify the patch scripts a little. Instead of the %ver and %ext commands, you need to enter one of the following at the beginning of the patch script:

#Keen 4 v1.4:
%exefile keen4e.exe 251712

#Keen 5 v1.4:
%exefile keen5e.exe 254832

#Keen 6 v1.4:
%exefile keen6.exe 260432

#Keen 6 v1.5:
%exefile keen6.exe 259632

Please take a look at this. The archive contains a set of slightly different patch scripts, which fix some display issues commonly seen in DOSBox (at the default settings) as well as on certain hardware. According to keropi, these new patches also fix the choppy scrolling issues on his EGA cards. Remember to edit the script files as mentioned above if you want to create fully patched executables with my patching utility.

If you don't trust the targeted patching utilities, then I guess providing fully patched executables for download (which would still be illegal) is not going to solve that problem.

Reply 49 of 68, by Scandy

User metadata
Rank Member
Rank
Member

Hello, Golden Axe (DOS version) has also choppy scrolling on some PCI video cards. May I ask if it is possibile to deliver a patch of the same kind?
Thank you!

THE NIGHTLAND is my board + video game for Commodore 64.

Reply 50 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

I'd rather not. I don't own Golden Axe for the PC and I know nothing about its code. To write a fix like this, I would have to reverse engineer large portions of the game code to find out which code is responsible for the scrolling and what code would be safe to overwrite with new code for the fix. That patch would only work on one very specific version of the game's executable and I would assume that mutltiple slightly different versions of the executable exist.

It was relatively easy to do this for the Keen games, since their game engine is amlost identical to the code used in Catacomb 3D and the Catacomb 3D source code has been released to the public.

Reply 51 of 68, by Scandy

User metadata
Rank Member
Rank
Member

Well, the patch works GREAT on my HP T5710. Thank you very much sir (and Merry Christmas!)

THE NIGHTLAND is my board + video game for Commodore 64.

Reply 52 of 68, by TheFiend

User metadata
Rank Newbie
Rank
Newbie

Hello and awesome work on creating a patch for the Keen games! I've always had issues running these games on my computers over the years but I've finally settled on a computer now on which I don't have this scrolling issue anymore with any of the Keen games (I'm using the Steam versions).

However, I'm having this choppy scroll issue with the Dangerous Dave games (2 and 3 specifically; I haven't tested 4 yet as I can't find it right now). The screen jitters pretty hard in real DOS mode when scrolling whilst the jitter is fairly low but still apparent when playing the Dave games under Windows 98SE. I'm playing these games on a fairly new machine (hp t5720 thin client). In your opinion, could Dave 2, 3 and 4 be patchable?

I personally find it very odd that the Keen games are showing no issues for me but the concerned Dave games are considering that they are using the same engine as Keen Dreams which works perfectly on my computer.

Reply 53 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

The technology in Dave 3 and 4 is relatively close to what was used in Keen Dreams, but there are a few differences. I think the most important one is that Dave 3 and 4 will run at up to 70 fps while Keen Dreams is capped at 35 fps (as are Keen 4-6). Since you're using a relatively fast machine, the games will most likely run at the maximum frame rate. This will lead to some slight issues, meaning that the game is calculating everything so fast that it ends up initiating a page flip and then drawing to the screen while the page that is being written to is actually still being displayed.

Dave 2 is (in many ways) caught in between Keen 1-3 and Keen Dreams, meaning that the screen refresh code has little to nothing in common with Keen 1-3 and has not quite reached the more refined code of Keen Dreams and the later games. From what I've seen, Dave 2 also seems to be able to run at 70 fps, just like Dave 3 and 4.

This should be relatively easy to fix for Dave 3 and 4 by setting the frame limit to 35. Fixing Dave 2 would be trickier, as it doesn't seem to have any code in it that could be used to reduce the frame limit to anything less than 70.

But before I can attempt to do any of that, I'll need to know exactly which versions of these games you own. And if you happen to own some obscure versions, I might need you to send my your executables for analysis.

Reply 54 of 68, by TheFiend

User metadata
Rank Newbie
Rank
Newbie
K1n9_Duk3 wrote on 2021-03-09, 00:33:
The technology in Dave 3 and 4 is relatively close to what was used in Keen Dreams, but there are a few differences. I think the […]
Show full quote

The technology in Dave 3 and 4 is relatively close to what was used in Keen Dreams, but there are a few differences. I think the most important one is that Dave 3 and 4 will run at up to 70 fps while Keen Dreams is capped at 35 fps (as are Keen 4-6). Since you're using a relatively fast machine, the games will most likely run at the maximum frame rate. This will lead to some slight issues, meaning that the game is calculating everything so fast that it ends up initiating a page flip and then drawing to the screen while the page that is being written to is actually still being displayed.

Dave 2 is (in many ways) caught in between Keen 1-3 and Keen Dreams, meaning that the screen refresh code has little to nothing in common with Keen 1-3 and has not quite reached the more refined code of Keen Dreams and the later games. From what I've seen, Dave 2 also seems to be able to run at 70 fps, just like Dave 3 and 4.

This should be relatively easy to fix for Dave 3 and 4 by setting the frame limit to 35. Fixing Dave 2 would be trickier, as it doesn't seem to have any code in it that could be used to reduce the frame limit to anything less than 70.

But before I can attempt to do any of that, I'll need to know exactly which versions of these games you own. And if you happen to own some obscure versions, I might need you to send my your executables for analysis.

Thanks for the response. These are very old copies that I've had in my possession for decades. I will try to find the exact version and if I'm unable to then I'll send over my executables to you.

EDIT: I tried finding the versions of my games but didn't succeed. I'm unable to DM you with the executables since I don't have enough posts on the forum yet.

EDIT 2: I’m now using the GOG version of the games and am seeing the same choppy results. I also replayed Keen 1, 2 and 3 right now and it appears that the scrolling in these games is extremely choppy too in real DOS mode. I guess I was playing them under Windows 98SE earlier when I said it was fine. On the other hand Keen 4 and 5 are just perfectly fine (Steam version doesn’t have 6 I guess since I don’t have it).

Reply 55 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

I also have the Dave Pack on GOG, so you don't have to send me any executables for those versions. Dave 3 and 4 should be easy 1-Byte-fixes, assuming that Keen Dreams actually does work fine on your system, anything else may take a little longer.

Reply 56 of 68, by TheFiend

User metadata
Rank Newbie
Rank
Newbie
K1n9_Duk3 wrote on 2021-03-09, 22:20:

I also have the Dave Pack on GOG, so you don't have to send me any executables for those versions. Dave 3 and 4 should be easy 1-Byte-fixes, assuming that Keen Dreams actually does work fine on your system, anything else may take a little longer.

Yep I went through Keen Dreams again and beat the first 2 levels with absolutely no graphical hiccups. It seems to be running flawlessly strangely enough.

Reply 57 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

Alright, then you might as well try these patches for Dave 3 and 4:

# Dangerous Dave 3 - Dave's Risky Rescue v1.00 (Rev 1.04):
%exefile DAVE.EXE 207760
%patch $1451D $02 # set minimum frame time to 2 tics at 70 Hz (=> 35 fps)

# Dangerous Dave 3 - Dave's Risky Rescue v1.01 (Rev 3):
%exefile DAVE.EXE 208432
%patch $146A3 $02 # set minimum frame time to 2 tics at 70 Hz (=> 35 fps)

# Dangerous Dave 4 - Dave Goes Nutz! v1.01 (Rev 1):
%exefile DAVEGAME.EXE 195136
%patch $14031 $02 # set minimum frame time to 2 tics at 70 Hz (=> 35 fps)

%end

Copy them into a plain text file and open that file with my patching utility, then follow the instructions. For Dave 4, you will probably have to overwrite the old DAVEGAME.EXE file, otherwise you won't be able to run the patched version. Remember to create backups before messing with your files.

The GOG release has version 1.01 of Dave 3 and 4. You can check which version you have by running the executable with the "/ver" parameter.

With these patches, you will get an error message for at least one of the DAVE.EXE files. That's just because I have patches for both versions known to me at this point. The one that doesn't match your DAVE.EXE will cause the error message.

Reply 58 of 68, by TheFiend

User metadata
Rank Newbie
Rank
Newbie
K1n9_Duk3 wrote on 2021-03-10, 21:57:
Alright, then you might as well try these patches for Dave 3 and 4: […]
Show full quote

Alright, then you might as well try these patches for Dave 3 and 4:

# Dangerous Dave 3 - Dave's Risky Rescue v1.00 (Rev 1.04):
%exefile DAVE.EXE 207760
%patch $1451D $02 # set minimum frame time to 2 tics at 70 Hz (=> 35 fps)

# Dangerous Dave 3 - Dave's Risky Rescue v1.01 (Rev 3):
%exefile DAVE.EXE 208432
%patch $146A3 $02 # set minimum frame time to 2 tics at 70 Hz (=> 35 fps)

# Dangerous Dave 4 - Dave Goes Nutz! v1.01 (Rev 1):
%exefile DAVEGAME.EXE 195136
%patch $14031 $02 # set minimum frame time to 2 tics at 70 Hz (=> 35 fps)

%end

Copy them into a plain text file and open that file with my patching utility, then follow the instructions. For Dave 4, you will probably have to overwrite the old DAVEGAME.EXE file, otherwise you won't be able to run the patched version. Remember to create backups before messing with your files.

The GOG release has version 1.01 of Dave 3 and 4. You can check which version you have by running the executable with the "/ver" parameter.

With these patches, you will get an error message for at least one of the DAVE.EXE files. That's just because I have patches for both versions known to me at this point. The one that doesn't match your DAVE.EXE will cause the error message.

Thanks for these! I'll try these out tonight and let you know of the outcome.

UPDATE: So I tried these and unfortunately I’m still getting the jittering issue on both versions of Dave 3 as the script file. I also face the jitter issue in Dave 4 although in Dave 4 before the first level starts, the display does indeed seem to go off for a second (perhaps to switch the framerate).

Reply 59 of 68, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

That doesn't really make sense. With these patches applied, the basic frame timing in Dave 3 and 4 should be more or less the same as in Keen Dreams, and the code that updates the CRTC start and panning registers of the video card (i.e. what actually makes the scrolling happen) is exactly the same in Keen Dreams and Dave 3 and 4. It could still have something to do with the frame timing, but then you should also get to see some issues in Keen Dreams from time to time (while walking around on the world map, for example).

The only suggestion I can give is to make sure that you are actually using the patched executables and not the original files.

It might help if you could record some video footage that shows these issues in action. That could tell me whether the issue lies with the CRTC start and panning registers or the drawing code.