The game Memory Map
Addresses outside The game's own code that it uses at run time — zero-page
workspace, RAM buffers, and memory-mapped I/O. For the code
itself (&2000–&7FFF), see the
disassembly listing.
Access:
R read, W write,
B indexing base — the address is named as
base,X/,Y, so the byte actually touched is
base + index and the literal byte at this address is
never itself accessed.
Zero page
| Address | Name | Access | Description |
|---|---|---|---|
&0070 |
plot_x |
R/W | Sprite position: screen byte column, 0-79 (two MODE 2 pixels per byte). Also used as a scratch byte and pointer low byte by other routines. |
&0071 |
plot_y |
R/W | Sprite position: pixel row from the top of the screen. Also used as a pointer high byte by other routines. |
&0072 |
sprite_width |
R/W | Width of the sprite being plotted, in screen bytes. |
&0073 |
sprite_height |
R/W | Height of the sprite being plotted, in pixel rows. |
&0074 |
screen_ptr |
R/W | Screen address being written, low byte. |
&0075 |
screen_ptr_hi |
R/W | Screen address being written, high byte. |
&0076 |
row_start_ptr |
R/W | Screen address of the first byte of the sprite row being plotted, low byte. |
&0077 |
row_start_ptr_hi |
R/W | Screen address of the first byte of the sprite row being plotted, high byte. |
&0078 |
sprite_data_ptr |
R/W | Address of the next sprite data byte to plot, low byte. |
&0079 |
sprite_data_ptr_hi |
R/W | Address of the next sprite data byte to plot, high byte. |
&007A |
sprite_number |
R/W | Sprite to plot: an index into the sprite tables at sprite_addr_lo, sprite_addr_hi, sprite_widths and sprite_heights. |
&007B |
map_ptr |
R/W | Pointer into room_walls or object_free_map at a cell's room, low byte; set by test_wall and test_object_free. |
&007C |
map_ptr_hi |
R/W | Pointer into a map, high byte. |
&007D |
plot_offset_x |
R/W | Horizontal offset added by plot_at_cell, in byte columns. |
&007E |
plot_offset_y |
R/W | Vertical offset added by plot_at_cell, in pixel rows. |
&0080 |
ring_x |
R/W | Map x of the cell being drawn in the victory ring. |
&0081 |
ring_y |
R/W | Map y of the cell being drawn in the victory ring. |
&0082 |
victory_sprite |
R/W | Sprite drawn in the victory ring: a sparkle, &16-&19, or the blank, &15, to erase it. |
&0084 |
victory_delay |
R/W | Wait between passes of the victory sequence, in units of 255 loops: &E6 at the start, one less each pass, down to 1. |
&008D |
victory_pitch_step |
R/W | Amount the victory tone's pitch rises each pass: 1 at the start, one more each time the pitch wraps past 255. |
&008E |
victory_steps_left |
R/W | Copy of levels_started that coder_start leaves for game_entry, which makes it level_number. In play the game uses &8E for its own victory_steps_left. |
&008F |
victory_pitch |
R/W | Pitch of the bell in the victory sequence, set with OSBYTE &D5. |
OS workspace
| Address | Name | Access | Description |
|---|---|---|---|
&00FA |
os_zp_fa |
MOS zero-page workspace, read by dissolve_chalice to vary its random choice. |
|
&00FC |
os_irq_a |
MOS 1.20: A at the last interrupt, read by dissolve_chalice to vary its random choice. |
|
&0240 |
os_vsync_counter |
R/W | MOS 1.20 counter decremented on every vertical sync interrupt. The game sets it and waits for it to run out to pace itself. |
&0287 |
os_break_interceptindex region &0287–&0289 |
W | MOS BREAK intercept: if &0287 holds a JMP opcode the MOS jumps to &0287 twice during a reset, before and after the filing system is initialised (carry clear, then set). |
Game data
| Address | Name | Access | Description |
|---|---|---|---|
&0490 |
level_checksums |
B | The expected sum of each decrypted level, for levels 1-25 at level_checksums+1 to level_checksums+25. |
Sprites
| Address | Name | Access | Description |
|---|---|---|---|
&04CF–&04FE |
sprite_blank |
Data of sprite &15, &1A, &77: 4 bytes x 12 rows. |
Text
| Address | Name | Access | Description |
|---|---|---|---|
&0600 |
menu_text |
B | The hero menu: sixteen strings, each a text column and row followed by the characters and a carriage return. The YES/NO and ON/OFF entries are rewritten as the players toggle them. |
Game state
| Address | Name | Access | Description |
|---|---|---|---|
&06F8–&06FB |
page6_score_ten_thousands |
B | Each hero's score ten-thousands digit where add_thousand_points still keeps it, at its cassette address. Every other routine uses hero_score_ten_thousands at &08B0, and Coder reloads this page for every level, so the digit is lost between levels. |
&08B0–&08B3 |
hero_score_ten_thousands |
B | Each hero's score ten-thousands digit as a small digit sprite (&69 for none, &6A-&72 for 1-9). reset_hero sets it to &69, and remove_absent_heroes redraws the digit from here under the score at each level. |
&08B4–&08B7 |
hero_absent |
B | One flag per hero: 1 if switched off on the menu, 0 if playing. hero_menu toggles it with keys 1-4; remove_absent_heroes takes the absent heroes out of play at each level. |
Leftovers from development
| Address | Name | Access | Description |
|---|---|---|---|
&0700 |
line_buffer_leftovers |
Leftover contents of the MOS 1.20 line-input buffer (&0700) from the machine the image was saved on. |
|
&07F0 |
boot_filename |
Name of the file boot_loader loads, CR-terminated. |
Disc release: level loading
| Address | Name | Access | Description |
|---|---|---|---|
&08BC |
levels_started |
The level being played, 1-25, counted as levels started in this game. It lives in page &08, which survives the reset between levels: *DUNJUNZ sets it to 0 for a new game and coder_start adds one before loading each level. coder_start also reads it to choose Stones for level 25, to copy the whole game core only for level 1, and to pass it to game_entry in level_count_copy; game_entry and level_loop read it for the first-level test and the monsters' hit points. |
|
&08BD–&08BE |
level_digits |
The level number as ASCII digits for the level's filename: one digit and a space ("1 "-"9 "), or two digits ("10"-"25"). *DUNJUNZ sets "0 "; coder_start advances it before each level, in page &08 across the reset, and copies it into level_command_digits. |
MOS 1.20 internals
| Address | Name | Access | Description |
|---|---|---|---|
&C375 |
mos_row_offsets |
R/B | MOS 1.20 table of screen row offsets for 640-byte rows (row x 640, high byte then low byte, one pair per character row). Read directly by screen_address; it is not part of any documented interface. |
&C376 |
mos_row_offsets_lo |
B | Low bytes of mos_row_offsets. |
&D9CD |
mos_reset_entry |
MOS 1.20 reset entry, the target of the RESET vector. Called directly to reset the machine. |
|
&E0A4 |
mos_oswrch_default |
MOS 1.20 default OSWRCH routine, WRCHV's initial value. The WRCHV handler jumps here directly instead of through the saved vector. |
|
&E772 |
mos_osbyte_default |
MOS 1.20 default OSBYTE routine, BYTEV's initial value. |
OS entry points
| Address | Name | Access | Description |
|---|---|---|---|
&FFFC |
reset_vectorindex region &FFFC–&FFFD |
6502 RESET vector, in the MOS ROM. |
