Prev: BB0A Up: Map Next: BDFE
BBAA: Game variables and the object records
Cleared from here at the first start (START), and from CELL_LOOKED_UP at every new game (NEW_GAME), so only the random number, the font base, the saved stack pointer and the two control bytes survive from one game to the next; the turn counter is outside the cleared part too, but is set again from FRAMES at every new game. The snapshot's bytes here are what the tape's block held: none of them is ever read before it is written.
The 23 object records from KNIGHT on are 16 bytes each, updated in turn every turn by the main loop through UPDATES: +0 the graphic, which picks the update routine (0 an empty record); +1 and +2 U, a word whose high byte is the town's column and low byte the place across the cell; +3 and +4 V the same, the high byte the row; +5 the speed (for a find, the type of cell it came from, SPAWN_FIND); +6 the facing in bits 6 and 7 (bit 6 along U rather than V, bit 7 backwards), and in the low bits a count -- for the knight bits 0-2, his turning; for a monster or a find bits 0-5, the turns before it next changes direction (WANDER_STEP, STEER); +7 the flags -- bit 0 stopped by a wall this turn (MOVE_CLIPPED), bit 1 drawn this turn (DRAW_SPRITE, cleared by the sound routines that play only for things on the screen), bit 5 a monster that makes for the knight when it turns (STEER), bit 6 its sprite mirrored and bit 7 upside down (TURN_SPRITE); +8 and +9 the half-size in U and V, centre to edge; +A and +B this turn's step in U and V, signed; +C and +D the drawing offset, added to where it projects on the screen; +E and +F where it was last drawn.
RANDOM BBAA DEFB $00,$00 The random number, stirred with R and the turn counter after every record's update and at every random choice (NEXT_TURN)
FONT_BASE BBAC DEFB $00,$00 The address of character code 0 for the printer (PRINT_CHAR): each routine that prints sets it first -- but see PRINT_PERCENTAGE
SAVED_SP BBAE DEFB $00,$00 The stack pointer, kept while the drawing and the clearing of the buffers borrow SP (SHOW_PLAY_AREA)
CONTROL BBB0 DEFB $00 Control method: bits 1-2 keyboard, Kempston, cursor, Interface II; bit 3 directional control (MENU)
LAST_CONTROL BBB1 DEFB $1E The control method before the last key on the menu
TURNS BBB2 DEFB $00,$00 The turn counter: FRAMES at every new game (NEW_GAME), one more each turn (NEXT_TURN); its low byte paces the finds (SPAWN_FIND), the monsters (SPAWN_MONSTER) and the creature (SPAWN_CREATURE)
CELL_LOOKED_UP BBB4 DEFB $00,$0F The column and row last looked up on the map (LOOK_UP_CELL)
DRAW_X BBB6 DEFB $00,$3F Where on the screen a thing or a building is drawn: x
DRAW_Y BBB8 DEFB $1E,$80 ...and y
VIEW BBBA DEFB $00 Bit 0: the town is seen turned round, from the other side (Z or SYMBOL SHIFT, TURN_TOWN); the panel's heading says south instead of north (PRINT_HEADING)
COLUMNS_DRAWN BBBB DEFB $1F,$0F A bit for each column of the screen a building has been drawn in this turn (DRAW_WALL_COLUMN)
KEY_LATCH BBBD DEFB $FF Set while a key that acts once a press is held
TOP_SPEED BBBE DEFB $03 The knight's top speed: 10, and 18 while a bonus's faster walk lasts (SPEED_BONUS)
MENU_SHOWN BBBF DEFB $C0 Set once the menu's frame has been drawn (DISPLAY_MENU)
CELL_TYPE BBC0 DEFB $80 The type of the cell being drawn (DRAW_WALLS)
TUNE_PLAYED BBC1 DEFB $3F Set once the menu's tune has played (PLAY_TUNE_ONCE); cleared with the rest at every new game, so it plays again after each
SPRITE_WIDTH BBC2 DEFB $1C The width of the sprite being drawn
SPRITE_ROWS BBC3 DEFB $FF The rows of it that are drawn
DRAW_LIST_AT BBC4 DEFB $FC,$E0 Pointers into the list of things to draw (SORT_AND_DRAW_THINGS)
DRAW_LIST_NEXT BBC6 DEFB $40,$1F
FIRE_DELAY BBC8 DEFB $0B Turns before the knight can throw again (KNIGHT_THROWS)
SCORE BBC9 DEFB $FF The score, BCD, highest first: the top two digits, of which only the lower is printed (ADD_SCORE)
BBCA DEFB $FF The next two, where a villain's 250000 goes
SCORE_LOW BBCB DEFB $C0 The next two, the hundreds and thousands, where everything else scores
SCORE_ZEROS BBCC DEFB $80 Printed as the score's last two digits, and never written: so every score ends 00
LIVES BBCD DEFB $0F Lives in hand besides the one being played: six at a new game, from the code at LIVES_BYTE (NEW_GAME), and one taken as each life starts, the first included; none left to take is game over (NEW_LIFE)
STOCKS BBCE DEFB $07,$FF,$FF,$E0,$C0,$1F How many more finds the cells of each type have, by type, shared by every cell of it: types 2 on get 16-31 at every new game (STOCK_BUILDINGS), types 0 and 1 none; one is taken as a find appears (SPAWN_FIND) and put back if it is left behind (FIND_WANDER)
BBD4 DEFB $0F,$FF,$FF,$E0,$C0,$1F
BBDA DEFB $0F,$FF,$FF,$E8,$C0,$1F
BBE0 DEFB $0F,$FF,$FF,$FC,$E8,$3F
BBE6 DEFB $00,$FF,$3F,$FE,$F4,$7F
BBEC DEFB $21,$FF,$1F,$FE,$F4,$7F
DRAW_PASS BBF2 DEFB $31 Which of a building's two faces is being drawn
HITS BBF3 DEFB $FF Hits the knight can still take in this life: 3 at each life and at the cure (HITS_BONUS), one fewer for each monster or creature that touches him (WANDERING_MONSTER); his colour shows them (KNIGHT_COLOURS)
THROW_TOGGLE BBF4 DEFB $8F Which antibody record the next throw replaces (KNIGHT_THROWS)
SPEED_TIME BBF5 DEFB $FF Turns left of the faster walk a bonus gives (SPEED_BONUS, UPDATE_KNIGHT)
LAST_CELL BBF6 DEFB $F2,$7F The cell the knight was last in, column and row (VISIT_CELL)
FOOTSTEPS BBF8 DEFB $20 Counts the knight's footsteps (FOOTSTEP)
EFFECT_TIME BBF9 DEFB $FF Notes left of the sound effect under way, one a turn (EFFECT_NOTE); in the ending, a count the ending's note rises from (ENDING_BEEP)
EFFECT BBFA DEFB $05 Which sound effect (EFFECT_TABLE): 0 a new cell with a building, 1 the faster walk, 2 the cure, 3 an object taken up
FLASH BBFB DEFB $FE The paper colour of the play area, flashed when a villain dies (VILLAIN_DYING), and back to black at the end of every turn (NEW_GAME)
LAST_FLASH BBFC DEFB $D0 The paper this turn's play area was cleared to: FLASH as the last turn ended, which the knight's and the buildings' colours keep (COLOUR_KNIGHT)
PERCENT BBFD DEFB $7F The percentage of the game done, BCD: the hundreds (PERCENTAGE)
PERCENT_LOW BBFE DEFB $1F ...and the tens and units
ENDING BBFF DEFB $FF Set while the ending plays (GAME_OVER): the main loop then only updates the records
ENDING_COLOUR BC00 DEFB $C1 The colour the ending's pictures are drawn in
CONTROLS BC01 DEFB $FE What the controls say this turn: bits 0-1 turn, 2 walk, 3 throw, 4 down, 5 turn the town round (READ_CONTROLS)
ARRIVING BC02 DEFB $D4 Counts up by two a turn from 40 while the knight appears at a new life, and is $70 once he has (UPDATE_KNIGHT): until then nothing touches him and no find or monster comes (TOUCHING_KNIGHT)
CARRIED BC03 DEFB $FF,$7F,$FF,$F9,$FF The things carried, in the order taken up: 1-4 the four objects, 5-8 the four kinds of antibody, 0 an empty place (PICK_UP_THING); each has its place on the panel, from the bottom up (COLOUR_CARRIED)
BC08 DEFB $E6,$7F,$3F,$FF,$FD
CARRIED_LAST BC0D DEFB $FE The eleventh; the knight throws the last thing he took up first (KNIGHT_THROWS)
VISITED BC0E DEFB $E0,$3F,$07,$FF A bit for each cell of the town the knight has been in, a row of the town to a line: a byte for eight columns, the column's low three bits the bit (VISIT_CELL); counted for the percentage (PERCENTAGE)
BC12 DEFB $FD,$FE,$F4,$1F
BC16 DEFB $08,$FF,$05,$FC
BC1A DEFB $F0,$1F,$0E,$FF
BC1E DEFB $4A,$F8,$F0,$1F
BC22 DEFB $0E,$FF,$DA,$FC
BC26 DEFB $F8,$1F,$0E,$FF
BC2A DEFB $02,$FC,$78,$0F
BC2E DEFB $07,$FF,$27,$FC
BC32 DEFB $78,$0F,$07,$FF
BC36 DEFB $FE,$FC,$38,$2F
BC3A DEFB $07,$FF,$76,$F8
BC3E DEFB $30,$7F,$27,$FF
BC42 DEFB $32,$F8,$70,$3F
BC46 DEFB $1E,$73,$20,$F0
BC4A DEFB $60,$1F,$06,$27
BC4E DEFB $03,$F8,$F0,$3F
BC52 DEFB $1B,$83,$00,$F8
BC56 DEFB $50,$1F,$06,$01
BC5A DEFB $00,$F8,$D0,$06
BC5E DEFB $00,$00,$00,$D0
BC62 DEFB $00,$03,$22,$01
BC66 DEFB $00,$FE,$00,$00
BC6A DEFB $00,$03,$01,$FF
BC6E DEFB $B6,$80,$00,$0F
BC72 DEFB $03,$FF,$B7,$E0
BC76 DEFB $80,$1F,$0E,$FF
BC7A DEFB $BF,$F0,$60,$3F
BC7E DEFB $1E,$FF,$BF,$F8
BC82 DEFB $70,$1F,$0E,$FF
BC86 DEFB $FF,$FC,$78,$1F
BC8A DEFB $0F,$FF,$FB,$FE
KNIGHT BC8E DEFB $FC The knight's legs, +0: graphics 16-21 and 24-29 as he walks, 12-15 as he vanishes, and 0 for a new life (NEW_LIFE)
KNIGHT_U BC8F DEFB $0F +1: U within the cell
KNIGHT_COLUMN BC90 DEFB $05 +2: the column
KNIGHT_V BC91 DEFB $FF +3: V within the cell
KNIGHT_ROW BC92 DEFB $F5 +4: the row
KNIGHT_SPEED BC93 DEFB $FF +5: speed, up to TOP_SPEED
KNIGHT_FACING BC94 DEFB $F6 +6: facing, bits 6-7
KNIGHT_FLAGS BC95 DEFB $0F +7: flags
BC96 DEFB $07,$FF +8 to +F: half-sizes in U and V; this turn's steps; the drawing offset; where he was drawn
BC98 DEFB $65,$E6
BC9A DEFB $E0,$0F
BC9C DEFB $06,$FF
KNIGHT_TOP BC9E DEFB $AD,$E0,$C0,$07,$02,$FF,$DD,$C0 The knight's top half (graphics 22, 30 and 32-47), kept on his legs by UPDATE_TOP
BCA6 DEFB $80,$07,$02,$FF,$ED,$C0,$80,$07
ANTIBODIES BCAE DEFB $02,$FF,$F5,$E0,$C0,$07,$02,$FF The first antibody in flight (graphics 80-95): the only one that can strike anything (ANTIBODY_STRIKE)
BCB6 DEFB $FB,$E0,$C0,$07,$02,$FF,$FD,$E0
BCBE DEFB $C0,$07,$02,$FF,$FE,$E0,$C0,$0F The second, used while the first is busy (KNIGHT_THROWS)
BCC6 DEFB $06,$FF,$FF,$F0,$E0,$0F,$06,$FF
FINDS BCCE DEFB $FF,$F0,$E0,$0F,$06,$FF,$43,$F0 A find in a building (graphics 48-63, SPAWN_FIND); when a villain dies all four records hold its sparkles instead (140-143, drawn with the finds' sprites, VILLAIN_SPARKLES)
BCD6 DEFB $E0,$0F,$07,$FF,$BB,$F0,$E0,$1F
BCDE DEFB $0F,$FF,$FF,$E0,$C0,$1F,$0F,$FF A second find, or sparkles
BCE6 DEFB $DF,$C0,$80,$1F,$0F,$FF,$8F,$80
BCEE DEFB $00,$0F,$07,$FF,$03,$C0,$80,$07 A third
BCF6 DEFB $01,$FF,$03,$C0,$80,$03,$01,$FF
BCFE DEFB $0B,$C0,$80,$03,$01,$FF,$5B,$C0 A fourth
BD06 DEFB $80,$03,$01,$FF,$63,$E0,$C0,$03
BONUS BD0E DEFB $01,$FF,$03,$E0,$C0,$01,$00,$FF A bonus (PLACE_BONUS): graphic 2 a faster walk, 3 the hits back
BD16 DEFB $C7,$E0,$C0,$00,$00,$FF,$3F,$F0
OBJECTS BD1E DEFB $E0,$00,$00,$3F,$01,$F8,$F0,$00 The object that kills the villain in record 0: graphic 7 lying, 11 thrown (PLACE_OBJECTS)
BD26 DEFB $00,$01,$00,$F8,$70,$00,$00,$00
BD2E DEFB $00,$70,$00,$03,$22,$63,$00,$F8 The object for villain 1: graphic 6 lying, 10 thrown
BD36 DEFB $00,$00,$00,$FF,$63,$FF,$D0,$00
BD3E DEFB $00,$7F,$3C,$FF,$ED,$C0,$00,$3F For villain 2: 5 and 9
BD46 DEFB $1F,$FF,$6D,$F0,$C0,$1F,$07,$FF
BD4E DEFB $B6,$F8,$D0,$07,$03,$FF,$D6,$FC For villain 3: 4 and 8
BD56 DEFB $B8,$03,$01,$FF,$DA,$FE,$BC,$03
VILLAINS BD5E DEFB $01,$FF,$EB,$FC,$B8,$03,$01,$FF Villain 0 (graphics 108-111), panel colour cyan (PLACE_VILLAINS); every villain is 132-135 as it dies, drawn as a puff
BD66 DEFB $EF,$F8,$F0,$01,$00,$FF,$EF,$F8
BD6E DEFB $F0,$01,$00,$FF,$FF,$F8,$F0,$01 Villain 1 (104-107), green
BD76 DEFB $00,$FF,$FF,$F8,$F0,$00,$00,$FF
BD7E DEFB $7F,$F0,$E0,$00,$00,$FF,$7F,$E0 Villain 2 (100-103), magenta
BD86 DEFB $C0,$00,$00,$FF,$7F,$E0,$C0,$00
BD8E DEFB $00,$FF,$7F,$F0,$E0,$01,$00,$FF Villain 3 (96-99), red
BD96 DEFB $DF,$F0,$E0,$01,$00,$FF,$DF,$F0
MONSTERS BD9E DEFB $E0,$01,$00,$FF,$DF,$F8,$F0,$03 A monster (SPAWN_MONSTER): appearing (128-131), then of graphics 64-79 or 112-127; or the creature (136-139, SPAWN_CREATURE), which always takes the first record it can
BDA6 DEFB $01,$FF,$DF,$F8,$F0,$03,$01,$FF
BDAE DEFB $BF,$F8,$F0,$03,$01,$FF,$BF,$F8 A second monster
BDB6 DEFB $F0,$03,$01,$FF,$BF,$F0,$E0,$01
BDBE DEFB $00,$FF,$FF,$E0,$80,$00,$00,$FF A third
BDC6 DEFB $7F,$E0,$C0,$01,$00,$FF,$FF,$F0
BDCE DEFB $E0,$07,$01,$FF,$FF,$F0,$E0,$1F A fourth
BDD6 DEFB $07,$FF,$FF,$F8,$F0,$3F,$1F,$FF
BDDE DEFB $FF,$F8,$F0,$1F,$0F,$FF,$FF,$F8 A fifth
BDE6 DEFB $F0,$0F,$03,$FF,$FF,$F0,$E0,$03
BDEE DEFB $00,$FF,$7F,$E0,$C0,$00,$00,$7F A sixth
BDF6 DEFB $07,$C0,$80,$00,$00,$07,$00,$80
Prev: BB0A Up: Map Next: BDFE