Room data
The room data is defined as a series of entries in
CDB5.
Each entry contains the block ID to draw plus bit 7 used as the row's least significant bit.
The next byte contains the remainder of the row in bits 0 - 2 and the column in bits 3 - 7.
This allows to pack an ID plus two co-ordinates into two bytes, saving memory.
Each entry can also contain the following special values:
Value |
Description |
7E , n |
Block should only be drawn if flag 'n' is set. This is only used to draw the wall in Wall Street if it has been built, otherwise show a pile of bricks. (CEC9) |
7F |
End of data |
Object data
Each room can have a number of objects that can be picked up. These are defined in a series of
buffers starting at
BCE9 and accessed via the routine at
AA8C.
Each object takes four bytes and has the following structure:
Byte |
Description |
0 |
Object ID |
1 |
X co-ordinate |
2 |
Y co-ordinate |
3 |
Flags for the item |
The flags in byte 3 determine if the item can be picked up.
Bits 0 - 5 are set if a character can pick it up (from bit 0 - Wally to bit 5 - Harry). So, 1F means "all characters".
It bit 7 is reset, a computer character can pick the item up.
The end of the table is denoted by the byte FF. If the room has no objects in it, that is the only byte in the buffer.
Movement tables
Each moving object in a room, along with Herbert and the jumping jack (which can appear in any room),
is associated with two four-byte buffers. The first is fixed and contains the object bounds; the second
is dynamic and contains the current position and direction change. This is updated by calls to the
routine at
EF35.
The buffer containing bounds is fixed at:
Byte |
Description |
0 |
Minimum x co-ordinate |
1 |
Maximum x co-ordinate |
2 |
Minimum y co-ordinate |
3 |
Maximum y co-ordinate |
The buffer containing the positions varies over time and contains:
Byte |
Description |
0 |
Current x co-ordinate |
1 |
Current y co-ordinate |
2 |
Distance to move in x |
3 |
Distance to move in y |
The distances to move are stored as a 2s complement value.
When an object hits the minimum or maximum value, its distance to move is
inverted between positive and negative and it starts travelling back in the
other direction.
Next rooms
Each room has links to others in a table starting at
AC7F. The lookup is done at the routine in
AC69.
Each entry contains the following structure:
Byte |
Description |
0 |
ID of the next room. |
1 |
ID of co-ordinates that trigger this room. |
2 |
ID of co-ordinates to start in the new room. |
The co-ordinates are an index into a table starting at
AF10. Each entry contains an x and y co-ordinate.
The most common entries are 0 (x = 0, y = 98) and 1 (x = F0 y = 98) which are the far left and
far right parts of the screen. So common entries are a,$01,$00,b,$00,$01.
A new room is automatically triggered when the player moves to the far-left or far-right of the screen,
or when the player presses the "in" key. However, if the current co-ordinate does match any valid tables,
nothing will happen.
The end of the table is denoted by the byte FF.
Above-floor platforms
Some rooms allow players to walk elsewhere than the ground, to climb onto things.
These are defined in a table with offsets defined at
AF8F. Each entry contains three bytes
with the y co-ordinate, the leftmost co-ordinate and the rightmost. As you might expect, the
stairs in the sewer are the most complex definition.
The specific table used by each room is defined as a table in
AFA3. Most rooms use ID 0,
which has no additional platforms.
Food
Food is stored in a table at
F7E9. The structure is:
Byte |
Description |
0 |
ID of the room the food appears in |
1 |
X co-ordinate |
2 |
Y co-ordinate |
3 |
ID of the graphic for the food (5B - 5F) |
The last entry holds FF instead.
When an item of food is picked up, the game switches to the next entry in the table,
then cycles back round to the start.
Each character has a favourite food defined in
BC80. If they pick up this,
their endurance will be restored to the full value, otherwise other foods
just increment it slightly.
The favourite foods are:
Character |
Food |
Wally |
Burger |
Wilma |
Iced bun |
Tom |
Fiz |
Dick |
Bottle |
Harry |
Pear |