VOGONS


First post, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

Here is a fix that will help you if you're trying to run Crystal Caves and/or Secret Agent on a real DOS PC and the display is only showing you vertical lines that stretch from the top of the screen all the way to the bottom, like in the following screenshot:

The attachment cc1-bug.png is no longer available

Copy the following script and save it as a plain text file. Then get my patching utility and open the text file with it. Follow the instructions to patch the games' executables.

Note that there are at least two slightly different versions of CC1.EXE floating around. Both versions are supported by this patch, so it is completely normal to get one error message saying that the size of CC1.EXE doesn't match during the patching process. If you don't have all of these games, simply click "Cancel" when the program asks you to open an executable that you don't have. The program will continue with the other executales in the script.

This patch script will work on version 1.0 as well as version 1.0a of both games (1.0a is really just a hacked up v1.0, where two bytes have been changed to prevent the game from setting the date back to the 1900's).

%exefile cc1.exe 184304
%patch $28C6C
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
$B0 $13 # mov al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%exefile cc1.exe 184288
%patch $28C5C
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
$B0 $13 # mov al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%exefile cc2.exe 183296
%patch $2887C
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
$B0 $13 # mov al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%exefile cc3.exe 189472
%patch $2A09C
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
$B0 $13 # mov al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%exefile sam1.exe 188768
%patch $29E16
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
$B0 $13 # mov al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%exefile sam2.exe 189744
%patch $2A1E6
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
Show last 18 lines
	$B0 $13		#	mov	al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%exefile sam3.exe 189792
%patch $2A216
$D1 $EB # shr bx, 1
$8A $E3 # mov ah, bl
$BA $03D4w # mov dx, 3D4h
$B0 $13 # mov al, 13h
$EF # out dx, ax
$5D # pop bp
$CA $0002w # retf 2


%end

Reply 2 of 6, by firage

User metadata
Rank Oldbie
Rank
Oldbie

This patch has fixed the games for the ET4000/W32p. Crystal Caves and Secret Agent compatibility was really the only issue that bothered me personally about these video cards previously. Very happy now - thanks again K1n9_Duk3!

(The first Apogee title screen will look more like a black screen with just a few stripes, just because there's a lot of black on that one line it draws for the entire screen. So the example shot here has a little more color going on than the bug will show at first.)

I found v1.0 executables to be preferable to the Y2K patched v1.0a. My 486's system clock runs fast using v1.0a and it stays wrong until booted, while v1.0 seems to stay accurate.

My big-red-switch 486

Reply 3 of 6, by dr.zeissler

User metadata
Rank l33t
Rank
l33t

What exactly fixes this patch of CrystalCaves and Secret Agent? The stuttering HUD or the stuttering screen?
Does your ET4000 work with dangerous-dave correctly? I get strange text-characters or a shadow if I make only one jump and it stay's until I quit the games.

Retro-Gamer 😀 ...on different machines

Reply 4 of 6, by StrikerMan780

User metadata
Rank Newbie
Rank
Newbie

This patch seems to break with SAM1.EXE 1.0 registered. Wrong size, and if you change the expected size in the script, it produces a corrupt EXE.

Reply 5 of 6, by clb

User metadata
Rank Member
Rank
Member
dr.zeissler wrote on 2020-06-02, 13:04:

What exactly fixes this patch of CrystalCaves and Secret Agent? The stuttering HUD or the stuttering screen?
Does your ET4000 work with dangerous-dave correctly? I get strange text-characters or a shadow if I make only one jump and it stay's until I quit the games.

I was curious so had a peek at disassembling CC1.exe in Reko Decompiler to see what the old code in that location was doing.

There was a programming error by the game developers that they accidentally performed 16-bit port writes to I/O ports 3D4h and 3D5h, whereas they had intended to just do 8-bit port writes to those ports.

It looks like most VGA adapters do not get confused by this too-wide write, but some rare ones do not expect to receive a 16-bit write to I/O port 3D5h, and either ignore or somehow mishandle the write.

The attachment crystal_caves_bug.png is no longer available

This patch will not fix any type of scroll stuttering, or other rendering glitches - just an issue with the screen not showing up at all correctly on certain VGA adapters that get confused by that 16-bit wide write to 3D5h that is not intentional.

Reply 6 of 6, by clb

User metadata
Rank Member
Rank
Member
StrikerMan780 wrote on 2024-08-04, 23:56:

This patch seems to break with SAM1.EXE 1.0 registered. Wrong size, and if you change the expected size in the script, it produces a corrupt EXE.

The patch does not apply itself to EXEs that have unrecognized sizes. It should not be attempted to be modified by changing the file size number, and editing the patch to change the file size number will definitely result in garbage because it was not designed to target a different EXE than what it was originally authored for.