Address Length Description
6000 2034
Room Visit Table
Two bytes per room, laid out in the same way as the World_Map world map. The first byte of a room's entry is zero until the room has been visited; Print_Completion_Percentage counts the non-zero entries to work out how much of the map has been explored. The table is cleared by Reset_Room_Table when a new game starts.
In a cave room that has no floor the two bytes of the entry also describe the two stalactites of the room (see Set_Up_Stalactites). Read_Room_State reads an entry.
8ED5 1
Game Options
The options that were chosen on the game selection screen (see Select_Game_Options). Only the low two bits are used, as there is only one player. They are the controls that ReadControls reads:
Bits 0-1 Controls
00 Keyboard
01 Kempston Joystick
02 Cursor Joystick
03 Interface II Joystick
8ED6 2
Game Timer
The game timer. It is incremented by Finish_Object_Pass each time every object record has been handled. The low bits of the counter time many of the game's events, for example the gem timer, the animation of the creatures and the release of new creatures.
8EDA 1
Lives
The number of lives that Sabreman has left, held as a BCD value. It is set to 06 on the game selection screen, goes up by one when Sabreman collects an extra life (type 7F) and goes down by one when he dies.
8EDB 4
Saved Position
Holds Sabreman's x position and room x (the two bytes of Saved_Position), and his y position and room y (the two bytes of Saved_Position_Y), while Handle_Death resets his object record after he has lost a life. The values are then put back, so he restarts where he died.
8EDF 2
Last Frame
The last value of the system variable FRAMES (5C78) that Finish_Object_Pass saw. When FRAMES has changed, the priority objects are handled.
8EE1 1
Previous Sprite Id
The sprite id of the object that StoreEntity last saved. PrepDraw23 uses it, with the saved position, to find the sprite that has to be erased.
8EE2 1
Old Sprite Row Count
The number of rows of the old sprite that the sprite routines have still to draw (see XORSpriteLoop). It is set up by PrepDraw23.
8EE3 1
New Sprite Row Count
The number of rows of the new sprite that the sprite routines have still to draw (see XORSpriteLoop). It is set up by PrepDraw2.
8EE4 1
Previous X Position
The x position of the object that StoreEntity last saved.
8EE5 1
Previous Y Position
The y position of the object that StoreEntity last saved.
8EE6 1
New Sprite Width
The number of character cells that each row of the new sprite covers. It is one more than the width of the sprite in bytes when the sprite is not aligned to a character boundary. It is set up by PrepDraw2 and used by ColourEntity.
8EE7 1
New Sprite Height
The height in pixel lines of the new sprite. It is set up by PrepDraw2 and used by ColourEntity.
8EE8 1
Menu Item Attribute
The attribute that MenuWriteText gives to the characters that it prints.
8EE9 1
Action Key Held Flag
Set to FF while one of the action keys (SPACE, SYMBOL SHIFT, M, N and B) is held down and set to 00 when none is. Finish_Object_Pass maintains it.
8EEA 1
New Action Key Press Flag
Set to FF for one pass of the main loop when one of the action keys is first pressed, and to 00 otherwise. The handlers of the weapons (Handle_Weapon_Pickup) use it to pick up a weapon, move it along the weapon slots or drop it, and set it to FE once they have used it.
8EEB 3
Weapon Slots
The type of the weapon (68 to 6B) that Sabreman carries in each of three slots, or 00 for an empty slot. Finish_Object_Pass empties the slots when an action key is first pressed and the handlers of the carried weapons (Handle_Weapon_Pickup) fill them in again. Throw_Weapon throws the first weapon that it finds.
8EEE 1
Gem Timer
A BCD value that is printed next to the word GEMS. It is set to 50 when Sabreman collects a gem (see Handle_Collectable), which also turns him cyan, and Finish_Object_Pass reduces it by one every fourth tick. While it is not zero Sabreman survives landing after a long fall (see Land_Sabreman) and a falling stalactite does not hurt him (see E83B). When it reaches zero he turns white again.
8EEF 1
Depth
The depth of the room that Sabreman is in, held as a BCD value and printed by Print_Depth.
8EF0 1
Room Redrawn Flag
Set to a non-zero value by Draw_Room when a room has been drawn and cleared at the end of the next pass of the main loop (see Finish_Object_Pass).
8EF1 1
Type 5C Active Flag
Set to 01 by the handler for the object types 5C to 5F (Handle_Carrying_Eagle) each time it runs. Finish_Object_Pass copies it to Previous_Type_5C_Active_Flag and clears it at the end of every pass.
8EF2 1
Previous Type 5C Active Flag
Holds the value of Type_5C_Active_Flag from the last complete pass of the main loop. It is also set by Handle_Flying_Creature when an object changes into type 5C. Handle_Carried_Sabreman reads it.
8EF3 3
Score
The score, held as six BCD digits in three bytes. AddPointsToScore adds to it and prints it.
8EF6 1
Sound Counter
Incremented by Play_Alternating_Tone each time it is called, to alternate the pitch of the tones that it plays.
8EF7 1
Menu Icons Drawn
Set to 01 once Draw_Menu_Icons has drawn the icons on the game selection screen.
8EF8 1
Completion Percentage
The percentage of the Underwurlde that has been explored, held as a BCD value. Print_Completion_Percentage works it out and prints it.
8EF9 1
Creature Spawn Flag
Set to 01 by ED10. Spawn_Flying_Creature tests it when it decides how a new flying creature enters the room.
8EFA 304
Object Records
Nineteen records of 10 bytes each. Run_Game works through them one by one, using byte 00 of each record (the type of the object, which is also its sprite id) as an index into the handler table at Object_Handler_Table. A type of 00 marks a record that is not in use.
The first two records are the weapons that Sabreman throws. They are handled only as priority records (see Finish_Object_Pass). The third record is Sabreman. Reset_Sabreman fills it in using the template at Sabreman_Template.
Some of the other records have fixed uses: the fourth is the rope (type 17 which Set_Up_Rope sets up when the room has a rope) and the fifth is a falling stalactite (see Spawn_Falling_Stalactite).
Byte Contents
00 Type of the object (the sprite id)
01 X position
02 Room x
03 Y position
04 Room y
05 Attribute
06-0F Used differently by each type of handler
Most handlers use bit 0 of byte 0F (or of byte 07) as a flag to say that the sprite has no old image to erase (see Update_Object_Sprite). Byte 09 is often a vertical speed and bytes 0A and 0D are often the fractions of the x and y positions.
902A 40
Small Object Records
Five records of 08 bytes each. They are handled in the same way as the larger records, after all of those have been handled (see Finish_Object_Pass).
The first four are the weapons that Sabreman can pick up. Place_Weapon_Pickups copies their starting positions from Weapon_Placement_Table at the start of the game.
AA3C 16
Sabreman Template
The object record that Reset_Sabreman copies into the record of Sabreman. It sets his type to 09 his position to 409F in the room with x=09 and y=0E and his attribute to 47 (white).
AA93 1
Line Step Count
The difference between the y positions of the two end points of the line that Set_Up_Line sets up. It is the number of steps of the line, which has one step for each pixel row.
AA94 1
Line Direction Flags
The direction of the line that Set_Up_Line sets up. Bit 0 is set when the y position in H is less than the y position in D, and bit 1 is set when the x position in L is less than the x position in E.
AA95 2
Rope End Position
The position of the end of the rope, that Position_Rope_End works out. The low byte is the x position and the high byte is the y position. The x position is the displacement of the rope (Rope_Displacement_Pixels) plus 80.
AA97 2
Previous Rope End Position
The position of the end of the rope when it was last drawn by Draw_Rope, which erases the rope there. The low byte is the x position and the high byte is the y position. It is set to zero when a rope is set up (see Set_Up_Rope).
AA99 7
Unused
Not used by the game.
AAA0 1
Main Line Fraction
The fraction that is carried from step to step by the line that Draw_Line draws with the main register set.
AAA1 1
Shadow Line Fraction
The fraction that is carried from step to step by the line that Draw_Line draws with the shadow register set.
AAA2 1
Rope Velocity
The horizontal velocity of the end of the rope. The left and right controls change it by 02 (see Update_Rope) and Move_Rope moves it towards zero. Set_Position_From_Rope gives it to Sabreman as his x velocity.
AAA3 2
Rope Displacement
The displacement of the end of the rope from the vertical, as a word. The low byte is a fraction. The high byte, at AAA4 is the displacement in pixels (it is negative when the rope swings to the left). It is zero when the rope hangs straight down.
AAA5 2
Rope Length
The length of the rope, as a word. Handle_Rope makes the low byte grow to 38 when a rope is first drawn, and Lower_Rope and Raise_Rope change it when Sabreman climbs down or up. Each time the length passes a multiple of 80 the rope reaches the next room down.
AAA7 2
Rope Anchor Position
The position of the point where the rope hangs from, which Position_Rope_End works out. The low byte is the x position (it is always 80) and the high byte is the y position.
AAA9 2
Previous Rope Anchor Position
The position of the point where the rope hung from when Draw_Rope last drew it.
AAAB 1
Fire Key Flag
The handlers of Sabreman set this to FF while the fire key is not pressed. Throw_Weapon counts it up while a weapon is in flight and throws a new weapon only when its low three bits are zero.
AAAC 1
Room Flags
The flags of the room that Sabreman is in, which are the first byte of its world map entry (see World_Map). The handlers of Sabreman keep it up to date. The main loop tests bit 4 (the floor) at 91FF and Spawn_Falling_Stalactite tests bit 0 (the ceiling).