The Creep File Format Explained
Under construction - your comments appreciated!
Most of the information provided in this file is based on Quark's original notes on
the file format which were used to create the levels in "The Dungeons of Dr. Creep".
I have elaborated them wherever possible. Areas where I'm uncertain about a feature or meaning
have been marked like this..
Notation
C= veterans can skip this section, as it contains only a
reiteration of obvious information :-)
- All numeric values denoted by a leading $ shall be interpreted as hexadecimal
values.
- All 16bit values are in Motorola bigendian notation so that you
have to reverse them when reading a hex dump.
Coordinates
Creep uses a coordinate system that has its origin in the top left corner
of the screen. X values may be in the range from $10 to $b0 and are adressable
in $04 increments; Y values may be in the range from $00 to $c8 and are
adressable in $08 increments. This translates to a 40 by 25 raster. Coordinates
given relative to this raster are denoted with RU, for Raster Units.
General File Structure
All creep castle files are *.PRG files that load to $7800. So if you do
a hex dump, be sure to discard the first two bytes in the stream as they
should just denote that load address.
| $7800/01 | Relative offset to the end-of-file.
($7800) + $7800 is the address just behind the end of the file. |
| $7802 | $80 |
| $7803/04 | Starting Room for Player #1 and #2 |
| $7805/06 | Starting Door for Player #1 and #2 |
| $7807/08 | Number of Lives for Player #1 and #2 |
| ... | Probably random junk |
| $785F/7860 | Pointer to the final screen |
| ... | More random junk |
| $7900/???? | Room Directory |
Room Directory
Starting at $7900, each room occupies 8 Bytes. The Room Directory lists all in-game
rooms, except the End Room.
The Room Directory section of the file is terminated by a single $40
or $ff byte (At least those are the values that I have observed so far. If there is
a function associated with this value, I have not discovered it yet). Right after that come
the room data chunks for all the rooms that were previously defined.
| | ID | Description |
repeat as often as needed | COL | Color of the room on the map screen. |
| X, Y | Coordinates of the left top edge of the room on the map screen. |
| WH | Width and height of the room icon on the map screen in raster units.
Bits 0-2 denote the height,
Bits 3-5 denote the width |
| PTR1 | Two-byte pointer to the start of the room data +2. |
| PTR2 | Two-byte pointer to the start of the room data. |
| | $FF or $40 | End of record indicator. Quark's notes say $FF, but ZTUTORIAL for instance uses $40 instead. |
Room Data
The Room Data is a series of room definitions, which are in turn sequences of element structures.
Each element structure is identified by its leading two bytes. The size of the structures is variable.
Most of them have a specific end-of-record indicator as a terminal, while other have a size implied
by a given count inside the structure. Each room definition ends with a $00, $00 sequence.
The last room in the sequence of rooms is the End Room that is shown when the player escapes
from the castle. It has the same format as a regular room, but can only contain IMAGE objects.
The End Room definition ends with a $00, $00 sequence, too.
Castles of Dr. Creep knows the following room elements:
 |
- Image size:
- 5x4 RU.
- Origin:
- Top left corner.
|
The Door structure has an implied length defined by the door count N.
| | ID | Description |
| | N | Number of doors in this room. |
repeat N times | X, Y | Coordinates of the door |
| Dir | Direction of the door. 0 is top, 1 is right, 2 is down, 3 is left. |
| Room #, Door # | Definition of the door this door links to. Door numbers start at 0 for each room. |
| X(map), Y(map) | Defines where the door mark is placed on the map screen. Coordinates range from $00 to $1C in $02 increments for X and $00 to $38 in $04 increments for Y. The origin is the top left corner of the room (on the map?) |
| Type | Indicates the type of door. 0: normal door, 1: exit door. |
(back to the index)
 |
- Image size:
- nx1 RU, 1 <= n <= 40.
(The image shows a Walkway of 5 RU length.)
- Origin:
- Top left corner.
|
The triplet of L, X, and Y values should be repeated as often as needed. The record is terminated by a single $00 value.
| | ID | Description |
repeat as often as needed | L | Length of the walkway in raster units |
| X, Y | Start coordinates of the walkway. |
| | $00 | End of record indicator. |
(back to the index)
 |
- Image size:
- 1xn RU, 1 < n <= 25.
(The image shown is a Sliding Pole of 5RU length.)
- Origin:
- Top left corner.
|
The triplet of L, X, and Y values should be repeated as often as needed. The record is terminated by a single $00 value.
| | ID | Description |
repeat as often as needed | L | Length of the sliding pole in raster units |
| X, Y | Start coordinates of the sliding pole. |
| | $00 | End of record indicator. |
(back to the index)
 |
