If you are still using the old URL (datacrystal.romhacking.net), please update your bookmarks! The old URL may stop working at any time.
The current URL is datacrystal.tcrf.net.
The current URL is datacrystal.tcrf.net.
Buck Rogers - Countdown to Doomsday/ROM map
Jump to navigation
Jump to search
The following article is a ROM map for Buck Rogers - Countdown to Doomsday.
Compression
A compression algorithm is used for most data (gfx, tilemaps, text). It's a variable length encoding, where a code can refer to a regular unencrypted data, or a reference to previous decrypted data.
Description on an example
At the beginning, a new element is 8 or 9 bits. If the value on 8 bits is in a certain range, it's considered as a single regular character. If it's outside, it's an entry in a dictionary coded on 9 bits, so one more bit is read and placed before the 8 bits already read.
The range for regular characters shifts at each new character read. It starts with 0x02 - 0xff.
Let's take the piece of text at 0x433bf:
59 4F 55 20 4A 4F 49 4E 45 44 20 09 A7 90 2A 07 51 92 51 D2 15 03 E9 08 A4 0A 48 29 A4 09 A8 A9 C8 28 68 A5 C4 00 28 25 05 48 66 84 8A 11 47 20 21 29 24 A2 A3 05 48 01 11 78 CD 0D 21 25 0D 05 1D 3D 48 BE A6 A0 45 45 28 20 D5 0B 80 02 72 28 A6 A8 90 20 24 10 4A 63 0A 28 82 40 44 22 95 8A
- 1st 8bits are 0b01011001=0x59 ; range is 0x02 - 0xff so it's a regular character: 0x59
- 2nd 8bits are 0b01001111=0x4f ; range is 0x03 - 0xff so it's a regular character: 0x4f
- 3rd 8bits are 0b01010101=0x55 ; range is 0x04 - 0xff so it's a regular character: 0x55
- 4th 8bits are 0b00100000=0x20 ; range is 0x05 - 0xff so it's a regular character: 0x20
- 5th 8bits are 0b01001010=0x4a ; range is 0x06 - 0xff so it's a regular character: 0x4a
- 6th 8bits are 0b01001111=0x4f ; range is 0x07 - 0xff so it's a regular character: 0x4f
- 7th 8bits are 0b01001001=0x49 ; range is 0x08 - 0xff so it's a regular character: 0x49
- 8th 8bits are 0b01001110=0x4e ; range is 0x09 - 0xff so it's a regular character: 0x4e
- 9th 8bits are 0b01000101=0x45 ; range is 0x0a - 0xff so it's a regular character: 0x45
- 10th 8bits are 0b01000100=0x44 ; range is 0x0b - 0xff so it's a regular character: 0x44
- 11th 8bits are 0b00100000=0x20 ; range is 0x0c - 0xff so it's a regular character: 0x20
- 12th 8bits are 0b00001001=0x09 ; range is 0x0d - 0xff, we're outside: it's a special code, and one more bit is read and placed before the 8 bits. Next bit is 1 (first bit of 0xa7) so the special code is 0b100001001=0x109
- 13th 8 bits are 0b01001111=0x4f (last 7 bits of 0xa7 and first bit of 0x90) ; range is 0x0e-0xff so it's a regular character: 0x4f
Eventually, the special code range will be 0xff-0xff.