Keen 1-3 / DDave1 RLE format

Tools, assembly, and file formats.
Post Reply
User avatar
Malvineous
Posts: 113
Joined: Sat Mar 13, 2004 12:54 am
Location: Brisbane, Australia
Contact:

Keen 1-3 / DDave1 RLE format

Post by Malvineous »

Hi all (especially Levellass),

Does anyone have any tools that can undo the RLE format used by Dangerous Dave 1, and apparently also Keen 1-3?

The reason I ask is that (prompted by the other thread) I checked to see how far I had gotten with my DDave1 editing code and realised that it's getting stuck on the last few VGA images in the tileset:

Code: Select all

0.148: Image (2048x2816)
0.149: Image (2048x2816)
0.150: Image (2048x2816)
0.151: Image (2048x2816)
0.152: Image (2048x2816)
0.153: Image (2048x2816)
0.154: Image (2048x2816)
0.155: Image (2048x2816)
0.156: Image (2048x2816)
0.157: Image (2048x2816)
For some reason there is an off-by-one error, so instead of reading the image size as "08 00 0B 00 ..." (8x12) there's an extra byte at the start of the tile, causing the data to be read as "00 08 00 0B 00 ..." resulting in massively oversized images.

My best guess is that there's something up with the RLE decoder, and it's inserting an extra byte where it's not supposed to. So if anyone has an RLE decoder for this format, does it work with vgadave.dav?

If it works, the byte at offset 0x115EA should be 08 (then 00 0B 00). My decoder puts byte 00 at this offset (followed by 08 00 0B.)

The reason I'm asking is that otherwise my decoder seems to work fine, so I'm not sure whether it's a bug in my code or whether there's something else to this file format we haven't figured out yet!
User avatar
Frenkel
Posts: 38
Joined: Sun Feb 15, 2004 10:18 am
Location: Netherlands
Contact:

Post by Frenkel »

I noticed the same. Your decoder is fine. The game does the same.
When I make a memory dump while playing Dangerous Dave in DOSBox, I can see the extra byte in the dump.
User avatar
Malvineous
Posts: 113
Joined: Sat Mar 13, 2004 12:54 am
Location: Brisbane, Australia
Contact:

Post by Malvineous »

Interesting. Glad to hear the game does the same. I tried removing the extra byte then extracting those tiles and it turns out they're the number font:
Image
Perhaps the game treats them differently? I wonder whether that initial zero byte is like a flag indicating where the font starts, or whether the offset is hard-coded? I guess I'll have to start changing the file and see what happens...
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

I believe it to be related to the cosmo offset bug where an extra byte has to be added every 64K when extracting EGA images I have KG insert an extra byte when the address to the data is above a certain value. (Though I forget which value specifically it is.) It's something to do with how the EXE reads memory.
Post Reply