- Image size:
- 1xn RU, 1 < n <= 25.
(The image shown is a Ladder of 5RU length.)
- Origin:
- Top left corner.
|
The triplet of L, X, and Y values should be repeated as often as needed. The record is terminated by a single $00 value.
| | ID | Description |
repeat as often as needed | L | Length of the ladder in raster units |
| X, Y | Start coordinates of the ladder. |
| | $00 | End of record indicator. |
(back to the index)
 |
- Image size:
- 3x3 RU.
- Origin:
- Top left corner.
|
The Door Bell structure has an implied length defined by the bell count N.
| | ID | Description |
| | N | Number of door bells in this room. |
repeat N times | X, Y | Coordinates of the bell button. |
| NR | Number of the door that is activated by this button. |
(back to the index)
 |
- Image size:
- Emitter: 3x2 + n RU, where n is the length of the suspension.
(The image shown has a suspension of length 1.) Switch: 3x3 RU.
- Origin:
- Emitter: 1 RU right of the top left corner.
Switch: Top left corner.
|
The Ligning Machine structure consists of repeating sets of machine and switch structures.
Currently, there is no definive information on wether both counts must be the same, or wether
you can have different numbers of machines and switches. The record is terminated by a single
$20 byte.
| | ID | Description |
repeat for each machine | ZM | State of the machine. ZM = $00: off, ZM = $40: on |
| X,Y | Base Coordinates of the lightning machine suspension. |
| L | Length of the suspension in RUs. A value of 0 means that there is no suspension. |
$00, $00, $00, $00 | Unused values. |
repeat for each switch | ZS | Position of the switch knob. ZS = $80: down, Z = $C0: up |
| X,Y | Base Coordinates of the lightning machine switch. |
| $00 | Possibly unused |
PTR, PTR, PTR, PTR | Four Pointers that indicate which machine is influenced by this switch. PTR = $00: first machine, PTR = $08: second machine, PTR = $10: third machine, ... PTR = $FF: no machine. |
| | $20 | End of record indicator |
(back to the index)
 |
- Image size:
- Field: 2x4 RU.
Switch: 3x3 RU.
- Origin:
- Field: Top left corner.
Switch: Top left corner.
|
The Force Field structure can be repeated as often as necessary. The record is terminated by a single
$00 byte.
| | ID | Description |
repeat as often as needed | XS, YS | Coordinates of the forcefield switch. |
| XF, YF | Coordinates of the corresponding forcefield. |
| | $00 | End of record indicator |
(back to the index)
 |
- Image size:
- Tomb: 5x3 RU.
Ankh: 2x3 RU.
- Origin:
- Tomb: Top left corner.
Ankh: Top left corner.
|
The Mummy structure can be repeated as often as necessary. The record is terminated by a single
$00 byte.
| | ID | Description |
repeat as often as needed | $01 | Byte value $01, function unknown. |
| XA, YA | Coordinates of the Ankh that acts as this tomb's trigger. |
| XT, YT | Coordinates of the tomb. |
| $00, $00 | Two bytes $00, possibly in-game mummy state?. |
| | $00 | End of record indicator |
(back to the index)
 |
- Image size:
- 3x2 RU.
- Origin:
- Top left corner.
|
The Key structure can be repeated as often as necessary. The record is terminated by a single
$00 byte.
| | ID | Description |
repeat as often as needed | C | Color of this key. |
| C + $50 | Color of this key plus $50. |
| XK, YK | Coordinates of the key. |
| | $00 | End of record indicator |
(back to the index)
 |
- Image size:
- 3x3 RU.
- Origin:
- Top left corner.
|
The Lock structure can be repeated as often as necessary. The record is terminated by a single
$00 byte.
| | ID | Description |
repeat as often as needed | C | Color of the lock. |
| C + $50 | Color of this key plus $57. |
| D | Number of the door that is opened by this lock. |
| XK, YK | Coordinates of the lock. |
| | $00 | End of record indicator |
(back to the index)
This seems to be an element that did not make it into the final game. So far I have not
seen a castle that makes use of it, so right now nothing is known about it.
(back to the index)
 |
- Image size:
- Rail: 1xn RU, where n is the length of the gun track.
(The image shown has a track of length 3.) Gun: 2x1 RU Switch: 2x3 RU.
- Origin:
- Rail: Top left corner.
Gun: Top left corner. Switch: Top left corner.
|
The Ray Gun structure can be repeated as often as necessary. The record is terminated by a single
$80 byte.
Currently, I'm unsure wether YG is in RU or Pixel, and wether it is measured relative
to the top of the screen or the track.
| | ID | Description |
repeat as often as needed | DIR | Direction of the Ray gun, 0 := right, 1 := left. |
| XR, YR | Coordinates of the Ray Gun track. |
| L | Length of the Ray Gun track. |
| YG | Y-Position of the Ray Gun on the track. |
| XS, YS | Coordinates of the Ray Gun control. |
| | $80 | End of record indicator |
(back to the index)
 |
