Jet Set Willy: Game status buffer

| Game status buffer

Address | Length | Description
--- | --- | ---
32768 | 128 | Room layout Initialised upon entry to a room and then used by the routine at 35090, and also used by the routine at 36203.
32896 | 32 | Room name Initialised upon entry to a room and then used by the routine at 35090.
32928 | 54 | Room tiles Initialised upon entry to a room by the routine at 35090.
32982 | 4 | Conveyor definition Initialised upon entry to a room by the routine at 35090.
32986 | 4 | Ramp definition Initialised upon entry to a room by the routine at 35090.
32990 | 1 | Border colour Initialised upon entry to a room and then used by the routine at 35090, and also used by the routines at 35591, 36307, 37310 and 37841.
32993 | 8 | Item graphic Initialised upon entry to a room by the routine at 35090, and used by the routine at 37841.
33001 | 4 | Room exits Initialised upon entry to a room by the routine at 35090.
33008 | 16 | Entity specifications Initialised upon entry to a room and then used by the routine at 35090. There are eight pairs of bytes here that hold the entity specifications for the current room. The first byte in each pair identifies one of the entity definitions at 40960. The meaning of the second byte depends on the entity type: it determines the base sprite index and x-coordinate of a guardian, the y-coordinate of an arrow, or the x-coordinate of the top of a rope.
33024 | 65 | Entity buffers Initialised by the routine at 35090, and used by the routines at 37056 and 37310. There are eight buffers here, each one eight bytes long, used to hold the state of the entities (rope, arrows and guardians) in the current room. For a horizontal guardian, the eight bytes are used as follows:
Byte | Contents
--- | ---
0 | Bit 7: direction (0=left, 1=right)
Bits 5-6: animation frame index
Bits 3-4: unused
Bits 0-2: entity type (001)
1 | Bits 5-7: animation frame index mask
Bit 4: unused
Bit 3: BRIGHT value
Bits 0-2: INK colour
2 | Bits 5-7: base sprite index
Bits 0-4: x-coordinate
3 | Pixel y-coordinate x2 (index into the table at 33280)
4 | Unused
5 | Page containing the sprite graphic data (see 43776)
6 | Minimum x-coordinate
7 | Maximum x-coordinate
For a vertical guardian, the eight bytes are used as follows:
Byte | Contents
--- | ---
0 | Bits 5-7: animation frame index
Bits 3-4: animation frame update flags (see 37247)
Bits 0-2: entity type (010)
1 | Bits 5-7: animation frame index mask
Bit 4: unused
Bit 3: BRIGHT value
Bits 0-2: INK colour
2 | Bits 5-7: base sprite index
Bits 0-4: x-coordinate
3 | Pixel y-coordinate x2 (index into the table at 33280)
4 | Pixel y-coordinate increment
5 | Page containing the sprite graphic data (see 43776)
6 | Minimum y-coordinate
7 | Maximum y-coordinate
For an arrow, the eight bytes are used as follows:
Byte | Contents
--- | ---
0 | Bit 7: direction (0=left, 1=right)
Bits 3-6: unused
Bits 0-2: entity type (100)
1 | Unused
2 | Pixel y-coordinate x2 (index into the table at 33280)
3 | Unused
4 | x-coordinate
5 | Collision detection byte (0=off, 255=on)
6 | Top/bottom pixel row (drawn either side of the shaft)
7 | Unused
The rope uses the second and fourth bytes of the following buffer in addition to its own; these ten bytes are used as follows:
Byte | Contents
--- | ---
0 | Bit 7: direction (0=left, 1=right)
Bits 3-6: unused
Bits 0-2: entity type (011)
1 | Animation frame index
2 | x-coordinate of the top of the rope
3 | x-coordinate of the segment of rope being drawn
4 | Length (32)
5 | Segment drawing byte
6 | Unused
7 | Animation frame at which the rope changes direction (54)
9 | Index of the segment of rope being drawn (0-32)
11 | Bits 1-7: unused
Bit 0: Willy is on the rope (set), or not (reset)
Note that if a rope were the eighth entity specified in a room, its buffer would use the first and third bytes in the otherwise unused area at 33089.
33824 | 1 | Current room number Initialised to 33 (The Bathroom) by the routine at 34762, checked by the routines at 35090, 37310, 37841, 38196, 38276, 38298 and 38455, and updated by the routines at 35591, 38026, 38046, 38064 and 38098.
34172 | 3 | Number of items collected Initialised by the routine at 34762, printed by the routine at 35245, and updated by the routine at 37841.
34175 | 6 | Current time Initialised by the routine at 35068, and printed and updated by the routine at 35245.
34251 | 1 | Minute counter Initialised by the routine at 34762; incremented on each pass through the main loop by the routine at 35245 (which moves the game clock forward by a minute when the counter reaches 0); reset to zero by the routine at 38276 when Willy sticks his head down the toilet; and used by the routines at 37841 (to cycle the colours of the items in the room), 38196 (to determine Maria's animation frame in Master Bedroom) and 38298 (to determine the animation frame for the toilet in The Bathroom).
34252 | 1 | Lives remaining Initialised to 7 by the routine at 34762, decremented by the routine at 35841, and used by the routines at 35211 (when drawing the remaining lives) and 35591 (to adjust the speed and pitch of the in-game music).
34253 | 1 | Screen flash counter Initialised to zero by the routine at 34762, but never used; the code at 35339 makes the screen flash in Manic Miner fashion if this address holds a non-zero value.
34254 | 1 | Kempston joystick indicator Initialised by the routine at 34762, and checked by the routines at 36564 and 38601. Holds 1 if a joystick is present, 0 otherwise.
34255 | 1 | Willy's y-coordinate Initialised to 208 by the routine at 34762, and used by the routines at 35245, 35591, 36307, 36564, 36796, 37310, 38064, 38098, 38196, 38344 and 38455. Holds the LSB of the address of the entry in the screen buffer address lookup table at 33280 that corresponds to Willy's pixel y-coordinate; in practice, this LSB is twice Willy's actual pixel y-coordinate. Note that when Willy is standing on a ramp, this holds his y-coordinate rounded down to the nearest multiple of 16 (8x2).
34256 | 1 | Willy's direction and movement flags
Bit(s) | Meaning | Used by
--- | --- | ---
0 | Direction Willy is facing (reset=right, set=left) | 36564, 36796, 38455
1 | Willy's left/right movement flag (set=moving) | 36307, 36564, 36796, 37310
2-7 | Unused (always reset) |
34257 | 1 | Airborne status indicator Initialised by the routine at 34762, checked by the routines at 35591, 36796 and 38344, updated by the routines at 37046, 37310 and 38064, and checked and updated by the routines at 36307, 36564 and 38098. Possible values are:
Value | Meaning
--- | ---
0 | Willy is neither falling nor jumping
1 | Willy is jumping
2-11 | Willy is falling, and can land safely
12-15 | Willy is falling, and has fallen too far to land safely
255 | Willy has collided with a nasty, an arrow, a guardian, or Maria (see 37046)
34258 | 1 | Willy's animation frame Used by the routines at 38344 and 38455, and updated by the routines at 35245, 36796 and 37310. Possible values are 0, 1, 2 and 3.
34259 | 2 | Address of Willy's location in the attribute buffer at 23552 Initialised by the routine at 34762, and used by the routines at 36307, 36796, 37310, 38026, 38046, 38064, 38098, 38196, 38276, 38344 and 38455.
34261 | 1 | Jumping animation counter Used by the routines at 36307 and 36564.
34262 | 1 | Rope status indicator Initialised by the routine at 35090, checked by the routines at 36307 and 36796, and checked and updated by the routines at 36564 and 37310. Possible values are:
Value | Meaning
--- | ---
0 | Willy is not on the rope
3-32 | Willy is on the rope, with the centre of his sprite anchored at this segment
240-255 | Willy has just jumped or fallen off the rope
34263 | 7 | Willy's state on entry to the room Initialised by the routine at 35090, and copied back into 34255-34261 by the routine at 35841.
34270 | 1 | 256 minus the number of items remaining Initialised by the routine at 34762, and updated by the routine at 37841 when an item is collected.
34271 | 1 | Game mode indicator Initialised by the routine at 34762, checked by the routines at 35245, 36564 and 38298, and updated by the routines at 37841, 38196 and 38276.
Value | Meaning
--- | ---
0 | Normal
1 | All items collected
2 | Willy is running to the toilet
3 | Willy's head is down the toilet
34272 | 1 | Inactivity timer Initialised by the routine at 34762, and updated by the routines at 35245, 35591 and 36564.
34273 | 1 | In-game music note index Initialised by the routine at 34762, used by the routine at 35211, and used and updated by the routine at 35591.
34274 | 1 | Music flags The keypress flag in bit 0 is initialised by the routine at 34762; bits 0 and 1 are checked and updated by the routine at 35591.
Bit(s) | Meaning
--- | ---
0 | Keypress flag (set=H-ENTER being pressed, reset=no key pressed)
1 | In-game music flag (set=music off, reset=music on)
2-7 | Unused
34275 | 1 | WRITETYPER key counter Checked by the routine at 35245, and updated by the routine at 35591.
34276 | 1 | Temporary variable Used by the routines at 34499 and 34620 to hold the entry code, by the routine at 34762 to hold the index into the message scrolled across the screen after the theme tune has finished playing, and by the routine at 35914 to hold the distance of the foot from the top of the screen as it descends onto Willy.