The game Memory Map

← Dunjunz

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 (&0400–&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

Pitch wraps left before the victory sequence ends: &32 (50) at the start.

&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.

Level file (&6B00)

Address Name Access Description
&6B00–&6B1F level_object_x B

Level file: Objects' map x (entries 1-30, entry 30 the exit).

&6B20–&6B3F level_object_y B

Level file: Objects' map y.

&6B40–&6B5F level_object_type B

Level file: Objects' types.

&6B60–&6B74 level_door_x B

Level file: Doors' map x (entries 1-20).

&6B75–&6B89 level_door_y B

Level file: Doors' map y.

&6B8A–&6B9F level_door_sprite B

Level file: Doors' sprites.

&6BA0–&6BB4 level_key_x B

Level file: Keys' map x (entries 1-20).

&6BB5–&6BCF level_key_y B

Level file: Keys' map y.

&6BD0–&6BD7 level_trapdoor_x B

Level file: Trapdoors' map x (entries 0-7).

&6BD8–&6BDF level_trapdoor_y B

Level file: Trapdoors' map y.

&6BE0–&6CAF level_walls B

Level file: Wall map (&C9 bytes used).

&6CB0–&6D7F level_object_free_map B

Level file: Map of cells without objects (&C9 bytes used).

&6D80–&6DAF level_wall_sprite B

Level file: The level's wall block, copied to wall_sprite.

Screen workspace

Address Name Access Description
&6E60 level_osfile_block
index region &6E60–&6E71

The 18-byte OSFILE parameter block load_level passes to FILEV's routine: bytes 0-1 the filename's address (level_filename), bytes 2-5 the load address &00006B00, byte 6 the exec address's low byte, which must be 0 for the load address to be used. It lies in character row 24 of the screen, just below the game's code at &6E80, hidden while the level loads; only bytes 0-5 are written, and the rest are 0 from show_level_number's screen clear.

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.

OS entry points

Address Name Access Description
&FFFC reset_vector
index region &FFFC–&FFFD

6502 RESET vector, in the MOS ROM.