Castle Frankenstein

From Tautology's Reverse Engineering Wiki
Jump to: navigation, search

This is a rough description of the Castle Frankenstein data and code file. The version reverse engineered was the BBC B version and may differ on others.

Files[edit]

The following files are use for Castle Frankenstein:

  • $.FRANK2 - code and data

$.FRANK2[edit]

All locations are files specific, as the file is relocated to 0xC00, to convert to memory address, add 0xC00 to all pointers.

Pointers[edit]

As the file combines both code and data there is some overlap between permanent code and reused data areas. If the data area is reused it has been marked with a (temp). All pointers are 16 bit big endian pointers to memory.

Location Size Usage
0x0000 2 Pointer to messages
0x0002 2 Pointer to 0x4608
0x0004 2 Pointer to 0x4be4
0x0006 2 Pointer to verbs
0x000a 2 Null
0x000c 2 Null
0x000e 2 Pointer to location text
0x0010 2 Null
0x0012 2 Pointer to dictionary
0x0012 1 (temp) Length of 0x4608 block
0x0015 1 (temp) High nibble of 0x4608 block
0x0016 1 (temp) Low nibble of 0x4608 block
0x0017 1 Counter for 0x4608 block
0x0045 1 OSFILE Block:
Location Size Usage
0x0000 2 Pointer to Filename (0x0c57)
0x0002 4 Load Address (0x0e00)
0x0006 4 Exec Address (0x0000)
0x000a 4 Start Address/Length (0x0e00)
0x000e 4 End Address/Attributes (0x0f64)
0x0012 11 Save Game name (FRANKENSTEIN)
0x00d3 255 Object Starting Location
0x0200 1 (temp) Status Block
Location Size Usage
0x0002 1 Last Room
0x0003 1 Current Room
0x0264 255 (temp) Inventory (in-game)
0x0364 1 Object Descriptions
0x0700 1 Room Exits
0x0e00 1 System Messages
0x1ef8 1 Location Text
0x3c44 1 Messages
0x4608 1 Unknown
0x4be4 1 Unknown
0x4dd8 1 Verbs
0x4dd8 1 Nouns
0x4dd8 1 Dictionary

Room Exits[edit]

Room exits are defined as one byte, pointing to the destination room for each of the possible directions in the order:

  • North
  • South
  • East
  • West
  • Up
  • Down

Message Strings[edit]

Messages strings are read a byte at a time. Each byte is an index in the dictionary.

The strings are terminated by a 0x00


Verbs, nouns and dictionary are encoded with a roll right to prevent viewing.

Verbs and Nouns are a list of words with the format: WORD (encoded, terminated with a bit 7 set) WORD number (not encoded) Synonyms have the same word number.

The dictionary is a list of words terminated with bit 7 set. Indexing starts at 1, then it goes sequentially.

C16 = 33 & 0xf = 3 c15 = 33 & 0xf0 >> 4 = 3 c14 = c16 + c15 = 6