Valid HTML 4.0! Valid CSS!

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 :-)

  1. All numeric values denoted by a leading $ shall be interpreted as hexadecimal values.
  2. 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/01Relative offset to the end-of-file.
($7800) + $7800 is the address just behind the end of the file.
$7802$80
$7803/04Starting Room for Player #1 and #2
$7805/06Starting Door for Player #1 and #2
$7807/08Number of Lives for Player #1 and #2
...Probably random junk
$785F/7860Pointer 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.

 IDDescription
repeat
as often
as needed
COLColor of the room on the map screen.
X, YCoordinates of the left top edge of the room on the map screen.
WHWidth 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
PTR1Two-byte pointer to the start of the room data +2.
PTR2Two-byte pointer to the start of the room data.
 $FF or $40End 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.

Room Elements

Castles of Dr. Creep knows the following room elements:

  1. $03 $08 - DOOR
  2. $06 $08 - WALKWAY
  3. $09 $08 - SLIDING POLE
  4. $0C $08 - LADDER
  5. $0F $08 - DOOR BELL
  6. $12 $08 - LIGHTNING MACHINE
  7. $15 $08 - FORCE FIELD
  8. $18 $08 - MUMMY
  9. $1B $08 - KEY
  1. $1E $08 - LOCK
  2. $21 $08 - ???
  3. $24 $08 - RAY GUN
  4. $27 $08 - MATTER TRANSMITTER
  5. $2A $08 - TRAPDOOR
  6. $2D $08 - CONVEYOR
  7. $30 $08 - FRANKENSTEIN
  8. $33 $08 - TEXT
  9. $36 $08 - IMAGE

$03 $08 - DOOR

Image size:
5x4 RU.
Origin:
Top left corner.

The Door structure has an implied length defined by the door count N.

 IDDescription
 NNumber of doors in this room.
repeat
N times
X, YCoordinates of the door
DirDirection 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?)
TypeIndicates the type of door.
0: normal door,
1: exit door.

(back to the index)

$06 $08 - WALKWAY

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.

 IDDescription
repeat
as often
as needed
LLength of the walkway in raster units
X, YStart coordinates of the walkway.
 $00End of record indicator.

(back to the index)

$09 $08 - SLIDING POLE

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.

 IDDescription
repeat
as often
as needed
LLength of the sliding pole in raster units
X, YStart coordinates of the sliding pole.
 $00End of record indicator.

(back to the index)

$0C $08 - LADDER

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.

 IDDescription
repeat
as often
as needed
LLength of the ladder in raster units
X, YStart coordinates of the ladder.
 $00End of record indicator.

(back to the index)

$0F $08 - DOOR BELL

Image size:
3x3 RU.
Origin:
Top left corner.

The Door Bell structure has an implied length defined by the bell count N.

 IDDescription
 NNumber of door bells in this room.
repeat
N times
X, YCoordinates of the bell button.
NRNumber of the door that is activated by this button.

(back to the index)

$12 $08 - LIGHTNING MACHINE

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.

 IDDescription
repeat for
each machine
ZMState of the machine.
ZM = $00: off,
ZM = $40: on
X,YBase Coordinates of the lightning machine suspension.
LLength 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
ZSPosition of the switch knob.
ZS = $80: down,
Z = $C0: up
X,YBase Coordinates of the lightning machine switch.
$00Possibly 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.
 $20End of record indicator

(back to the index)

$15 $08 - FORCE FIELD

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.

 IDDescription
repeat
as often
as needed
XS, YSCoordinates of the forcefield switch.
XF, YFCoordinates of the corresponding forcefield.
 $00End of record indicator

(back to the index)

$18 $08 - MUMMY

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.

 IDDescription
repeat
as often
as needed
$01Byte value $01, function unknown.
XA, YACoordinates of the Ankh that acts as this tomb's trigger.
XT, YTCoordinates of the tomb.
$00, $00Two bytes $00, possibly in-game mummy state?.
 $00End of record indicator

(back to the index)

Image size:
3x2 RU.
Origin:
Top left corner.

$1B $08 - KEY

The Key structure can be repeated as often as necessary. The record is terminated by a single $00 byte.

 IDDescription
repeat
as often
as needed
CColor of this key.
C + $50Color of this key plus $50.
XK, YKCoordinates of the key.
 $00End of record indicator

(back to the index)

$1E $08 - LOCK

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.

 IDDescription
repeat
as often
as needed
CColor of the lock.
C + $50Color of this key plus $57.
DNumber of the door that is opened by this lock.
XK, YKCoordinates of the lock.
 $00End of record indicator

(back to the index)

$21 $08 - ???

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)

$24 $08 - Ray Gun

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.

 IDDescription
repeat
as often
as needed
DIRDirection of the Ray gun,
0 := right, 1 := left.
XR, YRCoordinates of the Ray Gun track.
LLength of the Ray Gun track.
YGY-Position of the Ray Gun on the track.
XS, YSCoordinates of the Ray Gun control.
 $80End of record indicator

(back to the index)

$27 $08 - Matter Transmitter

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.

 IDDescription
 XB, YBCoordinates of the Matter Transmitter box.
 CIndicates transimtter target.
repeat
as often
as needed
XT, YTCoordinates of transmitter targets.
 $00End of record indicator

(back to the index)

$2A $08 - Trapdoor

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.

 IDDescription
repeat
as often
as needed
SState of the trapdoor,
0 := closed, 1 := open.
XD, YDCoordinates of the trapdoor.
XS, YSCoordinates of the associated switch.
 $80End of record indicator

(back to the index)

$2D $08 - Conveyor

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.

 IDDescription
repeat
as often
as needed
SState of the conveyor belt,
0 := stopped, 1 := move to the right,
2 := stopped, 3 := move to the left.
XB, YBCoordinates of the conveyor beld.
XS, YSCoordinates of the associated switch.
 $80End of record indicator

(back to the index)

$30 $08 - Frankenstein

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.

 IDDescription
repeat
as often
as needed
SOrientation of Frankensteins alcove,
0 := facing right, 1 := facing left.
X, YCoordinates of the alcove.
$00, $00, $00, $00Reserved for in-game motion data.
 $80End of record indicator

(back to the index)

$33 $08 - Text

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.

 IDDescription
repeat
as often
as needed
X, YCoordinates of top left edge of the string.
CColor the text should be rendered in.
SRendering Style,
$21 := single height, $22 := double height.
TEXTThe output text, with bit 7 set on the last character.
 $00End of record indicator

(back to the index)

$36 $08 - Image

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:

BitsColor selected
%00Background Color
%01High nibble of Video RAM
%10Low nibble of Video RAM
%11Color RAM

As you can see, there's 1 Byte Video-RAM and 1 Byte Color-RAM per 4x8 pixel block.

 IDDescription
 WBitmap width in RU.
 HBitmap height in pixel.
 $00Byte $00
 BITMAPW * H bytes of data
 VIDRAMW * H / 8 bytes of data
 COLRAMW * H / 8 bytes of data
repeat
as often
as needed
X, YCoordinates where the bitmap should be blitted to.
 $00End of record indicator

(back to the index)

 


Auswege: Impressum, Haftungsausschluß, Datenschutz, thb's Creep-Seite, thb's 64'er-Seite, meine Homepage.
Links: Imprint, thb's Creep page, thb's C64 page, my homepage.


Thomas Bätzler, Thomas@Baetzler.de
$Id$