- Image size:
- Box: 4x4 RU.
Target: 2x2 RU.
- Origin:
- Box: Top left corner.
Target: Top left corner.
|
As far as I know, there can be only one Matter Transmitter per room. It can have a variable
number of transmit targets, though. The record is terminated by a single $00 byte.
I need to verify that there can be only one transmitter.
| | ID | Description |
| | XB, YB | Coordinates of the Matter Transmitter box. |
| | C | Indicates transimtter target. |
repeat as often as needed | XT, YT | Coordinates of transmitter targets. |
| | $00 | End of record indicator |
(back to the index)
 |
- Image size:
- Trapdoor: 3x1 RU.
Switch: 1x3 RU.
- Origin:
- Box: Top left corner.
Target: Top left corner.
|
The Trapdoor structure can be repeated as often as necessary. The record is terminated by
a single $80 byte.
| | ID | Description |
repeat as often as needed | S | State of the trapdoor, 0 := closed, 1 := open. |
| XD, YD | Coordinates of the trapdoor. |
| XS, YS | Coordinates of the associated switch. |
| | $80 | End of record indicator |
(back to the index)
 |
- Image size:
- Belt: 8x1 RU.
Switch: 3x1 RU.
- Origin:
- Belt: Top left corner.
Switch: Top left corner.
|
The Conveyor structure can be repeated as often as necessary. The record is terminated by
a single $80 byte.
| | ID | Description |
repeat as often as needed | S | State of the conveyor belt, 0 := stopped, 1 := move to the right, 2 := stopped, 3 := move to the left. |
| XB, YB | Coordinates of the conveyor beld. |
| XS, YS | Coordinates of the associated switch. |
| | $80 | End of record indicator |
(back to the index)
 |
- Image size:
- 2x4 RU.
- Origin:
- Top left corner.
|
The Frankenstein structure can be repeated as often as necessary. The record is terminated by
a single $80 byte.
| | ID | Description |
repeat as often as needed | S | Orientation of Frankensteins alcove, 0 := facing right, 1 := facing left. |
| X, Y | Coordinates of the alcove. |
| $00, $00, $00, $00 | Reserved for in-game motion data. |
| | $80 | End of record indicator |
(back to the index)
 |
- Image size:
- Double Height: 2nx2 RU.
Single Height: 2nx1 RU.
- Origin:
- Double Height: Top left corner.
Single Height: Top left corner.
|
The Text structure can be repeated as often as necessary. Each output string is terminated
by adding $80 to the last character in the string. The record is terminated by a single $00
byte.
Currently, I'm only aware of two rendering styles. Others probably
exist.
| | ID | Description |
repeat as often as needed | X, Y | Coordinates of top left edge of the string. |
| C | Color the text should be rendered in. |
| S | Rendering Style, $21 := single height, $22 := double height. |
| TEXT | The output text, with bit 7 set on the last character. |
| | $00 | End of record indicator |
(back to the index)
 |
- Image size:
- XxY/8 RU.
- Origin:
- Top left corner.
|
There is only one Image structure per element. However, the whole element can be repeated
as often as necessary. Each image can be put on screen several times. The Image element is
terminated by a single $00 byte.
Like the game itself, the image bitmap uses the multicolor mode, i.e. a pixel is two hires
pixels wide. There are three unique colors available in each 4x8 pixel (i.e. 1x1 RU) block,
while the fourth color is the background color that is global for the whole playfield. The
following picture and table may help to describe this:
 | Bits | Color selected |
| %00 | Background Color |
| %01 | High nibble of Video RAM |
| %10 | Low nibble of Video RAM |
| %11 | Color RAM |
As you can see, there's 1 Byte Video-RAM and 1 Byte Color-RAM per 4x8 pixel block.
| | ID | Description |
| | W | Bitmap width in RU. |
| | H | Bitmap height in pixel. |
| | $00 | Byte $00 |
| | BITMAP | W * H bytes of data |
| | VIDRAM | W * H / 8 bytes of data |
| | COLRAM | W * H / 8 bytes of data |
repeat as often as needed | X, Y | Coordinates where the bitmap should be blitted to. |
| | $00 | End of record indicator |
(back to the index)
|