; da65 V2.15 - Git 104f898
; Created:    2016-09-06 18:37:35
; Input file: jumpmanjr.rom
; Page:       1


        .setcpu "6502"

; ----------------------------------------------------------------------------
L0000           := $0000
dm_ypos         := $0054                        ; see draw_map and level_maps.txt
dm_xpos         := $0055                        ; see draw_map and level_maps.txt
SAVMSC          := $0058                        ; OS's idea of the start of screen memory [redundant to set here?]
jiffy_timer_3_hi:= $00A2                        ; gets incremented every time 3_lo wraps around to zero
zp_temp2        := $00AE                        ; used for (zp,y) addressing, also 2 temps for scores_screen
bomb_idx        := $00B2                        ; bomb that was just picked up (times 2, suitable for index into a table of words)
blistptr        := $00B4                        ; bomb_pickup: points to current level's bomblist
bombloc         := $00B6                        ; bomb_pickup: position of the bomb Jumpman just touched, on 8x8 coarse grid
sa_tmp_1        := $00BD                        ; used by calc_screen_addr
dm_count        := $00BE                        ; graphics object definition is this long
dm_length       := $00BF                        ; see draw_map and level_maps.txt
dm_progctr      := $00C0                        ; see draw_map and level_maps.txt
dm_objptr       := $00C2                        ; see draw_map and level_maps.txt
dm_screen_addr  := $00C4                        ; points to byte to write gfx data to
dm_x_with_offset:= $00C6                        ; graphics object X offset, plus dm_xpos
dm_y_with_offset:= $00C7                        ; graphics object Y offset, plus dm_xpos
sa_tmp_2        := $00C8                        ; used by calc_screen_addr
dm_delta_x      := $00C9                        ; see draw_map and level_maps.txt
dm_delta_y      := $00CA                        ; see draw_map and level_maps.txt
zp_temp1        := $00CB                        ; used for (zp,y) addressing, also for checking console keys in vblank_imm_isr
num_in          := $00D0                        ; print_number input. 3-byte number (LSB first as usual) to be printed
num_out         := $00D3                        ; area of (screen) memory where print_number stores its output
num_color       := $00D5                        ; print_number adds this to numeric screencode output. normally 0, set to $80 on the end-of-game screen.
demo_map_ptr    := $00E0                        ; points to level_desc of each map in turn, during the 'show all levels' demo
demo_name_offset:= $00E2                        ; offset from level_names to the name of each level in turn, during the 'show all levels' demo
VDSLST          := $0200
VKEYBD          := $0208                        ; === page 2 OS equates
VKEYBD_hi       := $0209
SDMCTL          := $022F
GPRIOR          := $026F
PCOLR0          := $02C0
PCOLR1          := $02C1
PCOLR2          := $02C2
PCOLR3          := $02C3
COLOR0          := $02C4
COLOR1          := $02C5
COLOR2          := $02C6
COLOR3          := $02C7
COLOR4          := $02C8
CHBAS           := $02F4
page6_vectors_minus_one:= $05FF                 ; 1-indexed
page6_vectors   := $0600                        ; initialized with page6_initial_vectors
jiffy_timer_3_lo:= $0619                        ; gets incremented every frame
jiffy_timer_1   := $061A                        ; gets incremented every frame
jiffy_timer_2   := $061B                        ; gets incremented every frame
odd_frame_flag  := $061C                        ; a 1-bit frame counter (toggles every frame). possibly unused.
speed_jiffy_timer:= $061E                       ; counts 0..initial_speed
falling_flag    := $0621                        ; 1 = falling, reset to 0 when jumpman hits the ground
current_speed   := $0624                        ; can be modified, e.g. set to $08 when being electrocuted
initial_speed   := $0625                        ; current user's chosen speed, set at game start
bonus_jiffy_timer:= $0626                       ; gets incremented every frame when playing a level, bonus-=100 when this wraps around to 0
playing_level   := $0627                        ; 0 = not playing, non-0 = playing
sfx_lock        := $062F                        ; lets other code know cue_sfx is still running? not 100% sure
player_delta_x  := $0630                        ; amount to move jumpman this frame (1 or $FF aka -1)
player_delta_y  := $0631                        ; amount to move jumpman this frame (1 or $FF aka -1)
joystick_disabled:= $0632                       ; nonzero = jumpman can't move (title screen or materialization, etc)
joystick_state  := $0633                        ; last PORTA read (bottom 4 bits), or 0 if joystick_disabled
trigger_disabled:= $0634                        ; nonzero = jumpman can't jump (he's already jumping, or title screen or materialization, etc)
trigger_state   := $0635                        ; last TRIG0 read (0 = pressed)
sfx_ptr         := $063C
sfx_slot_priority:= $063E                       ; priority of this sfx
sfx_slot_timer  := $063F
sfx_slot_duration:= $0646
sfx_slot_audc   := $0647
sfx_slot_curpos := $064E                        ; address we've got to so far, playing this sfx
sfx_priority_tmp:= $0661                        ; ??
num_tmp         := $0665                        ; temp used by print_number
player_x_pos    := $067E                        ; stored in HPOSP0
player_y_pos    := $0683                        ; $C6 is the bottom of the level (where you end up when you die)
bullet_x_pos    := $069B                        ; 4 bytes, meaning we can never have >4 bullets on screen at once (makes sense, GTIA only has 4 missiles)
bullet_y_pos_minus_one:= $069E
bullet_y_pos    := $069F                        ; another 4 bytes
dlist_shadow_lo := $06AC                        ; stored in DLISTL if dlist_shadow_hi nonzero
dlist_shadow_hi := $06AD                        ; stored in DLISTH if nonzero
dli_vec_shadow_lo:= $06AE                       ; stored in VDSLST if dli_vec_shadow_hi nonzero
dli_vec_shadow_hi:= $06AF                       ; stored in VDSLST if nonzero
sav_m0pf        := $06B0                        ; Missile 0 to playfield collision.
sav_m1pf        := $06B1                        ; Missile 1 to playfield collision.
sav_m2pf        := $06B2                        ; Missile 2 to playfield collision.
sav_m3pf        := $06B3                        ; Missile 3 to playfield collision.
sav_p0pf        := $06B4                        ; Player 0 to playfield collision.
sav_p1pf        := $06B5                        ; Player 1 to playfield collision.
sav_p2pf        := $06B6                        ; Player 2 to playfield collision.
sav_p3pf        := $06B7                        ; Player 3 to playfield collision.
sav_m0pl        := $06B8                        ; Missile 0 to player collision.
sav_m1pl        := $06B9                        ; Missile 1 to player collision.
sav_m2pl        := $06BA                        ; Missile 2 to player collision.
sav_m3pl        := $06BB                        ; Missile 3 to player collision.
sav_p0pl        := $06BC                        ; Player 0 to player collision.
sav_p1pl        := $06BD                        ; Player 1 to player collision.
sav_p2pl        := $06BE                        ; Player 2 to player collision.
sav_p3pl        := $06BF                        ; Player 3 to player collision.
option_key_vec  := $06C0                        ; vblank_imm_isr jumps thru here if option key pressed
select_key_vec  := $06C2                        ; vblank_imm_isr jumps thru here if select key pressed
start_key_vec   := $06C4                        ; vblank_imm_isr jumps thru here if start key pressed
option_key_enabled:= $06C6                      ; non-zero = jump through start_key_vec if start key pressed (checked by vblank_imm_isr)
select_key_enabled:= $06C7                      ; non-zero = jump through start_key_vec if start key pressed (checked by vblank_imm_isr)
start_key_enabled:= $06C8                       ; non-zero = jump through start_key_vec if start key pressed (checked by vblank_imm_isr)
L06DF           := $06DF
L06E0           := $06E0
L06E3           := $06E3
L06E6           := $06E6
jump_frame      := $06EB                        ; 0 if not jumping, or frames since start of jump (range 1 to 21)
randomizer_mode := $06F3                        ; only after beating levels 1-12 in order
users_still_alive:= $06F4                       ; I *think* that's what this is for.
level           := $06F6
speed_value     := $06F9                        ; decoded speed (1-8)
current_user    := $06FE                        ; this ranges 1-4, not 0-3
number_of_users := $06FF                        ; number of players selected at start of game. also this is score-1, if you see it being 1-indexed with X reg
score           := $0700                        ; aka work_user, 11 bytes
next_extra_life := $0703                        ; initialized to $4c,$1d (aka 7500), 7500 is added whenever an extra life is given
lives           := $070A
struct_user_1   := $070B                        ; 11 bytes
struct_user_2   := $0716                        ; 11 bytes
struct_user_3   := $0721                        ; 11 bytes
struct_user_4   := $072C                        ; 11 bytes
bullet_flags    := $0756                        ; 4 bytes, 0 = bullet slot not in use, non-0 = bullet active
bullet_x_delta  := $075A                        ; 4 bytes
bullet_y_delta  := $075E                        ; 4 bytes
work_level_desc := $0780                        ; first 2 bytes are level number in screencodes
work_level_sub0 := $0782                        ; a subroutine
work_level_sub1 := $0784                        ; a subroutine
work_level_sub2 := $0786                        ; a subroutine
work_level_sub3 := $0788                        ; a subroutine
work_level_num_bombs:= $078A                    ; number of bombs to pick up on this level
work_level_bullet_max:= $078B                   ; 0 = no bullets, range 0-4.
work_level_y_start:= $078C                      ; jumpman starting Y position
work_level_x_start:= $078D                      ; jumpman starting X position
work_level_fudge_x:= $078E                      ; fudge factor for bomb locations, always $00
work_level_fudge_y:= $078F                      ; fudge factor for bomb locations, always $06
work_level_points_per_bomb:= $0790              ; points awarded per bomb pickup (always $64 aka 100)
work_level_time_bonus:= $0791                   ; amount of time bonus at start of level
work_level_offs_19:= $0793                      ; always $00
work_level_unkn_table0:= $0794                  ; pointer to ROM table or $06xx
work_level_map  := $0796                        ; used to draw the level initially (see also map_changes)
work_level_map_bombs:= $0798                    ; start of bombs in map data (which must come last!)
work_level_bomblist:= $079A                     ; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
work_level_map_changes:= $079C                  ; address of list of addresses of map data, used for changing the map when certain bombs are picked up
work_level_indirect_subs:= $079E                ; pointer to list of indirect subs, always $0000 in this game
work_level_sub_bomb:= $07A0                     ; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
work_level_init := $07A2                        ; called at start of level, $06E6 for some levels, or else a ROM subroutine
work_level_sub6 := $07A4                        ; always $9740 aka game_main_loop
work_level_sub_eol:= $07A6                      ; called at end of level (all bombs picked up). $06E6 for all but level08
work_level_offs_40:= $07A8                      ; all zeroes
work_level_colpf3:= $07AE                       ; color (not sure what gets drawn in this color yet)
work_level_colpf0:= $07AF                       ; color for girders and up-ropes
work_level_colpf1:= $07B0                       ; color for ladders and down-ropes
work_level_colpf2:= $07B1                       ; color for bombs
work_level_offs_50:= $07B2                      ; unknown
work_level_offs_55:= $07B7                      ; unknown, always $00 $00 $00
work_level_offs_58:= $07BA                      ; unknown, not a ROM address
work_level_offs_60:= $07BC                      ; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
cur_level_desc  := $07C0                        ; first 2 bytes are level number in screencodes
cur_level_sub0  := $07C2                        ; a subroutine
cur_level_sub1  := $07C4                        ; a subroutine
cur_level_sub2  := $07C6                        ; a subroutine
cur_level_sub3  := $07C8                        ; a subroutine
cur_level_num_bombs:= $07CA                     ; number of bombs to pick up on this level
cur_level_bullet_max:= $07CB                    ; 0 = no bullets, range 0-4.
cur_level_y_start:= $07CC                       ; jumpman starting Y position
cur_level_x_start:= $07CD                       ; jumpman starting X position
cur_level_fudge_x:= $07CE                       ; fudge factor for bomb locations, always $00
cur_level_fudge_y:= $07CF                       ; fudge factor for bomb locations, always $06
cur_level_points_per_bomb:= $07D0               ; points awarded per bomb pickup (always $64 aka 100)
cur_level_time_bonus:= $07D1                    ; amount of time bonus at start of level
cur_level_offs_19:= $07D3                       ; always $00
cur_level_unkn_table0:= $07D4                   ; pointer to ROM table or $06xx
cur_level_map   := $07D6                        ; used to draw the level initially (see also map_changes)
cur_level_map_bombs:= $07D8                     ; start of bombs in map data (which must come last!)
cur_level_bomblist:= $07DA                      ; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
cur_level_map_changes:= $07DC                   ; address of list of addresses of map data, used for changing the map when certain bombs are picked up
cur_level_indirect_subs:= $07DE                 ; pointer to list of indirect subs, always $0000 in this game
cur_level_sub_bomb:= $07E0                      ; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
cur_level_init  := $07E2                        ; called at start of level, $06E6 for some levels, or else a ROM subroutine
cur_level_sub6  := $07E4                        ; always $9740 aka game_main_loop
cur_level_sub_eol:= $07E6                       ; called at end of level (all bombs picked up). $06E6 for all but level08
cur_level_offs_40:= $07E8                       ; all zeroes
cur_level_colpf3:= $07EE                        ; color (not sure what gets drawn in this color yet)
cur_level_colpf0:= $07EF                        ; color for girders and up-ropes
cur_level_colpf1:= $07F0                        ; color for ladders and down-ropes
cur_level_colpf2:= $07F1                        ; color for bombs
cur_level_offs_50:= $07F2                       ; unknown
cur_level_offs_55:= $07F7                       ; unknown, always $00 $00 $00
cur_level_offs_58:= $07FA                       ; unknown, not a ROM address
cur_level_offs_60:= $07FC                       ; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
game_display_list:= $0881                       ; display list for game board
pm_memory       := $2800
HPOSP0_minus_two:= $CFFE
HPOSP3          := $D003                        ; === GTIA equates
HPOSM0          := $D004
HPOSM1          := $D005
HPOSM2          := $D006
HPOSM3          := $D007
SIZEP2          := $D00A
SIZEP3          := $D00B
SIZEM           := $D00C
TRIG0           := $D010
GRAFM           := $D011
COLPM0          := $D012
COLPM1          := $D013
COLPF0          := $D016
COLPF1          := $D017
COLPF2          := $D018
COLPF3          := $D019
COLBK           := $D01A
PRIOR           := $D01B
GRACTL          := $D01D
HITCLR          := $D01E
CONSOL          := $D01F
AUDF1_minus_two := $D1FE                        ; AUDF/AUDC regs are indexed from here
AUDC1_minus_two := $D1FF
AUDF1           := $D200                        ; === POKEY equates
AUDC1           := $D201
AUDF2           := $D202
AUDC2           := $D203
AUDF3           := $D204
AUDC3           := $D205
AUDF4           := $D206
AUDC4           := $D207
AUDCTL          := $D208
KBCODE          := $D209
RANDOM          := $D20A
IRQEN           := $D20E
SKCTL           := $D20F
PORTA           := $D300
DMACTL          := $D400                        ; === ANTIC equates
DLISTL          := $D402
DLISTH          := $D403
HSCROL          := $D404
PMBASE          := $D407
CHBASE          := $D409
WSYNC           := $D40A
NMIEN           := $D40E
SETVBV          := $E45C
XITVBV          := $E462
; ----------------------------------------------------------------------------
; the entry point for parsing the level map and drawing graphics from it. see level_maps.txt.
draw_map_jv:
        jmp     draw_map                        ; 8000 4C 49 80                 LI.

; ----------------------------------------------------------------------------
; if cue_sfx not already in progress, setup to play sfx at (sfx_slot_priority, sfx_lock), priority A
cue_sfx_lowprior_jv:
        jmp     cue_sfx_lowprior                ; 8003 4C 40 82                 L@.

; ----------------------------------------------------------------------------
; setup to play sfx
cue_sfx_jv:
        jmp     cue_sfx                         ; 8006 4C 55 82                 LU.

; ----------------------------------------------------------------------------
; convert the 3-byte integer stored at num_in to screen codes, store into memory pointed to by num_out
print_number_jv:
        jmp     print_number                    ; 8009 4C 00 86                 L..

; ----------------------------------------------------------------------------
; should be called every time the score is updated, adds extra life every 7500 points
check_extra_life_jv:
        jmp     check_extra_life                ; 800C 4C BC 8C                 L..

; ----------------------------------------------------------------------------
; print remaining bonus time
print_bonus_jv:
        jmp     print_bonus                     ; 800F 4C 7E 86                 L~.

; ----------------------------------------------------------------------------
; bottom 2 GR.1 lines on the game board
update_status_window_jv:
        jmp     update_status_window            ; 8012 4C 94 86                 L..

; ----------------------------------------------------------------------------
; for some reason there are 2 copies of the display list, at $0800 and $0881
setup_gameboard_dlist_jv:
        jmp     setup_gameboard_dlist           ; 8015 4C 00 9B                 L..

; ----------------------------------------------------------------------------
; setup to play whichever music is in A reg, using 5-byte sfx stuct
cue_music_jv:
        jmp     cue_music                       ; 8018 4C 92 8F                 L..

; ----------------------------------------------------------------------------
; called after level-intro music is finished playing
enable_joystick_jv:
        jmp     enable_joystick                 ; 801B 4C 75 87                 Lu.

; ----------------------------------------------------------------------------
; clear the gameboard screen memory (called before drawing a level, natch)
clear_screen_mem_jv:
        jmp     clear_screen_mem                ; 801E 4C 14 87                 L..

; ----------------------------------------------------------------------------
; bonus -= 100;
decrement_time_bonus_jv:
        jmp     decrement_time_bonus            ; 8021 4C CE 8D                 L..

; ----------------------------------------------------------------------------
init_struct_users_jv:
        jmp     init_struct_users               ; 8024 4C 5C 9A                 L\.

; ----------------------------------------------------------------------------
; used in multiplayer games, also called in single player (?)
next_player_jv:
        jmp     next_player                     ; 8027 4C AA 9A                 L..

; ----------------------------------------------------------------------------
; calls draw_map, plays level intro music, shows level name
draw_level_jv:
        jmp     draw_level                      ; 802A 4C 00 BA                 L..

; ----------------------------------------------------------------------------
level_finished_jv:
        jmp     level_finished                  ; 802D 4C 00 8E                 L..

; ----------------------------------------------------------------------------
; just lost your last life
crumble_gameboard_jv:
        jmp     crumble_gameboard               ; 8030 4C 00 8D                 L..

; ----------------------------------------------------------------------------
; check whether Jumpman just touched a bomb (RTS if not)
check_bomb_coll_jv:
        jmp     check_bomb_coll                 ; 8033 4C A0 87                 L..

; ----------------------------------------------------------------------------
; various levels use this as their init, or use an init that calls this
special_init_jv:
        jmp     special_init                    ; 8036 4C 23 8B                 L#.

; ----------------------------------------------------------------------------
; special_init that doesn't clear memory. unused vector?
special_init_2_jv:
        jmp     special_init_2                  ; 8039 4C 2D 8B                 L-.

; ----------------------------------------------------------------------------
; show blank screen with empty display list
setup_blank_dlist_jv:
        jmp     setup_blank_dlist               ; 803C 4C E0 8A                 L..

; ----------------------------------------------------------------------------
; 3 unused jump vectors, all pointed to the same RTS
unused_vecs:
        jmp     unused_vec_rts                  ; 803F 4C 48 80                 LH.

; ----------------------------------------------------------------------------
        jmp     unused_vec_rts                  ; 8042 4C 48 80                 LH.

; ----------------------------------------------------------------------------
        jmp     unused_vec_rts                  ; 8045 4C 48 80                 LH.

; ----------------------------------------------------------------------------
; unused jump vectors point here
unused_vec_rts:
        rts                                     ; 8048 60                       `

; ----------------------------------------------------------------------------
; the entry point for parsing the level map and drawing graphics from it. see level_maps.txt. caller must set $C0/$C1 to the address of the map data. modders beware: bogus map data can & will cause infinite loops.
draw_map:
        ldy     #$00                            ; 8049 A0 00                    ..
; $C0/$C1 points to $A300 (level01_desc) on the first call
dm_get_opcode:
        lda     (dm_progctr),y                  ; 804B B1 C0                    ..
; map opcodes: $FC = jump, $FF = end, $FD = set drawing direction, $FE = select graphics object
dm_switch_opcode:
        cmp     #$FC                            ; 804D C9 FC                    ..
        bcc     dm_draw_gfx                     ; 804F 90 3F                    .?
        beq     dm_jump                         ; 8051 F0 09                    ..
        cmp     #$FD                            ; 8053 C9 FD                    ..
        beq     dm_delta                        ; 8055 F0 14                    ..
        cmp     #$FE                            ; 8057 C9 FE                    ..
        beq     dm_obj                          ; 8059 F0 28                    .(
; handle gfx_end opcode
dm_fallthru:
        rts                                     ; 805B 60                       `

; ----------------------------------------------------------------------------
; handle gfx_jump opcode
dm_jump:iny                                     ; 805C C8                       .
        lda     (dm_progctr),y                  ; 805D B1 C0                    ..
        pha                                     ; 805F 48                       H
        iny                                     ; 8060 C8                       .
        lda     (dm_progctr),y                  ; 8061 B1 C0                    ..
        sta     dm_progctr+1                    ; 8063 85 C1                    ..
        pla                                     ; 8065 68                       h
        sta     dm_progctr                      ; 8066 85 C0                    ..
        jmp     draw_map                        ; 8068 4C 49 80                 LI.

; ----------------------------------------------------------------------------
; handle gfx_delta opcode
dm_delta:
        iny                                     ; 806B C8                       .
        lda     (dm_progctr),y                  ; 806C B1 C0                    ..
        sta     dm_delta_x                      ; 806E 85 C9                    ..
        iny                                     ; 8070 C8                       .
        lda     (dm_progctr),y                  ; 8071 B1 C0                    ..
        sta     dm_delta_y                      ; 8073 85 CA                    ..
; all the other opcode handlers jump here
dm_next_opcode:
        lda     dm_progctr                      ; 8075 A5 C0                    ..
        clc                                     ; 8077 18                       .
        adc     #$03                            ; 8078 69 03                    i.
        sta     dm_progctr                      ; 807A 85 C0                    ..
        bcc     draw_map                        ; 807C 90 CB                    ..
        inc     dm_progctr+1                    ; 807E E6 C1                    ..
        jmp     draw_map                        ; 8080 4C 49 80                 LI.

; ----------------------------------------------------------------------------
; handle gfx_object opcode
dm_obj: iny                                     ; 8083 C8                       .
        lda     (dm_progctr),y                  ; 8084 B1 C0                    ..
        sta     dm_objptr                       ; 8086 85 C2                    ..
        iny                                     ; 8088 C8                       .
        lda     (dm_progctr),y                  ; 8089 B1 C0                    ..
        sta     dm_objptr+1                     ; 808B 85 C3                    ..
        jmp     dm_next_opcode                  ; 808D 4C 75 80                 Lu.

; ----------------------------------------------------------------------------
; handle gfx_draw opcode
dm_draw_gfx:
        sta     dm_xpos                         ; 8090 85 55                    .U
        iny                                     ; 8092 C8                       .
        lda     (dm_progctr),y                  ; 8093 B1 C0                    ..
        sta     dm_ypos                         ; 8095 85 54                    .T
        iny                                     ; 8097 C8                       .
        lda     (dm_progctr),y                  ; 8098 B1 C0                    ..
        sta     dm_length                       ; 809A 85 BF                    ..
; loop 'dm_length' times
dm_draw_loop:
        jsr     dm_draw_obj                     ; 809C 20 B4 80                  ..
        dec     dm_length                       ; 809F C6 BF                    ..
        beq     dm_next_opcode                  ; 80A1 F0 D2                    ..
        lda     dm_delta_x                      ; 80A3 A5 C9                    ..
        clc                                     ; 80A5 18                       .
        adc     dm_xpos                         ; 80A6 65 55                    eU
        sta     dm_xpos                         ; 80A8 85 55                    .U
        lda     dm_delta_y                      ; 80AA A5 CA                    ..
        clc                                     ; 80AC 18                       .
        adc     dm_ypos                         ; 80AD 65 54                    eT
        sta     dm_ypos                         ; 80AF 85 54                    .T
        jmp     dm_draw_loop                    ; 80B1 4C 9C 80                 L..

; ----------------------------------------------------------------------------
; draw current object at current x/y position
dm_draw_obj:
        ldy     #$00                            ; 80B4 A0 00                    ..
; object definition ends with $FF
dm_draw_obj_loop:
        lda     (dm_objptr),y                   ; 80B6 B1 C2                    ..
        cmp     #$FF                            ; 80B8 C9 FF                    ..
        bne     dm_obj_to_screen                ; 80BA D0 01                    ..
        rts                                     ; 80BC 60                       `

; ----------------------------------------------------------------------------
; actually write the object's pixels to screen memory. quite hairy.
dm_obj_to_screen:
        sta     dm_count                        ; 80BD 85 BE                    ..
        iny                                     ; 80BF C8                       .
        clc                                     ; 80C0 18                       .
        lda     (dm_objptr),y                   ; 80C1 B1 C2                    ..
        adc     dm_xpos                         ; 80C3 65 55                    eU
        sta     dm_x_with_offset                ; 80C5 85 C6                    ..
        iny                                     ; 80C7 C8                       .
        clc                                     ; 80C8 18                       .
        lda     (dm_objptr),y                   ; 80C9 B1 C2                    ..
        adc     dm_ypos                         ; 80CB 65 54                    eT
        sta     dm_y_with_offset                ; 80CD 85 C7                    ..
        iny                                     ; 80CF C8                       .
; calculate 40 * dm_y_with_offset + dm_x_with_offset + screen mem address, store in dm_screen_addr
calc_screen_addr:
        lda     #$28                            ; 80D0 A9 28                    .(
        sta     sa_tmp_1                        ; 80D2 85 BD                    ..
        lda     #$00                            ; 80D4 A9 00                    ..
        sta     dm_screen_addr                  ; 80D6 85 C4                    ..
        ldx     #$08                            ; 80D8 A2 08                    ..
mul40_loop:
        lsr     sa_tmp_1                        ; 80DA 46 BD                    F.
        bcc     mul40_no_add                    ; 80DC 90 03                    ..
        clc                                     ; 80DE 18                       .
        adc     dm_y_with_offset                ; 80DF 65 C7                    e.
mul40_no_add:
        ror     a                               ; 80E1 6A                       j
        ror     dm_screen_addr                  ; 80E2 66 C4                    f.
        dex                                     ; 80E4 CA                       .
        bne     mul40_loop                      ; 80E5 D0 F3                    ..
        clc                                     ; 80E7 18                       .
        adc     SAVMSC+1                        ; 80E8 65 59                    eY
        sta     dm_screen_addr+1                ; 80EA 85 C5                    ..
        lda     dm_x_with_offset                ; 80EC A5 C6                    ..
        lsr     a                               ; 80EE 4A                       J
        ror     sa_tmp_2                        ; 80EF 66 C8                    f.
        lsr     a                               ; 80F1 4A                       J
        ror     sa_tmp_2                        ; 80F2 66 C8                    f.
        clc                                     ; 80F4 18                       .
        adc     dm_screen_addr                  ; 80F5 65 C4                    e.
        sta     dm_screen_addr                  ; 80F7 85 C4                    ..
        bcc     sa_hi_ok_1                      ; 80F9 90 02                    ..
        inc     dm_screen_addr+1                ; 80FB E6 C5                    ..
sa_hi_ok_1:
        asl     sa_tmp_2                        ; 80FD 06 C8                    ..
        rol     a                               ; 80FF 2A                       *
        asl     sa_tmp_2                        ; 8100 06 C8                    ..
        rol     a                               ; 8102 2A                       *
        and     #$03                            ; 8103 29 03                    ).
        sta     sa_tmp_2                        ; 8105 85 C8                    ..
calc_pixels:
        lda     (dm_objptr),y                   ; 8107 B1 C2                    ..
        sta     sa_tmp_1                        ; 8109 85 BD                    ..
        lda     sa_tmp_2                        ; 810B A5 C8                    ..
        lsr     sa_tmp_1                        ; 810D 46 BD                    F.
        rol     a                               ; 810F 2A                       *
        lsr     sa_tmp_1                        ; 8110 46 BD                    F.
        rol     a                               ; 8112 2A                       *
        sta     sa_tmp_1                        ; 8113 85 BD                    ..
        iny                                     ; 8115 C8                       .
        tya                                     ; 8116 98                       .
        pha                                     ; 8117 48                       H
        ldy     #$00                            ; 8118 A0 00                    ..
        ldx     sa_tmp_2                        ; 811A A6 C8                    ..
        lda     (dm_screen_addr),y              ; 811C B1 C4                    ..
        and     gr7_and_masks,x                 ; 811E 3D 53 81                 =S.
        ldx     sa_tmp_1                        ; 8121 A6 BD                    ..
        ora     gr7_or_masks,x                  ; 8123 1D 43 81                 .C.
        sta     (dm_screen_addr),y              ; 8126 91 C4                    ..
        pla                                     ; 8128 68                       h
        tay                                     ; 8129 A8                       .
        inc     sa_tmp_2                        ; 812A E6 C8                    ..
        lda     sa_tmp_2                        ; 812C A5 C8                    ..
        cmp     #$04                            ; 812E C9 04                    ..
        bcc     sa_hi_ok_2                      ; 8130 90 0A                    ..
        lda     #$00                            ; 8132 A9 00                    ..
        sta     sa_tmp_2                        ; 8134 85 C8                    ..
        inc     dm_screen_addr                  ; 8136 E6 C4                    ..
        bne     sa_hi_ok_2                      ; 8138 D0 02                    ..
        inc     dm_screen_addr+1                ; 813A E6 C5                    ..
sa_hi_ok_2:
        dec     dm_count                        ; 813C C6 BE                    ..
        bne     calc_pixels                     ; 813E D0 C7                    ..
        jmp     dm_draw_obj_loop                ; 8140 4C B6 80                 L..

; ----------------------------------------------------------------------------
gr7_or_masks:
        .byte   $00,$80,$40,$C0,$00,$20,$10,$30 ; 8143 00 80 40 C0 00 20 10 30  ..@.. .0
        .byte   $00,$08,$04,$0C,$00,$02,$01,$03 ; 814B 00 08 04 0C 00 02 01 03  ........
gr7_and_masks:
        .byte   $3F,$CF,$F3,$FC                 ; 8153 3F CF F3 FC              ?...
; ----------------------------------------------------------------------------
; we have 4 slots (because POKEY has 4 voices), X counts down by 2 from 10 to 2 (at 0, the loop exits)
sfx_player_entry:
        ldx     #$0A                            ; 8157 A2 0A                    ..
        lda     sfx_lock                        ; 8159 AD 2F 06                 ./.
        beq     next_sfx_slot                   ; 815C F0 01                    ..
sfx_exit:
        rts                                     ; 815E 60                       `

; ----------------------------------------------------------------------------
next_sfx_slot:
        dex                                     ; 815F CA                       .
        dex                                     ; 8160 CA                       .
        beq     sfx_exit                        ; 8161 F0 FB                    ..
        lda     sfx_slot_priority,x             ; 8163 BD 3E 06                 .>.
        beq     next_sfx_slot                   ; 8166 F0 F7                    ..
; skip it, if slot is inactive
is_slot_active:
        lda     sfx_slot_timer,x                ; 8168 BD 3F 06                 .?.
        beq     sfx_next_note                   ; 816B F0 10                    ..
        dec     sfx_slot_timer,x                ; 816D DE 3F 06                 .?.
        cmp     sfx_slot_duration,x             ; 8170 DD 46 06                 .F.
        bne     next_sfx_slot                   ; 8173 D0 EA                    ..
        lda     #$00                            ; 8175 A9 00                    ..
        sta     AUDC1_minus_two,x               ; 8177 9D FF D1                 ...
        jmp     next_sfx_slot                   ; 817A 4C 5F 81                 L_.

; ----------------------------------------------------------------------------
sfx_next_note:
        lda     sfx_slot_curpos,x               ; 817D BD 4E 06                 .N.
        sta     zp_temp1                        ; 8180 85 CB                    ..
        lda     sfx_slot_curpos+1,x             ; 8182 BD 4F 06                 .O.
        sta     zp_temp1+1                      ; 8185 85 CC                    ..
        ldy     #$00                            ; 8187 A0 00                    ..
        lda     (zp_temp1),y                    ; 8189 B1 CB                    ..
        cmp     #$04                            ; 818B C9 04                    ..
        bcs     sfx_play_note                   ; 818D B0 77                    .w
        cmp     #$01                            ; 818F C9 01                    ..
        beq     sfx_set_audc                    ; 8191 F0 1B                    ..
        cmp     #$02                            ; 8193 C9 02                    ..
        beq     sfx_jump_opcode                 ; 8195 F0 31                    .1
        cmp     #$03                            ; 8197 C9 03                    ..
        beq     sfx_play_rest                   ; 8199 F0 03                    ..
        jmp     sfx_finished                    ; 819B 4C 26 82                 L&.

; ----------------------------------------------------------------------------
; y==0 on entry
sfx_play_rest:
        tya                                     ; 819E 98                       .
        sta     AUDC1_minus_two,x               ; 819F 9D FF D1                 ...
        iny                                     ; 81A2 C8                       .
        lda     (zp_temp1),y                    ; 81A3 B1 CB                    ..
        sta     sfx_slot_timer,x                ; 81A5 9D 3F 06                 .?.
        jsr     inc_sfx_pos                     ; 81A8 20 31 82                  1.
        jmp     is_slot_active                  ; 81AB 4C 68 81                 Lh.

; ----------------------------------------------------------------------------
; y==0 on entry
sfx_set_audc:
        iny                                     ; 81AE C8                       .
        lda     (zp_temp1),y                    ; 81AF B1 CB                    ..
        sta     sfx_slot_audc,x                 ; 81B1 9D 47 06                 .G.
        iny                                     ; 81B4 C8                       .
        lda     (zp_temp1),y                    ; 81B5 B1 CB                    ..
        sta     sfx_slot_duration,x             ; 81B7 9D 46 06                 .F.
        jsr     inc_sfx_pos                     ; 81BA 20 31 82                  1.
        inc     sfx_slot_curpos,x               ; 81BD FE 4E 06                 .N.
        bne     is_slot_active                  ; 81C0 D0 A6                    ..
        inc     sfx_slot_curpos+1,x             ; 81C2 FE 4F 06                 .O.
        jmp     is_slot_active                  ; 81C5 4C 68 81                 Lh.

; ----------------------------------------------------------------------------
; I *think* this jumps to a different sfx address...
sfx_jump_opcode:
        iny                                     ; 81C8 C8                       .
        lda     (zp_temp1),y                    ; 81C9 B1 CB                    ..
        sta     sfx_slot_curpos,x               ; 81CB 9D 4E 06                 .N.
        iny                                     ; 81CE C8                       .
        lda     (zp_temp1),y                    ; 81CF B1 CB                    ..
        sta     sfx_slot_curpos+1,x             ; 81D1 9D 4F 06                 .O.
        iny                                     ; 81D4 C8                       .
        lda     $065E,x                         ; 81D5 BD 5E 06                 .^.
        beq     L81EE                           ; 81D8 F0 14                    ..
        dec     $065E,x                         ; 81DA DE 5E 06                 .^.
        bne     sfx_next_note                   ; 81DD D0 9E                    ..
        lda     $0656,x                         ; 81DF BD 56 06                 .V.
        sta     sfx_slot_curpos,x               ; 81E2 9D 4E 06                 .N.
        lda     $0657,x                         ; 81E5 BD 57 06                 .W.
        sta     sfx_slot_curpos+1,x             ; 81E8 9D 4F 06                 .O.
        jmp     sfx_next_note                   ; 81EB 4C 7D 81                 L}.

; ----------------------------------------------------------------------------
L81EE:  nop                                     ; 81EE EA                       .
        lda     (zp_temp1),y                    ; 81EF B1 CB                    ..
        sta     $065E,x                         ; 81F1 9D 5E 06                 .^.
        lda     zp_temp1                        ; 81F4 A5 CB                    ..
        clc                                     ; 81F6 18                       .
        adc     #$04                            ; 81F7 69 04                    i.
        sta     $0656,x                         ; 81F9 9D 56 06                 .V.
        lda     zp_temp1+1                      ; 81FC A5 CC                    ..
        adc     #$00                            ; 81FE 69 00                    i.
        sta     $0657,x                         ; 8200 9D 57 06                 .W.
        jmp     sfx_next_note                   ; 8203 4C 7D 81                 L}.

; ----------------------------------------------------------------------------
; y==0, a>=4 on entry
sfx_play_note:
        sta     AUDF1_minus_two,x               ; 8206 9D FE D1                 ...
        iny                                     ; 8209 C8                       .
        lda     (zp_temp1),y                    ; 820A B1 CB                    ..
        sta     sfx_slot_timer,x                ; 820C 9D 3F 06                 .?.
        lda     sfx_slot_audc,x                 ; 820F BD 47 06                 .G.
        sta     AUDC1_minus_two,x               ; 8212 9D FF D1                 ...
        clc                                     ; 8215 18                       .
        lda     sfx_slot_curpos,x               ; 8216 BD 4E 06                 .N.
        adc     #$02                            ; 8219 69 02                    i.
        sta     sfx_slot_curpos,x               ; 821B 9D 4E 06                 .N.
        bcc     cpos_hi_ok                      ; 821E 90 03                    ..
        inc     sfx_slot_curpos+1,x             ; 8220 FE 4F 06                 .O.
cpos_hi_ok:
        jmp     is_slot_active                  ; 8223 4C 68 81                 Lh.

; ----------------------------------------------------------------------------
; done playing this sfx, free up the slot, X-indexed
sfx_finished:
        lda     #$00                            ; 8226 A9 00                    ..
        sta     sfx_slot_priority,x             ; 8228 9D 3E 06                 .>.
        sta     AUDC1_minus_two,x               ; 822B 9D FF D1                 ...
        jmp     next_sfx_slot                   ; 822E 4C 5F 81                 L_.

; ----------------------------------------------------------------------------
; point to next byte in current sfx slot indexed by X
inc_sfx_pos:
        clc                                     ; 8231 18                       .
        lda     sfx_slot_curpos,x               ; 8232 BD 4E 06                 .N.
        adc     #$02                            ; 8235 69 02                    i.
        sta     sfx_slot_curpos,x               ; 8237 9D 4E 06                 .N.
        bcc     inc_done                        ; 823A 90 03                    ..
        inc     sfx_slot_curpos+1,x             ; 823C FE 4F 06                 .O.
inc_done:
        rts                                     ; 823F 60                       `

; ----------------------------------------------------------------------------
; if cue_sfx not already in progress, setup to play sfx at (sfx_slot_priority, sfx_lock), priority A
cue_sfx_lowprior:
        pha                                     ; 8240 48                       H
        lda     sfx_ptr+1                       ; 8241 AD 3D 06                 .=.
cue_ok: beq     lp_ok                           ; 8244 F0 02                    ..
        pla                                     ; 8246 68                       h
        rts                                     ; 8247 60                       `

; ----------------------------------------------------------------------------
; copy to sfx_ptr, fall thru to cue_sfx
lp_ok:  lda     sfx_slot_priority               ; 8248 AD 3E 06                 .>.
        sta     sfx_ptr                         ; 824B 8D 3C 06                 .<.
        lda     sfx_slot_timer                  ; 824E AD 3F 06                 .?.
        sta     sfx_ptr+1                       ; 8251 8D 3D 06                 .=.
        pla                                     ; 8254 68                       h
; setup to play sfx at *sfx_ptr, priority in A
cue_sfx:sta     sfx_priority_tmp                ; 8255 8D 61 06                 .a.
        inc     sfx_lock                        ; 8258 EE 2F 06                 ./.
        ldx     #$0A                            ; 825B A2 0A                    ..
next_slot:
        dex                                     ; 825D CA                       .
        dex                                     ; 825E CA                       .
        beq     bump_slot                       ; 825F F0 20                    . 
        lda     sfx_slot_priority,x             ; 8261 BD 3E 06                 .>.
        bne     next_slot                       ; 8264 D0 F7                    ..
; found a free slot, use it
load_slot:
        lda     sfx_ptr                         ; 8266 AD 3C 06                 .<.
        sta     sfx_slot_curpos,x               ; 8269 9D 4E 06                 .N.
        lda     sfx_ptr+1                       ; 826C AD 3D 06                 .=.
        sta     sfx_slot_curpos+1,x             ; 826F 9D 4F 06                 .O.
        lda     sfx_priority_tmp                ; 8272 AD 61 06                 .a.
        sta     sfx_slot_priority,x             ; 8275 9D 3E 06                 .>.
cue_done:
        lda     #$00                            ; 8278 A9 00                    ..
        sta     sfx_ptr+1                       ; 827A 8D 3D 06                 .=.
        dec     sfx_lock                        ; 827D CE 2F 06                 ./.
        rts                                     ; 8280 60                       `

; ----------------------------------------------------------------------------
; couldn't find a free slot, look for a used slot with lower priority than this sfx has
bump_slot:
        ldx     #$0A                            ; 8281 A2 0A                    ..
; until we find one, or ran out of slots to look at
bump_try_next:
        dex                                     ; 8283 CA                       .
        dex                                     ; 8284 CA                       .
; branch to cue_done (give up) if all slots are in use with higher priority than this sfx (which means it won't be heard)
bump_fail:
        beq     cue_done                        ; 8285 F0 F1                    ..
        lda     sfx_slot_priority,x             ; 8287 BD 3E 06                 .>.
        cmp     sfx_priority_tmp                ; 828A CD 61 06                 .a.
        bcc     load_slot                       ; 828D 90 D7                    ..
        jmp     bump_try_next                   ; 828F 4C 83 82                 L..

; ----------------------------------------------------------------------------
        .byte   $82                             ; 8292 82                       .
position_missiles:
        ldx     #$05                            ; 8293 A2 05                    ..
pm_next:dex                                     ; 8295 CA                       .
        beq     missiles_done                   ; 8296 F0 45                    .E
        lda     $069A,x                         ; 8298 BD 9A 06                 ...
        cmp     bullet_y_pos+3,x                ; 829B DD A2 06                 ...
        beq     skip_pos                        ; 829E F0 06                    ..
        sta     bullet_y_pos+3,x                ; 82A0 9D A2 06                 ...
        sta     HPOSP3,x                        ; 82A3 9D 03 D0                 ...
skip_pos:
        lda     $06A6,x                         ; 82A6 BD A6 06                 ...
        cmp     bullet_y_pos_minus_one,x        ; 82A9 DD 9E 06                 ...
        beq     pm_next                         ; 82AC F0 E7                    ..
        tay                                     ; 82AE A8                       .
        lda     $2B00,y                         ; 82AF B9 00 2B                 ..+
        and     missiles_and_masks_minus_one,x  ; 82B2 3D DF 82                 =..
        sta     $2B00,y                         ; 82B5 99 00 2B                 ..+
        lda     $2B01,y                         ; 82B8 B9 01 2B                 ..+
        and     missiles_and_masks_minus_one,x  ; 82BB 3D DF 82                 =..
        sta     $2B01,y                         ; 82BE 99 01 2B                 ..+
        lda     bullet_y_pos_minus_one,x        ; 82C1 BD 9E 06                 ...
        sta     $06A6,x                         ; 82C4 9D A6 06                 ...
        tay                                     ; 82C7 A8                       .
        lda     $2B00,y                         ; 82C8 B9 00 2B                 ..+
        ora     missiles_or_masks_minus_one,x   ; 82CB 1D E3 82                 ...
        sta     $2B00,y                         ; 82CE 99 00 2B                 ..+
        lda     $2B01,y                         ; 82D1 B9 01 2B                 ..+
        ora     missiles_or_masks_minus_one,x   ; 82D4 1D E3 82                 ...
        sta     $2B01,y                         ; 82D7 99 01 2B                 ..+
        jmp     pm_next                         ; 82DA 4C 95 82                 L..

; ----------------------------------------------------------------------------
missiles_done:
missiles_and_masks_minus_one:= * + 2
        jmp     position_players                ; 82DD 4C E9 82                 L..

; ----------------------------------------------------------------------------
missiles_and_masks:
        .byte   $FC,$F3,$CF                     ; 82E0 FC F3 CF                 ...
missiles_or_masks_minus_one:
        .byte   $3F                             ; 82E3 3F                       ?
missiles_or_masks:
        .byte   $03,$0C,$30,$C0                 ; 82E4 03 0C 30 C0              ..0.
; ----------------------------------------------------------------------------
position_done:
        rts                                     ; 82E8 60                       `

; ----------------------------------------------------------------------------
; X counts down 5..1 (starts at 6, immediately decremented, and loop is done with 0). zp_temp1 is ZP pointer to the current player or missile being written to ($2f00..$2b00, or p3/p2/p1/p0/missiles).
position_players:
        lda     #$00                            ; 82E9 A9 00                    ..
        sta     zp_temp1                        ; 82EB 85 CB                    ..
        lda     #$30                            ; 82ED A9 30                    .0
        sta     zp_temp1+1                      ; 82EF 85 CC                    ..
        ldx     #$06                            ; 82F1 A2 06                    ..
next_plr:
        dec     zp_temp1+1                      ; 82F3 C6 CC                    ..
        dex                                     ; 82F5 CA                       .
        beq     position_done                   ; 82F6 F0 F0                    ..
        lda     $0668,x                         ; 82F8 BD 68 06                 .h.
        beq     next_plr                        ; 82FB F0 F6                    ..
        lda     $067C,x                         ; 82FD BD 7C 06                 .|.
        cmp     $068B,x                         ; 8300 DD 8B 06                 ...
        beq     position_pm_vert                ; 8303 F0 1D                    ..
        sta     $068B,x                         ; 8305 9D 8B 06                 ...
        sta     HPOSP0_minus_two,x              ; 8308 9D FE CF                 ...
        cpx     #$01                            ; 830B E0 01                    ..
        bne     position_pm_vert                ; 830D D0 13                    ..
        tay                                     ; 830F A8                       .
; position the 4 missiles side-by-side
position_player_5:
        sty     HPOSM3                          ; 8310 8C 07 D0                 ...
        iny                                     ; 8313 C8                       .
        iny                                     ; 8314 C8                       .
        sty     HPOSM2                          ; 8315 8C 06 D0                 ...
        iny                                     ; 8318 C8                       .
        iny                                     ; 8319 C8                       .
        sty     HPOSM1                          ; 831A 8C 05 D0                 ...
        iny                                     ; 831D C8                       .
        iny                                     ; 831E C8                       .
        sty     HPOSM0                          ; 831F 8C 04 D0                 ...
position_pm_vert:
        lda     $0690,x                         ; 8322 BD 90 06                 ...
        cmp     $0681,x                         ; 8325 DD 81 06                 ...
        bne     skip_vert                       ; 8328 D0 0E                    ..
        lda     $0686,x                         ; 832A BD 86 06                 ...
        cmp     $0695,x                         ; 832D DD 95 06                 ...
        beq     next_plr                        ; 8330 F0 C1                    ..
        sta     $0695,x                         ; 8332 9D 95 06                 ...
        lda     $0690,x                         ; 8335 BD 90 06                 ...
skip_vert:
        sta     zp_temp1                        ; 8338 85 CB                    ..
        lda     $0677,x                         ; 833A BD 77 06                 .w.
        sta     $CF                             ; 833D 85 CF                    ..
        lda     #$00                            ; 833F A9 00                    ..
        tay                                     ; 8341 A8                       .
; write zeroes to unused portion of this player/missile
clear_pm:
        sta     (zp_temp1),y                    ; 8342 91 CB                    ..
        iny                                     ; 8344 C8                       .
        cpy     $CF                             ; 8345 C4 CF                    ..
        bne     clear_pm                        ; 8347 D0 F9                    ..
        lda     $0681,x                         ; 8349 BD 81 06                 ...
        sta     $0690,x                         ; 834C 9D 90 06                 ...
        sta     zp_temp1                        ; 834F 85 CB                    ..
        lda     $066D,x                         ; 8351 BD 6D 06                 .m.
        sta     $CD                             ; 8354 85 CD                    ..
        lda     $0672,x                         ; 8356 BD 72 06                 .r.
        sta     $CE                             ; 8359 85 CE                    ..
        ldy     $0686,x                         ; 835B BC 86 06                 ...
        clc                                     ; 835E 18                       .
L835F:  dey                                     ; 835F 88                       .
        beq     L8370                           ; 8360 F0 0E                    ..
        lda     $CF                             ; 8362 A5 CF                    ..
        adc     $CD                             ; 8364 65 CD                    e.
        sta     $CD                             ; 8366 85 CD                    ..
        bcc     L835F                           ; 8368 90 F5                    ..
        inc     $CE                             ; 836A E6 CE                    ..
        clc                                     ; 836C 18                       .
        jmp     L835F                           ; 836D 4C 5F 83                 L_.

; ----------------------------------------------------------------------------
L8370:  lda     ($CD),y                         ; 8370 B1 CD                    ..
        sta     (zp_temp1),y                    ; 8372 91 CB                    ..
        iny                                     ; 8374 C8                       .
        dec     $CF                             ; 8375 C6 CF                    ..
        bne     L8370                           ; 8377 D0 F7                    ..
        jmp     next_plr                        ; 8379 4C F3 82                 L..

; ----------------------------------------------------------------------------
init_hardware:
        ldx     #$18                            ; 837C A2 18                    ..
init_page6_loop:
        lda     page6_initial_vectors_minus_one,x; 837E BD DD 85                ...
        sta     page6_vectors_minus_one,x       ; 8381 9D FF 05                 ...
        dex                                     ; 8384 CA                       .
        bne     init_page6_loop                 ; 8385 D0 F7                    ..
        stx     AUDCTL                          ; 8387 8E 08 D2                 ...
        lda     #$28                            ; 838A A9 28                    .(
        sta     PMBASE                          ; 838C 8D 07 D4                 ...
; std playfield, enable players + missiles, single-line p/m res, DMA enabled
set_dma_ctl:
        lda     #$3E                            ; 838F A9 3E                    .>
        sta     SDMCTL                          ; 8391 8D 2F 02                 ./.
        sta     DMACTL                          ; 8394 8D 00 D4                 ...
        lda     #$11                            ; 8397 A9 11                    ..
; priority $11: pl0-3, pf0-3, bak (and enable 5th player from the missiles)
init_set_prior:
        sta     GPRIOR                          ; 8399 8D 6F 02                 .o.
        sta     PRIOR                           ; 839C 8D 1B D0                 ...
        lda     #$03                            ; 839F A9 03                    ..
        sta     SKCTL                           ; 83A1 8D 0F D2                 ...
        sta     GRACTL                          ; 83A4 8D 1D D0                 ...
        lda     #$09                            ; 83A7 A9 09                    ..
        sta     current_speed                   ; 83A9 8D 24 06                 .$.
        lda     #$4C                            ; 83AC A9 4C                    .L
        sta     L06E0                           ; 83AE 8D E0 06                 ...
        lda     #$20                            ; 83B1 A9 20                    . 
        sta     L06E3                           ; 83B3 8D E3 06                 ...
; store an RTS at $06E6, which will get JSR'ed to by unused level subroutines
store_rts:
        lda     #$60                            ; 83B6 A9 60                    .`
        sta     L06E6                           ; 83B8 8D E6 06                 ...
; use character set at $9e00 aka charset
set_char_base:
        lda     #$9E                            ; 83BB A9 9E                    ..
        sta     CHBAS                           ; 83BD 8D F4 02                 ...
        sta     CHBASE                          ; 83C0 8D 09 D4                 ...
        lda     #$9D                            ; 83C3 A9 9D                    ..
        sta     $0674                           ; 83C5 8D 74 06                 .t.
        sta     $0675                           ; 83C8 8D 75 06                 .u.
        lda     #$E8                            ; 83CB A9 E8                    ..
        sta     $0670                           ; 83CD 8D 70 06                 .p.
        sta     $066A                           ; 83D0 8D 6A 06                 .j.
        sta     $066B                           ; 83D3 8D 6B 06                 .k.
        lda     #$0A                            ; 83D6 A9 0A                    ..
        sta     $0679                           ; 83D8 8D 79 06                 .y.
        inc     $067A                           ; 83DB EE 7A 06                 .z.
        lda     #$00                            ; 83DE A9 00                    ..
        sta     VKEYBD                          ; 83E0 8D 08 02                 ...
        sta     SAVMSC                          ; 83E3 85 58                    .X
        sta     num_color                       ; 83E5 85 D5                    ..
        lda     #$30                            ; 83E7 A9 30                    .0
; tell OS that screen memory starts at $3000
set_savmsc:
        sta     SAVMSC+1                        ; 83E9 85 59                    .Y
        lda     #$9C                            ; 83EB A9 9C                    ..
; VKEYBD now points to $9c00 aka keyboard_isr
set_vkeybd:
        sta     VKEYBD_hi                       ; 83ED 8D 09 02                 ...
; stub => map_draw_1_blank-1
copy_blank_1_map:
        ldx     #$07                            ; 83F0 A2 07                    ..
cb1_loop:
        lda     stub,x                          ; 83F2 BD 05 84                 ...
        sta     $06D8,x                         ; 83F5 9D D8 06                 ...
        dex                                     ; 83F8 CA                       .
        bne     cb1_loop                        ; 83F9 D0 F7                    ..
        ldy     #$0D                            ; 83FB A0 0D                    ..
        ldx     #$84                            ; 83FD A2 84                    ..
        lda     #$06                            ; 83FF A9 06                    ..
; VVBLKI now points to $840d aka vblank_imm_isr
set_vvblki:
        jsr     SETVBV                          ; 8401 20 5C E4                  \.
        cld                                     ; 8404 D8                       .
; just an RTS
stub:   rts                                     ; 8405 60                       `

; ----------------------------------------------------------------------------
; copied to $06d9 by code at copy_blank_1_map, possibly so it can be modified
map_draw_1_blank:
        .byte   $FE,$49,$9C,$00,$00,$01,$FF     ; 8406 FE 49 9C 00 00 01 FF     .I.....
; ----------------------------------------------------------------------------
; service immediate vblank interrupt
vblank_imm_isr:
        ldx     #$09                            ; 840D A2 09                    ..
; update color regs from shadow regs (X ranges 1 to 9, GRAFM+1 is COLPM0, $2bf+1 is PCOLR0)
update_color_regs:
        lda     $02BF,x                         ; 840F BD BF 02                 ...
        sta     GRAFM,x                         ; 8412 9D 11 D0                 ...
        dex                                     ; 8415 CA                       .
        bne     update_color_regs               ; 8416 D0 F7                    ..
        inc     jiffy_timer_3_lo                ; 8418 EE 19 06                 ...
        bne     no_wrap                         ; 841B D0 02                    ..
        inc     jiffy_timer_3_hi                ; 841D E6 A2                    ..
no_wrap:inc     jiffy_timer_1                   ; 841F EE 1A 06                 ...
        inc     jiffy_timer_2                   ; 8422 EE 1B 06                 ...
        inc     odd_frame_flag                  ; 8425 EE 1C 06                 ...
        lda     odd_frame_flag                  ; 8428 AD 1C 06                 ...
        and     #$01                            ; 842B 29 01                    ).
        sta     odd_frame_flag                  ; 842D 8D 1C 06                 ...
        lda     #$00                            ; 8430 A9 00                    ..
        sta     falling_flag                    ; 8432 8D 21 06                 .!.
        sta     $0622                           ; 8435 8D 22 06                 .".
        sta     $06FD                           ; 8438 8D FD 06                 ...
        inc     $061D                           ; 843B EE 1D 06                 ...
        inc     speed_jiffy_timer               ; 843E EE 1E 06                 ...
        lda     current_speed                   ; 8441 AD 24 06                 .$.
        cmp     #$09                            ; 8444 C9 09                    ..
        bcs     check_time_bonus                ; 8446 B0 36                    .6
        lda     $061D                           ; 8448 AD 1D 06                 ...
        cmp     current_speed                   ; 844B CD 24 06                 .$.
        bcc     check_speed_timer               ; 844E 90 1E                    ..
        lda     #$00                            ; 8450 A9 00                    ..
        sta     $061D                           ; 8452 8D 1D 06                 ...
        inc     falling_flag                    ; 8455 EE 21 06                 .!.
        inc     $061F                           ; 8458 EE 1F 06                 ...
        inc     $0620                           ; 845B EE 20 06                 . .
        lda     $061F                           ; 845E AD 1F 06                 ...
        and     #$01                            ; 8461 29 01                    ).
        sta     $061F                           ; 8463 8D 1F 06                 ...
        lda     $0620                           ; 8466 AD 20 06                 . .
        and     #$03                            ; 8469 29 03                    ).
        sta     $0620                           ; 846B 8D 20 06                 . .
check_speed_timer:
        lda     speed_jiffy_timer               ; 846E AD 1E 06                 ...
        cmp     initial_speed                   ; 8471 CD 25 06                 .%.
        bcc     check_time_bonus                ; 8474 90 08                    ..
        lda     #$00                            ; 8476 A9 00                    ..
        sta     speed_jiffy_timer               ; 8478 8D 1E 06                 ...
        inc     $0622                           ; 847B EE 22 06                 .".
check_time_bonus:
        lda     playing_level                   ; 847E AD 27 06                 .'.
        beq     no_dec_bonus                    ; 8481 F0 08                    ..
        inc     bonus_jiffy_timer               ; 8483 EE 26 06                 .&.
        bne     no_dec_bonus                    ; 8486 D0 03                    ..
        jsr     decrement_time_bonus_jv         ; 8488 20 21 80                  !.
no_dec_bonus:
        lda     jiffy_timer_3_lo                ; 848B AD 19 06                 ...
        and     #$07                            ; 848E 29 07                    ).
        bne     check_joystick_enabled          ; 8490 D0 12                    ..
        inc     $0628                           ; 8492 EE 28 06                 .(.
        lda     $0628                           ; 8495 AD 28 06                 .(.
        and     #$07                            ; 8498 29 07                    ).
        sta     $0628                           ; 849A 8D 28 06                 .(.
        tax                                     ; 849D AA                       .
        lda     data_table_85b6,x               ; 849E BD B6 85                 ...
        sta     $062A                           ; 84A1 8D 2A 06                 .*.
; read the joystick if not disabled
check_joystick_enabled:
        lda     joystick_disabled               ; 84A4 AD 32 06                 .2.
        beq     read_joystick                   ; 84A7 F0 03                    ..
        jmp     store_joystick_state            ; 84A9 4C B1 84                 L..

; ----------------------------------------------------------------------------
; always joystick #1 (all players use the same joystick and pass it around)
read_joystick:
        lda     PORTA                           ; 84AC AD 00 D3                 ...
        and     #$0F                            ; 84AF 29 0F                    ).
; store bottom 4 bits of PORTA, or 0 if joystick_disabled
store_joystick_state:
        sta     joystick_state                  ; 84B1 8D 33 06                 .3.
        asl     a                               ; 84B4 0A                       .
        tax                                     ; 84B5 AA                       .
        lda     movement_direction_table,x      ; 84B6 BD BE 85                 ...
        sta     player_delta_x                  ; 84B9 8D 30 06                 .0.
        lda     movement_direction_table+1,x    ; 84BC BD BF 85                 ...
        sta     player_delta_y                  ; 84BF 8D 31 06                 .1.
        lda     trigger_disabled                ; 84C2 AD 34 06                 .4.
        beq     read_trigger                    ; 84C5 F0 0C                    ..
        cmp     #$01                            ; 84C7 C9 01                    ..
        beq     fake_read_trigger               ; 84C9 F0 02                    ..
        lda     #$00                            ; 84CB A9 00                    ..
; ??
fake_read_trigger:
        sta     trigger_state                   ; 84CD 8D 35 06                 .5.
        jmp     copy_level_vecs                 ; 84D0 4C D9 84                 L..

; ----------------------------------------------------------------------------
; always joystick #1
read_trigger:
        lda     TRIG0                           ; 84D3 AD 10 D0                 ...
        sta     trigger_state                   ; 84D6 8D 35 06                 .5.
; copy work_level vectors to page 6
copy_level_vecs:
        ldx     #$08                            ; 84D9 A2 08                    ..
next_vec:
        lda     work_level_desc+1,x             ; 84DB BD 81 07                 ...
        beq     skip_vec                        ; 84DE F0 0E                    ..
        sta     page6_vectors+3,x               ; 84E0 9D 03 06                 ...
        lda     work_level_desc,x               ; 84E3 BD 80 07                 ...
        sta     page6_vectors+2,x               ; 84E6 9D 02 06                 ...
        lda     #$00                            ; 84E9 A9 00                    ..
        sta     work_level_desc+1,x             ; 84EB 9D 81 07                 ...
skip_vec:
        dex                                     ; 84EE CA                       .
        dex                                     ; 84EF CA                       .
        bne     next_vec                        ; 84F0 D0 E9                    ..
        lda     $0640                           ; 84F2 AD 40 06                 .@.
        ora     $0642                           ; 84F5 0D 42 06                 .B.
        ora     $0644                           ; 84F8 0D 44 06                 .D.
        ora     sfx_slot_duration               ; 84FB 0D 46 06                 .F.
        sta     $0663                           ; 84FE 8D 63 06                 .c.
        ldx     #$10                            ; 8501 A2 10                    ..
; save contents of GTIA collision regs (X ranges 1 to $10, dli_vec_shadow_hi should read collision_save-1)
save_collisions:
        lda     $CFFF,x                         ; 8503 BD FF CF                 ...
        sta     dli_vec_shadow_hi,x             ; 8506 9D AF 06                 ...
        dex                                     ; 8509 CA                       .
        bne     save_collisions                 ; 850A D0 F7                    ..
        inx                                     ; 850C E8                       .
clear_collisions:
        stx     HITCLR                          ; 850D 8E 1E D0                 ...
; update display list, if there's a new one in the shadow reg
update_dlist:
        lda     dlist_shadow_hi                 ; 8510 AD AD 06                 ...
        beq     update_dli_vector               ; 8513 F0 0E                    ..
        sta     DLISTH                          ; 8515 8D 03 D4                 ...
        lda     dlist_shadow_lo                 ; 8518 AD AC 06                 ...
        sta     DLISTL                          ; 851B 8D 02 D4                 ...
; clear the shadow now that we've updated the HW
clear_dlist_shadow:
        lda     #$00                            ; 851E A9 00                    ..
        sta     dlist_shadow_hi                 ; 8520 8D AD 06                 ...
; update DLI vector, if there's a new one in the shadow reg
update_dli_vector:
        lda     dli_vec_shadow_hi               ; 8523 AD AF 06                 ...
        beq     skip_dli                        ; 8526 F0 13                    ..
        sta     VDSLST+1                        ; 8528 8D 01 02                 ...
        lda     dli_vec_shadow_lo               ; 852B AD AE 06                 ...
        sta     VDSLST                          ; 852E 8D 00 02                 ...
; clear the shadow now that we've updated the HW
clear_dli_shadow:
        lda     #$00                            ; 8531 A9 00                    ..
        sta     dli_vec_shadow_hi               ; 8533 8D AF 06                 ...
; enable DLI now that we've set up the vector
enable_dli:
        lda     #$C0                            ; 8536 A9 C0                    ..
        sta     NMIEN                           ; 8538 8D 0E D4                 ...
skip_dli:
        lda     $06FC                           ; 853B AD FC 06                 ...
        cmp     $0888                           ; 853E CD 88 08                 ...
        bcc     L8551                           ; 8541 90 0E                    ..
        inc     $06FD                           ; 8543 EE FD 06                 ...
        inc     $06FB                           ; 8546 EE FB 06                 ...
        lda     #$00                            ; 8549 A9 00                    ..
        sta     $06FC                           ; 854B 8D FC 06                 ...
        jmp     enable_keyboard_irq             ; 854E 4C 54 85                 LT.

; ----------------------------------------------------------------------------
L8551:  inc     $06FC                           ; 8551 EE FC 06                 ...
; $C0 = regular keypress, break keypress
enable_keyboard_irq:
        lda     #$C0                            ; 8554 A9 C0                    ..
        sta     IRQEN                           ; 8556 8D 0E D2                 ...
        cli                                     ; 8559 58                       X
; 8 = silent (0 would be a click)
silence_console_speaker:
        lda     #$08                            ; 855A A9 08                    ..
        sta     CONSOL                          ; 855C 8D 1F D0                 ...
        ldx     #$FF                            ; 855F A2 FF                    ..
; carry set = not pressed, clear = pressed
check_start_key:
        lda     CONSOL                          ; 8561 AD 1F D0                 ...
        sta     zp_temp1                        ; 8564 85 CB                    ..
        lsr     zp_temp1                        ; 8566 46 CB                    F.
        bcs     check_select_key                ; 8568 B0 09                    ..
        lda     start_key_enabled               ; 856A AD C8 06                 ...
        beq     check_select_key                ; 856D F0 04                    ..
        txs                                     ; 856F 9A                       .
        jmp     (start_key_vec)                 ; 8570 6C C4 06                 l..

; ----------------------------------------------------------------------------
; carry set = not pressed, clear = pressed
check_select_key:
        lsr     zp_temp1                        ; 8573 46 CB                    F.
        bcs     check_option_key                ; 8575 B0 09                    ..
        lda     select_key_enabled              ; 8577 AD C7 06                 ...
        beq     check_option_key                ; 857A F0 04                    ..
        txs                                     ; 857C 9A                       .
        jmp     (select_key_vec)                ; 857D 6C C2 06                 l..

; ----------------------------------------------------------------------------
; carry set = not pressed, clear = pressed
check_option_key:
        lsr     zp_temp1                        ; 8580 46 CB                    F.
        bcs     no_consol_pressed               ; 8582 B0 09                    ..
        lda     option_key_enabled              ; 8584 AD C6 06                 ...
        beq     no_consol_pressed               ; 8587 F0 04                    ..
        txs                                     ; 8589 9A                       .
        jmp     (option_key_vec)                ; 858A 6C C0 06                 l..

; ----------------------------------------------------------------------------
; this probably is what rotates the PLAYER SPEED prompt colors. not sure what it's doing with the page 6 vectors.
no_consol_pressed:
        ldx     $0618                           ; 858D AE 18 06                 ...
        cpx     #$18                            ; 8590 E0 18                    ..
        bne     L859C                           ; 8592 D0 08                    ..
        lda     #$00                            ; 8594 A9 00                    ..
        sta     $0618                           ; 8596 8D 18 06                 ...
        jmp     XITVBV                          ; 8599 4C 62 E4                 Lb.

; ----------------------------------------------------------------------------
L859C:  inc     $0618                           ; 859C EE 18 06                 ...
        inc     $0618                           ; 859F EE 18 06                 ...
        lda     page6_vectors+1,x               ; 85A2 BD 01 06                 ...
        beq     no_consol_pressed               ; 85A5 F0 E6                    ..
        sta     $06E5                           ; 85A7 8D E5 06                 ...
        lda     page6_vectors,x                 ; 85AA BD 00 06                 ...
        sta     $06E4                           ; 85AD 8D E4 06                 ...
        jsr     L06E3                           ; 85B0 20 E3 06                  ..
        jmp     no_consol_pressed               ; 85B3 4C 8D 85                 L..

; ----------------------------------------------------------------------------
; used in vblank_imm_isr, not sure for what yet
data_table_85b6:
        .byte   $1A,$96,$28,$66,$C6,$56,$0E,$F6 ; 85B6 1A 96 28 66 C6 56 0E F6  ..(f.V..
; ----------------------------------------------------------------------------
; X/Y movement, indexed by joystick_state << 1, each entry is XXYY, $FF is -1
movement_direction_table:
        .word   $0000,$0000,$0000,$0000         ; 85BE 00 00 00 00 00 00 00 00  ........
        .word   $0000,$0101,$FF01,$0001         ; 85C6 00 00 01 01 01 FF 01 00  ........
        .word   $0000,$01FF,$FFFF,$00FF         ; 85CE 00 00 FF 01 FF FF FF 00  ........
        .word   $0000,$0100,$FF00               ; 85D6 00 00 00 01 00 FF        ......
        .byte   $00                             ; 85DC 00                       .
; 1-indexed
page6_initial_vectors_minus_one:
        .byte   $00                             ; 85DD 00                       .
; copied into page 6 by init_hardware
page6_initial_vectors:
        .addr   check_consol                    ; 85DE C8 88                    ..
        .addr   stub                            ; 85E0 05 84                    ..
        .addr   stub                            ; 85E2 05 84                    ..
        .addr   stub                            ; 85E4 05 84                    ..
        .addr   stub                            ; 85E6 05 84                    ..
        .addr   stub                            ; 85E8 05 84                    ..
        .addr   stub                            ; 85EA 05 84                    ..
        .addr   check_falling_1                 ; 85EC 00 98                    ..
        .addr   position_missiles               ; 85EE 93 82                    ..
        .addr   bullet_logic                    ; 85F0 69 8E                    i.
        .addr   check_falling_2                 ; 85F2 00 89                    ..
        .addr   sfx_player_entry                ; 85F4 57 81                    W.
; ----------------------------------------------------------------------------
zero_filler_85f6:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 85F6 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00                         ; 85FE 00 00                    ..
; ----------------------------------------------------------------------------
; convert the 3-byte integer stored at num_in to screen codes, store into memory pointed to by num_out
print_number:
        ldx     #$00                            ; 8600 A2 00                    ..
        ldy     #$00                            ; 8602 A0 00                    ..
        stx     num_tmp                         ; 8604 8E 65 06                 .e.
; starts at 0, gets added to
next_digit:
        lda     #$10                            ; 8607 A9 10                    ..
        clc                                     ; 8609 18                       .
        adc     num_color                       ; 860A 65 D5                    e.
        sta     (num_out),y                     ; 860C 91 D3                    ..
L860E:  sec                                     ; 860E 38                       8
        lda     num_in                          ; 860F A5 D0                    ..
        sbc     pnum_subtractors,x              ; 8611 FD 02 87                 ...
        sta     num_in                          ; 8614 85 D0                    ..
        lda     num_in+1                        ; 8616 A5 D1                    ..
        sbc     pnum_subtractors+1,x            ; 8618 FD 03 87                 ...
        sta     num_in+1                        ; 861B 85 D1                    ..
        lda     num_in+2                        ; 861D A5 D2                    ..
        sbc     pnum_subtractors+2,x            ; 861F FD 04 87                 ...
        sta     num_in+2                        ; 8622 85 D2                    ..
        bcc     L8633                           ; 8624 90 0D                    ..
        lda     (num_out),y                     ; 8626 B1 D3                    ..
        clc                                     ; 8628 18                       .
        adc     #$01                            ; 8629 69 01                    i.
        sta     (num_out),y                     ; 862B 91 D3                    ..
        sta     num_tmp                         ; 862D 8D 65 06                 .e.
        jmp     L860E                           ; 8630 4C 0E 86                 L..

; ----------------------------------------------------------------------------
L8633:  clc                                     ; 8633 18                       .
        lda     pnum_subtractors,x              ; 8634 BD 02 87                 ...
        adc     num_in                          ; 8637 65 D0                    e.
        sta     num_in                          ; 8639 85 D0                    ..
        lda     pnum_subtractors+1,x            ; 863B BD 03 87                 ...
        adc     num_in+1                        ; 863E 65 D1                    e.
        sta     num_in+1                        ; 8640 85 D1                    ..
        lda     pnum_subtractors+2,x            ; 8642 BD 04 87                 ...
        adc     num_in+2                        ; 8645 65 D2                    e.
        sta     num_in+2                        ; 8647 85 D2                    ..
        lda     num_tmp                         ; 8649 AD 65 06                 .e.
        bne     L865C                           ; 864C D0 0E                    ..
        lda     (num_out),y                     ; 864E B1 D3                    ..
        and     #$0F                            ; 8650 29 0F                    ).
        bne     L865C                           ; 8652 D0 08                    ..
        cpy     #$05                            ; 8654 C0 05                    ..
        beq     pnum_done                       ; 8656 F0 0F                    ..
        lda     #$00                            ; 8658 A9 00                    ..
        sta     (num_out),y                     ; 865A 91 D3                    ..
L865C:  cpx     #$0F                            ; 865C E0 0F                    ..
        beq     pnum_done                       ; 865E F0 07                    ..
        inx                                     ; 8660 E8                       .
        inx                                     ; 8661 E8                       .
        inx                                     ; 8662 E8                       .
        iny                                     ; 8663 C8                       .
        jmp     next_digit                      ; 8664 4C 07 86                 L..

; ----------------------------------------------------------------------------
pnum_done:
        rts                                     ; 8667 60                       `

; ----------------------------------------------------------------------------
print_score:
        lda     #$F5                            ; 8668 A9 F5                    ..
        sta     num_out                         ; 866A 85 D3                    ..
        lda     #$3D                            ; 866C A9 3D                    .=
        sta     num_out+1                       ; 866E 85 D4                    ..
        ldx     #$03                            ; 8670 A2 03                    ..
; number_of_users should be score-1 here.
ps_loop:lda     number_of_users,x               ; 8672 BD FF 06                 ...
        sta     $CF,x                           ; 8675 95 CF                    ..
        dex                                     ; 8677 CA                       .
        bne     ps_loop                         ; 8678 D0 F8                    ..
        jsr     print_number                    ; 867A 20 00 86                  ..
        rts                                     ; 867D 60                       `

; ----------------------------------------------------------------------------
; print remaining bonus time; work_level_points_per_bomb should read work_level_time_bonus-1
print_bonus:
        lda     #$09                            ; 867E A9 09                    ..
        sta     num_out                         ; 8680 85 D3                    ..
        lda     #$3E                            ; 8682 A9 3E                    .>
        sta     num_out+1                       ; 8684 85 D4                    ..
        ldx     #$03                            ; 8686 A2 03                    ..
pb_loop:lda     work_level_points_per_bomb,x    ; 8688 BD 90 07                 ...
        sta     $CF,x                           ; 868B 95 CF                    ..
        dex                                     ; 868D CA                       .
        bne     pb_loop                         ; 868E D0 F8                    ..
        jsr     print_number                    ; 8690 20 00 86                  ..
        rts                                     ; 8693 60                       `

; ----------------------------------------------------------------------------
; bottom 2 GR.1 lines on the game board
update_status_window:
        lda     #$00                            ; 8694 A9 00                    ..
        sta     HSCROL                          ; 8696 8D 04 D4                 ...
        ldx     #$28                            ; 8699 A2 28                    .(
L869B:  lda     L86D9,x                         ; 869B BD D9 86                 ...
        sec                                     ; 869E 38                       8
        sbc     #$20                            ; 869F E9 20                    . 
        sta     $3DE7,x                         ; 86A1 9D E7 3D                 ..=
        dex                                     ; 86A4 CA                       .
        bne     L869B                           ; 86A5 D0 F4                    ..
; 1 to 4
show_current_player:
        lda     current_user                    ; 86A7 AD FE 06                 ...
        ora     #$10                            ; 86AA 09 10                    ..
        sta     $3DE9                           ; 86AC 8D E9 3D                 ..=
        lda     work_level_desc                 ; 86AF AD 80 07                 ...
        sta     $3DED                           ; 86B2 8D ED 3D                 ..=
        lda     work_level_desc+1               ; 86B5 AD 81 07                 ...
        sta     $3DEE                           ; 86B8 8D EE 3D                 ..=
; up to 6 jumpmen, and a + if lives > 6. char $C1 = jumpman icon, $CB = plus sign
show_lives_icons:
        ldy     #$00                            ; 86BB A0 00                    ..
        lda     #$C1                            ; 86BD A9 C1                    ..
L86BF:  cpy     #$07                            ; 86BF C0 07                    ..
        bcs     L86CE                           ; 86C1 B0 0B                    ..
        cpy     lives                           ; 86C3 CC 0A 07                 ...
        beq     L86D3                           ; 86C6 F0 0B                    ..
        sta     $3DFD,y                         ; 86C8 99 FD 3D                 ..=
        iny                                     ; 86CB C8                       .
        bne     L86BF                           ; 86CC D0 F1                    ..
L86CE:  lda     #$CB                            ; 86CE A9 CB                    ..
        sta     $3DFC,y                         ; 86D0 99 FC 3D                 ..=
L86D3:  jsr     print_score                     ; 86D3 20 68 86                  h.
        jsr     print_bonus                     ; 86D6 20 7E 86                  ~.
L86D9:  rts                                     ; 86D9 60                       `

; ----------------------------------------------------------------------------
; 40 bytes, or 2 GR.1 lines of screen codes
status_window_contents:
        .byte   $20,$30,$20,$8C,$7D,$30,$30,$20 ; 86DA 20 30 20 8C 7D 30 30 20   0 .}00 
        .byte   $D3,$C3,$CF,$D2,$C5,$20,$20,$20 ; 86E2 D3 C3 CF D2 C5 20 20 20  .....   
        .byte   $20,$20,$20,$20,$20,$20,$20,$20 ; 86EA 20 20 20 20 20 20 20 20          
        .byte   $20,$20,$20,$20,$C2,$CF,$CE,$D5 ; 86F2 20 20 20 20 C2 CF CE D5      ....
        .byte   $D3,$20,$20,$20,$20,$20,$20,$20 ; 86FA D3 20 20 20 20 20 20 20  .       
; 3 bytes per table entry
pnum_subtractors:
        .byte   $A0,$86,$01,$10,$27,$00,$E8,$03 ; 8702 A0 86 01 10 27 00 E8 03  ....'...
        .byte   $00,$64,$00,$00,$0A,$00,$00,$01 ; 870A 00 64 00 00 0A 00 00 01  .d......
        .byte   $00,$00                         ; 8712 00 00                    ..
; ----------------------------------------------------------------------------
; clear the gameboard screen memory (called before drawing a level, natch)
clear_screen_mem:
        ldx     #$10                            ; 8714 A2 10                    ..
        lda     SAVMSC+1                        ; 8716 A5 59                    .Y
        sta     zp_temp2+1                      ; 8718 85 AF                    ..
        lda     #$00                            ; 871A A9 00                    ..
        sta     zp_temp2                        ; 871C 85 AE                    ..
        tay                                     ; 871E A8                       .
csm_loop:
        sta     (zp_temp2),y                    ; 871F 91 AE                    ..
        iny                                     ; 8721 C8                       .
        bne     csm_loop                        ; 8722 D0 FB                    ..
        inc     zp_temp2+1                      ; 8724 E6 AF                    ..
        dex                                     ; 8726 CA                       .
        bne     csm_loop                        ; 8727 D0 F6                    ..
        rts                                     ; 8729 60                       `

; ----------------------------------------------------------------------------
; misc stuff, called from enable_joystick
prepare_level:
        lda     #$09                            ; 872A A9 09                    ..
        sta     current_speed                   ; 872C 8D 24 06                 .$.
        ldx     #$05                            ; 872F A2 05                    ..
        lda     #$00                            ; 8731 A9 00                    ..
        sta     playing_level                   ; 8733 8D 27 06                 .'.
L8736:  sta     $0681,x                         ; 8736 9D 81 06                 ...
        sta     $0668,x                         ; 8739 9D 68 06                 .h.
        sta     $069A,x                         ; 873C 9D 9A 06                 ...
        jsr     hide_player                     ; 873F 20 B8 8D                  ..
        dex                                     ; 8742 CA                       .
        bne     L8736                           ; 8743 D0 F1                    ..
        lda     #$2B                            ; 8745 A9 2B                    .+
        sta     $B8                             ; 8747 85 B8                    ..
        lda     #$00                            ; 8749 A9 00                    ..
        sta     $B7                             ; 874B 85 B7                    ..
        tay                                     ; 874D A8                       .
        ldx     #$05                            ; 874E A2 05                    ..
L8750:  sta     ($B7),y                         ; 8750 91 B7                    ..
        iny                                     ; 8752 C8                       .
        bne     L8750                           ; 8753 D0 FB                    ..
        inc     $B8                             ; 8755 E6 B8                    ..
        dex                                     ; 8757 CA                       .
        bne     L8750                           ; 8758 D0 F6                    ..
        rts                                     ; 875A 60                       `

; ----------------------------------------------------------------------------
; set all AUDFx to 0
silence_audio:
        ldx     #$00                            ; 875B A2 00                    ..
        lda     #$00                            ; 875D A9 00                    ..
sa_loop:sta     $0640,x                         ; 875F 9D 40 06                 .@.
        sta     $0641,x                         ; 8762 9D 41 06                 .A.
        sta     $0660,x                         ; 8765 9D 60 06                 .`.
        sta     AUDF1,x                         ; 8768 9D 00 D2                 ...
        jsr     store_audc                      ; 876B 20 C6 8D                  ..
        inx                                     ; 876E E8                       .
        inx                                     ; 876F E8                       .
        cpx     #$08                            ; 8770 E0 08                    ..
        bne     sa_loop                         ; 8772 D0 EB                    ..
        rts                                     ; 8774 60                       `

; ----------------------------------------------------------------------------
; called after level-intro music is finished playing
enable_joystick:
        ldx     #$08                            ; 8775 A2 08                    ..
ej_loop:lda     #$E6                            ; 8777 A9 E6                    ..
        sta     work_level_desc,x               ; 8779 9D 80 07                 ...
        lda     #$06                            ; 877C A9 06                    ..
        sta     work_level_desc+1,x             ; 877E 9D 81 07                 ...
        dex                                     ; 8781 CA                       .
        dex                                     ; 8782 CA                       .
        bne     ej_loop                         ; 8783 D0 F2                    ..
        stx     joystick_disabled               ; 8785 8E 32 06                 .2.
        stx     sfx_lock                        ; 8788 8E 2F 06                 ./.
        stx     work_level_bullet_max           ; 878B 8E 8B 07                 ...
        jsr     prepare_level                   ; 878E 20 2A 87                  *.
        jsr     silence_audio                   ; 8791 20 5B 87                  [.
        lda     #$30                            ; 8794 A9 30                    .0
        sta     SAVMSC+1                        ; 8796 85 59                    .Y
; priority $11: pl0-3, pf0-3, bak (and enable 5th player from the missiles) [redundant? init_set_prior sets this, nothing appears to change it]
set_prior:
        lda     #$11                            ; 8798 A9 11                    ..
        sta     PRIOR                           ; 879A 8D 1B D0                 ...
        jmp     clear_pm_mem                    ; 879D 4C A8 88                 L..

; ----------------------------------------------------------------------------
; check whether Jumpman just touched a bomb (RTS if not)
check_bomb_coll:
        lda     sav_p0pf                        ; 87A0 AD B4 06                 ...
        and     #$04                            ; 87A3 29 04                    ).
        bne     bomb_pickup                     ; 87A5 D0 01                    ..
        rts                                     ; 87A7 60                       `

; ----------------------------------------------------------------------------
; Jumpman just touched a bomb, award points, play sfx_bomb_pickup, make the bomb disappear, etc.
bomb_pickup:
        lda     player_x_pos                    ; 87A8 AD 7E 06                 .~.
        clc                                     ; 87AB 18                       .
        adc     work_level_fudge_x              ; 87AC 6D 8E 07                 m..
        and     #$E0                            ; 87AF 29 E0                    ).
        sta     bombloc                         ; 87B1 85 B6                    ..
        clc                                     ; 87B3 18                       .
        lda     player_y_pos                    ; 87B4 AD 83 06                 ...
        adc     work_level_fudge_y              ; 87B7 6D 8F 07                 m..
        and     #$E0                            ; 87BA 29 E0                    ).
        lsr     a                               ; 87BC 4A                       J
        lsr     a                               ; 87BD 4A                       J
        lsr     a                               ; 87BE 4A                       J
        lsr     a                               ; 87BF 4A                       J
        ora     bombloc                         ; 87C0 05 B6                    ..
        sta     bombloc                         ; 87C2 85 B6                    ..
; screen X range approx $32 to $C6, Y $18 to $C0, meaning the coarse grid visible screen range is X 1-6, Y 0-6
coarse_grid:
        lda     work_level_bomblist             ; 87C4 AD 9A 07                 ...
        sta     blistptr                        ; 87C7 85 B4                    ..
        lda     work_level_bomblist+1           ; 87C9 AD 9B 07                 ...
        sta     blistptr+1                      ; 87CC 85 B5                    ..
        ldy     #$00                            ; 87CE A0 00                    ..
; set Y to the index of the current bomb (or rts if we can't find it)
search_bomblist:
        lda     (blistptr),y                    ; 87D0 B1 B4                    ..
        cmp     #$FF                            ; 87D2 C9 FF                    ..
        bne     bl_ok                           ; 87D4 D0 01                    ..
        rts                                     ; 87D6 60                       `

; ----------------------------------------------------------------------------
bl_ok:  cmp     bombloc                         ; 87D7 C5 B6                    ..
        beq     bomb_found                      ; 87D9 F0 05                    ..
        iny                                     ; 87DB C8                       .
        iny                                     ; 87DC C8                       .
        jmp     search_bomblist                 ; 87DD 4C D0 87                 L..

; ----------------------------------------------------------------------------
bomb_found:
        lda     work_level_map_bombs            ; 87E0 AD 98 07                 ...
        sta     $B0                             ; 87E3 85 B0                    ..
        lda     work_level_map_bombs+1          ; 87E5 AD 99 07                 ...
        sta     $B1                             ; 87E8 85 B1                    ..
; multiply Y by 1.5 (only works because Y will always be even at this point)
mul_y:  tya                                     ; 87EA 98                       .
        sta     bomb_idx                        ; 87EB 85 B2                    ..
        lsr     a                               ; 87ED 4A                       J
        clc                                     ; 87EE 18                       .
        adc     bomb_idx                        ; 87EF 65 B2                    e.
        tay                                     ; 87F1 A8                       .
; store actual bomb coordinates (not the coarse ones) for bomb subs to use
store_bomb_coords:
        lda     ($B0),y                         ; 87F2 B1 B0                    ..
        sta     $06DC                           ; 87F4 8D DC 06                 ...
        iny                                     ; 87F7 C8                       .
        lda     ($B0),y                         ; 87F8 B1 B0                    ..
        sta     $06DD                           ; 87FA 8D DD 06                 ...
        lda     #$92                            ; 87FD A9 92                    ..
        sta     sfx_ptr                         ; 87FF 8D 3C 06                 .<.
        lda     #$88                            ; 8802 A9 88                    ..
        sta     sfx_ptr+1                       ; 8804 8D 3D 06                 .=.
        lda     #$08                            ; 8807 A9 08                    ..
        jsr     cue_sfx_jv                      ; 8809 20 06 80                  ..
        ldy     bomb_idx                        ; 880C A4 B2                    ..
        iny                                     ; 880E C8                       .
        lda     (blistptr),y                    ; 880F B1 B4                    ..
        beq     call_bomb_sub                   ; 8811 F0 43                    .C
        and     #$F0                            ; 8813 29 F0                    ).
        beq     check_ind_sub                   ; 8815 F0 1A                    ..
        lsr     a                               ; 8817 4A                       J
        lsr     a                               ; 8818 4A                       J
        lsr     a                               ; 8819 4A                       J
        tay                                     ; 881A A8                       .
; some bombs redraw parts of the level (e.g. disappearing platforms on level01)
change_map:
        lda     work_level_map_changes          ; 881B AD 9C 07                 ...
        sta     $B0                             ; 881E 85 B0                    ..
        lda     work_level_map_changes+1        ; 8820 AD 9D 07                 ...
        sta     $B1                             ; 8823 85 B1                    ..
        lda     ($B0),y                         ; 8825 B1 B0                    ..
        sta     dm_progctr                      ; 8827 85 C0                    ..
        iny                                     ; 8829 C8                       .
        lda     ($B0),y                         ; 882A B1 B0                    ..
        sta     dm_progctr+1                    ; 882C 85 C1                    ..
        jsr     draw_map_jv                     ; 882E 20 00 80                  ..
; see if this bomb calls an indirect sub (none of them do in this game, this is useless code)
check_ind_sub:
        ldy     bomb_idx                        ; 8831 A4 B2                    ..
        iny                                     ; 8833 C8                       .
        lda     (blistptr),y                    ; 8834 B1 B4                    ..
        beq     call_bomb_sub                   ; 8836 F0 1E                    ..
        and     #$0F                            ; 8838 29 0F                    ).
        beq     call_bomb_sub                   ; 883A F0 1A                    ..
        asl     a                               ; 883C 0A                       .
        tay                                     ; 883D A8                       .
; this would call a subroutine via pointer-to-pointer, but I'm almost 100% certain it's never used (maybe a holdover from original Jumpman?)
call_bomb_indirect_sub:
        lda     work_level_indirect_subs        ; 883E AD 9E 07                 ...
        sta     $B0                             ; 8841 85 B0                    ..
        lda     work_level_indirect_subs+1      ; 8843 AD 9F 07                 ...
        sta     $B1                             ; 8846 85 B1                    ..
        lda     ($B0),y                         ; 8848 B1 B0                    ..
        sta     $06E4                           ; 884A 8D E4 06                 ...
        iny                                     ; 884D C8                       .
        lda     ($B0),y                         ; 884E B1 B0                    ..
        sta     $06E5                           ; 8850 8D E5 06                 ...
        jsr     L06E3                           ; 8853 20 E3 06                  ..
; call bomb pickup subroutine for this level (which might just do an RTS if there's no special action)
call_bomb_sub:
        lda     work_level_sub_bomb             ; 8856 AD A0 07                 ...
        sta     $06E4                           ; 8859 8D E4 06                 ...
        lda     work_level_sub_bomb+1           ; 885C AD A1 07                 ...
        sta     $06E5                           ; 885F 8D E5 06                 ...
        jsr     L06E3                           ; 8862 20 E3 06                  ..
; add points to score for picking up bomb (theoretically different on every level, but really $64 aka 100 for all of them)
bomb_add_points:
        clc                                     ; 8865 18                       .
        lda     score                           ; 8866 AD 00 07                 ...
        adc     work_level_points_per_bomb      ; 8869 6D 90 07                 m..
        sta     score                           ; 886C 8D 00 07                 ...
        bcc     erase_bomb                      ; 886F 90 08                    ..
        inc     score+1                         ; 8871 EE 01 07                 ...
        bne     erase_bomb                      ; 8874 D0 03                    ..
        inc     score+2                         ; 8876 EE 02 07                 ...
; make the bomb disappear by drawing sh_blank in its location
erase_bomb:
        lda     #$D9                            ; 8879 A9 D9                    ..
        sta     dm_progctr                      ; 887B 85 C0                    ..
        lda     #$06                            ; 887D A9 06                    ..
        sta     dm_progctr+1                    ; 887F 85 C1                    ..
        jsr     draw_map_jv                     ; 8881 20 00 80                  ..
        jsr     check_extra_life_jv             ; 8884 20 0C 80                  ..
        dec     work_level_num_bombs            ; 8887 CE 8A 07                 ...
; wait for bomb to really disappear
wait_bomb:
        lda     sav_p0pf                        ; 888A AD B4 06                 ...
        and     #$04                            ; 888D 29 04                    ).
        bne     wait_bomb                       ; 888F D0 F9                    ..
        rts                                     ; 8891 60                       `

; ----------------------------------------------------------------------------
; played when a bomb is picked up
sfx_bomb_pickup:
        .byte   $01,$A6,$00,$1E,$03,$28,$03,$1E ; 8892 01 A6 00 1E 03 28 03 1E  .....(..
        .byte   $03,$28,$03,$1E,$03,$28,$03,$1E ; 889A 03 28 03 1E 03 28 03 1E  .(...(..
        .byte   $03,$28,$03,$00,$00,$00         ; 88A2 03 28 03 00 00 00        .(....
; ----------------------------------------------------------------------------
; clear P/M memory, called from enable_joystick
clear_pm_mem:
        ldx     #$00                            ; 88A8 A2 00                    ..
        txa                                     ; 88AA 8A                       .
clr_loop:
        sta     $2B00,x                         ; 88AB 9D 00 2B                 ..+
        sta     $2C00,x                         ; 88AE 9D 00 2C                 ..,
        sta     $2D00,x                         ; 88B1 9D 00 2D                 ..-
        sta     $2E00,x                         ; 88B4 9D 00 2E                 ...
        sta     $2F00,x                         ; 88B7 9D 00 2F                 ../
        dex                                     ; 88BA CA                       .
        bne     clr_loop                        ; 88BB D0 EE                    ..
        rts                                     ; 88BD 60                       `

; ----------------------------------------------------------------------------
zero_filler_88be:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 88BE 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00                         ; 88C6 00 00                    ..
; ----------------------------------------------------------------------------
check_consol:
        lda     player_delta_x                  ; 88C8 AD 30 06                 .0.
        ora     player_delta_y                  ; 88CB 0D 31 06                 .1.
        bne     L88DC                           ; 88CE D0 0C                    ..
        lda     CONSOL                          ; 88D0 AD 1F D0                 ...
        and     #$07                            ; 88D3 29 07                    ).
        cmp     #$07                            ; 88D5 C9 07                    ..
        bne     L88DC                           ; 88D7 D0 03                    ..
        jmp     L88E0                           ; 88D9 4C E0 88                 L..

; ----------------------------------------------------------------------------
L88DC:  lda     #$00                            ; 88DC A9 00                    ..
        sta     jiffy_timer_3_hi                ; 88DE 85 A2                    ..
L88E0:  lda     $A0                             ; 88E0 A5 A0                    ..
        bne     L88E7                           ; 88E2 D0 03                    ..
        sta     jiffy_timer_3_hi                ; 88E4 85 A2                    ..
L88E6:  rts                                     ; 88E6 60                       `

; ----------------------------------------------------------------------------
L88E7:  lda     jiffy_timer_3_hi                ; 88E7 A5 A2                    ..
        cmp     #$28                            ; 88E9 C9 28                    .(
        bcc     L88E6                           ; 88EB 90 F9                    ..
        lda     #$00                            ; 88ED A9 00                    ..
        sta     $A0                             ; 88EF 85 A0                    ..
        sta     jiffy_timer_3_hi                ; 88F1 85 A2                    ..
        ldx     #$FF                            ; 88F3 A2 FF                    ..
        txs                                     ; 88F5 9A                       .
        jmp     init_game                       ; 88F6 4C 00 90                 L..

; ----------------------------------------------------------------------------
zero_filler_88f9:
        .byte   $00,$00,$00,$00,$00,$00,$00     ; 88F9 00 00 00 00 00 00 00     .......
; ----------------------------------------------------------------------------
; called via vector in page 6
check_falling_2:
        lda     falling_flag                    ; 8900 AD 21 06                 .!.
        beq     L890F                           ; 8903 F0 0A                    ..
        lda     $0623                           ; 8905 AD 23 06                 .#.
        cmp     #$01                            ; 8908 C9 01                    ..
        beq     L8910                           ; 890A F0 04                    ..
        jmp     L89F3                           ; 890C 4C F3 89                 L..

; ----------------------------------------------------------------------------
L890F:  rts                                     ; 890F 60                       `

; ----------------------------------------------------------------------------
L8910:  lda     $06EE                           ; 8910 AD EE 06                 ...
        bne     L8945                           ; 8913 D0 30                    .0
        inc     $06EE                           ; 8915 EE EE 06                 ...
        lda     #$02                            ; 8918 A9 02                    ..
        sta     current_speed                   ; 891A 8D 24 06                 .$.
        sta     $067F                           ; 891D 8D 7F 06                 ...
        lda     #$00                            ; 8920 A9 00                    ..
        sta     playing_level                   ; 8922 8D 27 06                 .'.
        sta     $06E9                           ; 8925 8D E9 06                 ...
        sta     $06EA                           ; 8928 8D EA 06                 ...
        lda     RANDOM                          ; 892B AD 0A D2                 ...
        and     #$0F                            ; 892E 29 0F                    ).
        sta     $0688                           ; 8930 8D 88 06                 ...
        inc     $0688                           ; 8933 EE 88 06                 ...
play_sfx_death:
        lda     #$60                            ; 8936 A9 60                    .`
        sta     sfx_slot_priority               ; 8938 8D 3E 06                 .>.
        lda     #$8A                            ; 893B A9 8A                    ..
        sta     sfx_slot_timer                  ; 893D 8D 3F 06                 .?.
        lda     #$07                            ; 8940 A9 07                    ..
        jsr     cue_sfx_lowprior_jv             ; 8942 20 03 80                  ..
L8945:  lda     player_y_pos                    ; 8945 AD 83 06                 ...
        cmp     #$C6                            ; 8948 C9 C6                    ..
        bcc     L895D                           ; 894A 90 11                    ..
        lda     #$00                            ; 894C A9 00                    ..
        sta     AUDF1                           ; 894E 8D 00 D2                 ...
        sta     AUDC1                           ; 8951 8D 01 D2                 ...
        sta     $06EF                           ; 8954 8D EF 06                 ...
        inc     $0623                           ; 8957 EE 23 06                 .#.
        jmp     L89F3                           ; 895A 4C F3 89                 L..

; ----------------------------------------------------------------------------
L895D:  lda     #$70                            ; 895D A9 70                    .p
        sta     $0801                           ; 895F 8D 01 08                 ...
        sta     game_display_list               ; 8962 8D 81 08                 ...
        lda     $06EA                           ; 8965 AD EA 06                 ...
        bne     L89A9                           ; 8968 D0 3F                    .?
L896A:  inc     player_y_pos                    ; 896A EE 83 06                 ...
        inc     player_y_pos                    ; 896D EE 83 06                 ...
        lda     player_y_pos                    ; 8970 AD 83 06                 ...
        sta     AUDF1                           ; 8973 8D 00 D2                 ...
        lda     #$A3                            ; 8976 A9 A3                    ..
        sta     AUDC1                           ; 8978 8D 01 D2                 ...
        lda     sav_p0pf                        ; 897B AD B4 06                 ...
        and     #$01                            ; 897E 29 01                    ).
        bne     falling_bounce                  ; 8980 D0 01                    ..
        rts                                     ; 8982 60                       `

; ----------------------------------------------------------------------------
; this looks like it hurts...
falling_bounce:
        lda     RANDOM                          ; 8983 AD 0A D2                 ...
        and     #$03                            ; 8986 29 03                    ).
        beq     falling_bounce                  ; 8988 F0 F9                    ..
        sta     $06E9                           ; 898A 8D E9 06                 ...
        lda     #$00                            ; 898D A9 00                    ..
        sta     $06EA                           ; 898F 8D EA 06                 ...
        lda     #$50                            ; 8992 A9 50                    .P
        sta     $0801                           ; 8994 8D 01 08                 ...
        sta     game_display_list               ; 8997 8D 81 08                 ...
play_sfx_bounce_1:
        lda     #$4B                            ; 899A A9 4B                    .K
        sta     sfx_slot_priority               ; 899C 8D 3E 06                 .>.
        lda     #$8A                            ; 899F A9 8A                    ..
        sta     sfx_slot_timer                  ; 89A1 8D 3F 06                 .?.
        lda     #$04                            ; 89A4 A9 04                    ..
        jsr     cue_sfx_lowprior_jv             ; 89A6 20 03 80                  ..
L89A9:  ldx     $06EA                           ; 89A9 AE EA 06                 ...
        cpx     #$09                            ; 89AC E0 09                    ..
        bne     L89B8                           ; 89AE D0 08                    ..
        lda     #$00                            ; 89B0 A9 00                    ..
        sta     $06EA                           ; 89B2 8D EA 06                 ...
        jmp     L896A                           ; 89B5 4C 6A 89                 Lj.

; ----------------------------------------------------------------------------
L89B8:  ldy     falling_table_1,x               ; 89B8 BC 39 8A                 .9.
        lda     $06E9                           ; 89BB AD E9 06                 ...
        cmp     #$01                            ; 89BE C9 01                    ..
        beq     L89D1                           ; 89C0 F0 0F                    ..
        ldy     #$00                            ; 89C2 A0 00                    ..
        cmp     #$02                            ; 89C4 C9 02                    ..
        beq     L89D1                           ; 89C6 F0 09                    ..
        lda     falling_table_1,x               ; 89C8 BD 39 8A                 .9.
        eor     #$FF                            ; 89CB 49 FF                    I.
        clc                                     ; 89CD 18                       .
        adc     #$01                            ; 89CE 69 01                    i.
        tay                                     ; 89D0 A8                       .
L89D1:  clc                                     ; 89D1 18                       .
        tya                                     ; 89D2 98                       .
        adc     player_x_pos                    ; 89D3 6D 7E 06                 m~.
        sta     player_x_pos                    ; 89D6 8D 7E 06                 .~.
        lda     falling_table_2,x               ; 89D9 BD 42 8A                 .B.
        clc                                     ; 89DC 18                       .
        adc     player_y_pos                    ; 89DD 6D 83 06                 m..
        sta     player_y_pos                    ; 89E0 8D 83 06                 ...
        sta     AUDF1                           ; 89E3 8D 00 D2                 ...
        inc     $06EA                           ; 89E6 EE EA 06                 ...
        clc                                     ; 89E9 18                       .
        lda     $0620                           ; 89EA AD 20 06                 . .
        adc     #$12                            ; 89ED 69 12                    i.
        sta     $0688                           ; 89EF 8D 88 06                 ...
        rts                                     ; 89F2 60                       `

; ----------------------------------------------------------------------------
L89F3:  lda     $0623                           ; 89F3 AD 23 06                 .#.
        cmp     #$02                            ; 89F6 C9 02                    ..
        beq     L89FB                           ; 89F8 F0 01                    ..
        rts                                     ; 89FA 60                       `

; ----------------------------------------------------------------------------
L89FB:  lda     $06EF                           ; 89FB AD EF 06                 ...
        bne     L8A16                           ; 89FE D0 16                    ..
        sta     jiffy_timer_2                   ; 8A00 8D 1B 06                 ...
        inc     $06EF                           ; 8A03 EE EF 06                 ...
        lda     #$00                            ; 8A06 A9 00                    ..
        jsr     cue_music_jv                    ; 8A08 20 18 80                  ..
        lda     #$04                            ; 8A0B A9 04                    ..
        sta     current_speed                   ; 8A0D 8D 24 06                 .$.
        lda     #$16                            ; 8A10 A9 16                    ..
        sta     $0688                           ; 8A12 8D 88 06                 ...
        rts                                     ; 8A15 60                       `

; ----------------------------------------------------------------------------
L8A16:  lda     $0663                           ; 8A16 AD 63 06                 .c.
        beq     L8A25                           ; 8A19 F0 0A                    ..
        lda     #$16                            ; 8A1B A9 16                    ..
        clc                                     ; 8A1D 18                       .
        adc     $061F                           ; 8A1E 6D 1F 06                 m..
        sta     $0688                           ; 8A21 8D 88 06                 ...
        rts                                     ; 8A24 60                       `

; ----------------------------------------------------------------------------
L8A25:  lda     #$09                            ; 8A25 A9 09                    ..
        sta     current_speed                   ; 8A27 8D 24 06                 .$.
        lda     #$00                            ; 8A2A A9 00                    ..
        sta     $0623                           ; 8A2C 8D 23 06                 .#.
        sta     player_x_pos                    ; 8A2F 8D 7E 06                 .~.
        dec     lives                           ; 8A32 CE 0A 07                 ...
        sta     $06EE                           ; 8A35 8D EE 06                 ...
        rts                                     ; 8A38 60                       `

; ----------------------------------------------------------------------------
falling_table_1:
        .byte   $02,$02,$02,$02,$02,$02,$00,$00 ; 8A39 02 02 02 02 02 02 00 00  ........
        .byte   $00                             ; 8A41 00                       .
falling_table_2:
        .byte   $FE,$FE,$00,$00,$02,$02,$02,$02 ; 8A42 FE FE 00 00 02 02 02 02  ........
        .byte   $02                             ; 8A4A 02                       .
; used when jumpman is falling?
sfx_bounce_1:
        .byte   $01,$8E,$00,$30,$01,$01,$8B,$00 ; 8A4B 01 8E 00 30 01 01 8B 00  ...0....
        .byte   $40,$01,$01,$88,$00,$50,$01,$01 ; 8A53 40 01 01 88 00 50 01 01  @....P..
        .byte   $85,$00,$60,$01,$00             ; 8A5B 85 00 60 01 00           ..`..
; jumpman hit by bullet or started falling
sfx_death:
        .byte   $01,$C8,$00,$0A,$02,$FA,$02,$14 ; 8A60 01 C8 00 0A 02 FA 02 14  ........
        .byte   $02,$F0,$02,$1E,$02,$E8,$02,$28 ; 8A68 02 F0 02 1E 02 E8 02 28  .......(
        .byte   $02,$DC,$02,$32,$02,$D2,$02,$3C ; 8A70 02 DC 02 32 02 D2 02 3C  ...2...<
        .byte   $02,$C8,$02,$00,$00,$00,$00,$00 ; 8A78 02 C8 02 00 00 00 00 00  ........
; ----------------------------------------------------------------------------
play_sfx_climb:
        lda     $061F                           ; 8A80 AD 1F 06                 ...
        bne     L8A94                           ; 8A83 D0 0F                    ..
        lda     #$97                            ; 8A85 A9 97                    ..
        sta     sfx_slot_priority               ; 8A87 8D 3E 06                 .>.
        lda     #$8A                            ; 8A8A A9 8A                    ..
        sta     sfx_slot_timer                  ; 8A8C 8D 3F 06                 .?.
        lda     #$02                            ; 8A8F A9 02                    ..
        jsr     cue_sfx_lowprior_jv             ; 8A91 20 03 80                  ..
L8A94:  jmp     L9925                           ; 8A94 4C 25 99                 L%.

; ----------------------------------------------------------------------------
; climbing up/down a ladder (not ropes)
sfx_climb:
        .byte   $01,$81,$00,$04,$01,$00,$00,$00 ; 8A97 01 81 00 04 01 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8A9F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8AA7 00 00 00 00 00 00 00 00  ........
        .byte   $00                             ; 8AAF 00                       .
sfx_option_pressed:
        .byte   $01,$A4,$00,$3C,$02,$00,$00,$00 ; 8AB0 01 A4 00 3C 02 00 00 00  ...<....
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8AB8 00 00 00 00 00 00 00 00  ........
; ----------------------------------------------------------------------------
cart_entry_point:
        ldx     #$00                            ; 8AC0 A2 00                    ..
        lda     #$00                            ; 8AC2 A9 00                    ..
; clear pages 6 and 7
init_loop:
        sta     page6_vectors,x                 ; 8AC4 9D 00 06                 ...
        sta     score,x                         ; 8AC7 9D 00 07                 ...
        inx                                     ; 8ACA E8                       .
        bne     init_loop                       ; 8ACB D0 F7                    ..
        jsr     init_hardware                   ; 8ACD 20 7C 83                  |.
        lda     #$DD                            ; 8AD0 A9 DD                    ..
        sta     dlist_shadow_lo                 ; 8AD2 8D AC 06                 ...
        lda     #$8A                            ; 8AD5 A9 8A                    ..
        sta     dlist_shadow_hi                 ; 8AD7 8D AD 06                 ...
        jmp     init_game                       ; 8ADA 4C 00 90                 L..

; ----------------------------------------------------------------------------
; yet another jump-to-itself empty display list
blank_dlist_8add:
        .byte   $41,$DD,$8A                     ; 8ADD 41 DD 8A                 A..
; ----------------------------------------------------------------------------
; show blank screen with empty display list
setup_blank_dlist:
        lda     #$EB                            ; 8AE0 A9 EB                    ..
        sta     dlist_shadow_lo                 ; 8AE2 8D AC 06                 ...
        lda     #$8A                            ; 8AE5 A9 8A                    ..
        sta     dlist_shadow_hi                 ; 8AE7 8D AD 06                 ...
        rts                                     ; 8AEA 60                       `

; ----------------------------------------------------------------------------
; another jump-to-itself empty display list
blank_dlist_8aeb:
        .byte   $41,$EB,$8A                     ; 8AEB 41 EB 8A                 A..
zero_filler_8aee:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8AEE 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8AF6 00 00 00 00 00 00 00 00  ........
; ----------------------------------------------------------------------------
cart_start_stub:
        clc                                     ; 8AFE 18                       .
        rts                                     ; 8AFF 60                       `

; ----------------------------------------------------------------------------
zero_filler_8b00:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8B00 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8B08 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8B10 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8B18 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00                     ; 8B20 00 00 00                 ...
; ----------------------------------------------------------------------------
; various levels use this as their init, or use an init that calls this
special_init:
        ldx     #$20                            ; 8B23 A2 20                    . 
        lda     #$00                            ; 8B25 A9 00                    ..
; clear memory from $0760 to $077f
si_clear:
        sta     bullet_y_delta+1,x              ; 8B27 9D 5F 07                 ._.
        dex                                     ; 8B2A CA                       .
        bne     si_clear                        ; 8B2B D0 FA                    ..
; special_init that doesn't clear memory. does anything use this entry point?
special_init_2:
        lda     work_level_unkn_table0          ; 8B2D AD 94 07                 ...
        sta     $AC                             ; 8B30 85 AC                    ..
        lda     work_level_unkn_table0+1        ; 8B32 AD 95 07                 ...
        sta     $AD                             ; 8B35 85 AD                    ..
        ldy     #$00                            ; 8B37 A0 00                    ..
si_loop:lda     ($AC),y                         ; 8B39 B1 AC                    ..
        cmp     #$FF                            ; 8B3B C9 FF                    ..
        beq     si_done                         ; 8B3D F0 3B                    .;
        tax                                     ; 8B3F AA                       .
        iny                                     ; 8B40 C8                       .
        lda     ($AC),y                         ; 8B41 B1 AC                    ..
        sta     $066E,x                         ; 8B43 9D 6E 06                 .n.
        iny                                     ; 8B46 C8                       .
        lda     ($AC),y                         ; 8B47 B1 AC                    ..
        sta     $0673,x                         ; 8B49 9D 73 06                 .s.
        iny                                     ; 8B4C C8                       .
        lda     ($AC),y                         ; 8B4D B1 AC                    ..
        sta     $0678,x                         ; 8B4F 9D 78 06                 .x.
        iny                                     ; 8B52 C8                       .
        lda     ($AC),y                         ; 8B53 B1 AC                    ..
        sta     $067D,x                         ; 8B55 9D 7D 06                 .}.
        iny                                     ; 8B58 C8                       .
        lda     ($AC),y                         ; 8B59 B1 AC                    ..
        sta     $0682,x                         ; 8B5B 9D 82 06                 ...
        iny                                     ; 8B5E C8                       .
        lda     ($AC),y                         ; 8B5F B1 AC                    ..
        sta     $0687,x                         ; 8B61 9D 87 06                 ...
        iny                                     ; 8B64 C8                       .
        tya                                     ; 8B65 98                       .
        pha                                     ; 8B66 48                       H
        lda     ($AC),y                         ; 8B67 B1 AC                    ..
        ldy     pcolor0_table,x                 ; 8B69 BC 7B 8B                 .{.
        sta     PCOLR0,y                        ; 8B6C 99 C0 02                 ...
        pla                                     ; 8B6F 68                       h
        tay                                     ; 8B70 A8                       .
        iny                                     ; 8B71 C8                       .
        lda     #$00                            ; 8B72 A9 00                    ..
        sta     $0696,x                         ; 8B74 9D 96 06                 ...
        jmp     si_loop                         ; 8B77 4C 39 8B                 L9.

; ----------------------------------------------------------------------------
si_done:rts                                     ; 8B7A 60                       `

; ----------------------------------------------------------------------------
pcolor0_table:
        .byte   $07,$00,$01,$02,$03             ; 8B7B 07 00 01 02 03           .....
; ----------------------------------------------------------------------------
; show scores, called at end of game, also called after beating level 12 (after WELL DONE). $40 in NMIEN = disable DLI, enable VBI
scores_screen:
        lda     #$40                            ; 8B80 A9 40                    .@
        sta     NMIEN                           ; 8B82 8D 0E D4                 ...
        lda     #$82                            ; 8B85 A9 82                    ..
        sta     dlist_shadow_lo                 ; 8B87 8D AC 06                 ...
        lda     #$8C                            ; 8B8A A9 8C                    ..
        sta     dlist_shadow_hi                 ; 8B8C 8D AD 06                 ...
        ldx     #$06                            ; 8B8F A2 06                    ..
smsg_loop:
        lda     scores_msg,x                    ; 8B91 BD 7B 8C                 .{.
        sta     $3006,x                         ; 8B94 9D 06 30                 ..0
        dex                                     ; 8B97 CA                       .
        bne     smsg_loop                       ; 8B98 D0 F7                    ..
        ldx     current_user                    ; 8B9A AE FE 06                 ...
        ldy     struct_user_lives_offsets_minus_one,x; 8B9D BC 88 8C            ...
        ldx     #$03                            ; 8BA0 A2 03                    ..
        lda     lives                           ; 8BA2 AD 0A 07                 ...
        sta     $0713,y                         ; 8BA5 99 13 07                 ...
; number_of_users should be score-1 here.
ss_loop:lda     number_of_users,x               ; 8BA8 BD FF 06                 ...
        sta     struct_user_1,y                 ; 8BAB 99 0B 07                 ...
        dey                                     ; 8BAE 88                       .
        dex                                     ; 8BAF CA                       .
        bne     ss_loop                         ; 8BB0 D0 F6                    ..
        lda     #$00                            ; 8BB2 A9 00                    ..
        sta     $AA                             ; 8BB4 85 AA                    ..
        sta     $AB                             ; 8BB6 85 AB                    ..
        tay                                     ; 8BB8 A8                       .
        lda     users_still_alive               ; 8BB9 AD F4 06                 ...
        sta     zp_temp2                        ; 8BBC 85 AE                    ..
        inc     zp_temp2                        ; 8BBE E6 AE                    ..
; shows PLAYER (backwards loop)
show_reyalp_msg:
        ldx     #$14                            ; 8BC0 A2 14                    ..
reyalp_msg_loop:
        lda     reyalp_msg_minus_one,x          ; 8BC2 BD 67 8C                 .g.
        sta     $3028,y                         ; 8BC5 99 28 30                 .(0
; replace 10th char with the ASCII player (user) number
check_10th:
        cpx     #$0A                            ; 8BC8 E0 0A                    ..
        bne     continue_loop                   ; 8BCA D0 09                    ..
        inc     $AA                             ; 8BCC E6 AA                    ..
        lda     $AA                             ; 8BCE A5 AA                    ..
        ora     #$10                            ; 8BD0 09 10                    ..
        sta     $3028,y                         ; 8BD2 99 28 30                 .(0
continue_loop:
        iny                                     ; 8BD5 C8                       .
        dex                                     ; 8BD6 CA                       .
        bne     reyalp_msg_loop                 ; 8BD7 D0 E9                    ..
        sty     $AD                             ; 8BD9 84 AD                    ..
        ldx     $AA                             ; 8BDB A6 AA                    ..
        ldy     struct_user_lives_offsets_minus_one,x; 8BDD BC 88 8C            ...
        lda     #$00                            ; 8BE0 A9 00                    ..
; $AF is the character to show after the score (space for alive, cross for dead)
store_space:
        sta     zp_temp2+1                      ; 8BE2 85 AF                    ..
        lda     $0713,y                         ; 8BE4 B9 13 07                 ...
        cmp     #$FF                            ; 8BE7 C9 FF                    ..
; user still has lives left?
check_alive:
        bne     no_cross                        ; 8BE9 D0 04                    ..
; no, show a cross instead of a space
not_alive:
        lda     #$5E                            ; 8BEB A9 5E                    .^
        sta     zp_temp2+1                      ; 8BED 85 AF                    ..
no_cross:
        lda     L8C84,x                         ; 8BEF BD 84 8C                 ...
        sta     num_out                         ; 8BF2 85 D3                    ..
        lda     #$30                            ; 8BF4 A9 30                    .0
        sta     num_out+1                       ; 8BF6 85 D4                    ..
        ldx     #$03                            ; 8BF8 A2 03                    ..
L8BFA:  lda     struct_user_1,y                 ; 8BFA B9 0B 07                 ...
        sta     $CF,x                           ; 8BFD 95 CF                    ..
        dey                                     ; 8BFF 88                       .
        dex                                     ; 8C00 CA                       .
        bne     L8BFA                           ; 8C01 D0 F7                    ..
        jsr     print_number_jv                 ; 8C03 20 09 80                  ..
        lda     zp_temp2+1                      ; 8C06 A5 AF                    ..
        iny                                     ; 8C08 C8                       .
        sta     (num_out),y                     ; 8C09 91 D3                    ..
        ldy     $AD                             ; 8C0B A4 AD                    ..
        dec     zp_temp2                        ; 8C0D C6 AE                    ..
        bne     show_reyalp_msg                 ; 8C0F D0 AF                    ..
        lda     #$96                            ; 8C11 A9 96                    ..
        sta     COLOR3                          ; 8C13 8D C7 02                 ...
        lda     #$C6                            ; 8C16 A9 C6                    ..
        sta     COLOR0                          ; 8C18 8D C4 02                 ...
        lda     #$08                            ; 8C1B A9 08                    ..
        sta     COLOR1                          ; 8C1D 8D C5 02                 ...
        lda     #$52                            ; 8C20 A9 52                    .R
; set dlist shadow to scores_screen_dlist
show_scores_screen:
        sta     dlist_shadow_lo                 ; 8C22 8D AC 06                 ...
        lda     #$8C                            ; 8C25 A9 8C                    ..
        sta     dlist_shadow_hi                 ; 8C27 8D AD 06                 ...
        lda     #$8D                            ; 8C2A A9 8D                    ..
        sta     dli_vec_shadow_lo               ; 8C2C 8D AE 06                 ...
        lda     #$8C                            ; 8C2F A9 8C                    ..
; dli = score_screen_dli_sr
set_score_screen_dli:
        sta     dli_vec_shadow_hi               ; 8C31 8D AF 06                 ...
        lda     #$02                            ; 8C34 A9 02                    ..
        jsr     cue_music_jv                    ; 8C36 20 18 80                  ..
; I *think* we're waiting for the music to finish playing...
what_are_we_waiting_for:
        lda     $0640                           ; 8C39 AD 40 06                 .@.
        ora     $0642                           ; 8C3C 0D 42 06                 .B.
        ora     $0644                           ; 8C3F 0D 44 06                 .D.
        ora     sfx_slot_duration               ; 8C42 0D 46 06                 .F.
        bne     what_are_we_waiting_for         ; 8C45 D0 F2                    ..
        sta     jiffy_timer_1                   ; 8C47 8D 1A 06                 ...
; wait 192 jiffies: 3.2 sec (ntsc), 3.84 sec (pal)
wait_3_sec:
        lda     jiffy_timer_1                   ; 8C4A AD 1A 06                 ...
        cmp     #$C0                            ; 8C4D C9 C0                    ..
        bne     wait_3_sec                      ; 8C4F D0 F9                    ..
        rts                                     ; 8C51 60                       `

; ----------------------------------------------------------------------------
; a GR.2-ish DL, with DLIs, screen mem at $3000, for player scores screen
scores_screen_dlist:
        .byte   $70,$70,$70,$30,$70,$70,$70,$70 ; 8C52 70 70 70 30 70 70 70 70  ppp0pppp
        .byte   $47,$00,$30,$87,$87,$10,$87,$10 ; 8C5A 47 00 30 87 87 10 87 10  G.0.....
        .byte   $87,$10,$07,$41,$52             ; 8C62 87 10 07 41 52           ...AR
reyalp_msg_minus_one:
        .byte   $8C                             ; 8C67 8C                       .
; PLAYER spelled backwards: '  0       # REYALP '
reyalp_msg:
        .byte   $80,$80,$10,$80,$80,$80,$80,$80 ; 8C68 80 80 10 80 80 80 80 80  ........
        .byte   $80,$80,$03,$80,$32,$25,$39,$21 ; 8C70 80 80 03 80 32 25 39 21  ....2%9!
        .byte   $2C,$30,$80                     ; 8C78 2C 30 80                 ,0.
; ' SCORES' in color 3
scores_msg:
        .byte   $80,$F3,$E3,$EF,$F2,$E5,$F3     ; 8C7B 80 F3 E3 EF F2 E5 F3     .......
; looks like an empty jump-to-itself dlist
blank_dlist_8c82:
        .byte   $41,$82                         ; 8C82 41 82                    A.
L8C84:  .byte   $8C                             ; 8C84 8C                       .
; offsets into screen memory, column 12, rows 2 3 4 5, used by code at $8BEF, loaded in $d3, hi byte in $d4 is $30
score_offsets:
        .byte   $34,$48,$5C                     ; 8C85 34 48 5C                 4H\
struct_user_lives_offsets_minus_one:
        .byte   $70                             ; 8C88 70                       p
; lookup table, offset from $713 to lives for indexed user
struct_user_lives_offsets:
        .byte   $02,$0D,$18,$23                 ; 8C89 02 0D 18 23              ...#
; ----------------------------------------------------------------------------
; used by score screen
score_screen_dli_sr:
        pha                                     ; 8C8D 48                       H
        lda     current_user                    ; 8C8E AD FE 06                 ...
        sec                                     ; 8C91 38                       8
        sbc     #$01                            ; 8C92 E9 01                    ..
        sta     WSYNC                           ; 8C94 8D 0A D4                 ...
        cmp     $AB                             ; 8C97 C5 AB                    ..
        bne     L8CA4                           ; 8C99 D0 09                    ..
        lda     $062A                           ; 8C9B AD 2A 06                 .*.
        sta     COLPF0                          ; 8C9E 8D 16 D0                 ...
        jmp     L8CAA                           ; 8CA1 4C AA 8C                 L..

; ----------------------------------------------------------------------------
L8CA4:  lda     COLOR0                          ; 8CA4 AD C4 02                 ...
        sta     COLPF0                          ; 8CA7 8D 16 D0                 ...
L8CAA:  inc     $AB                             ; 8CAA E6 AB                    ..
        lda     $AB                             ; 8CAC A5 AB                    ..
        and     #$03                            ; 8CAE 29 03                    ).
        sta     $AB                             ; 8CB0 85 AB                    ..
        pla                                     ; 8CB2 68                       h
        rti                                     ; 8CB3 40                       @

; ----------------------------------------------------------------------------
zero_filler_8cb4:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8CB4 00 00 00 00 00 00 00 00  ........
; ----------------------------------------------------------------------------
; should be called every time the score is updated, adds extra life every 7500 points. notice the score and threshold are both 3 bytes, and we compare from high byte to low.
check_extra_life:
        ldx     #$03                            ; 8CBC A2 03                    ..
; number_of_users should be score-1 here. score+2 should be next_extra_life-1 also.
chk_next_byte:
        lda     number_of_users,x               ; 8CBE BD FF 06                 ...
        cmp     score+2,x                       ; 8CC1 DD 02 07                 ...
        bcc     chk_done                        ; 8CC4 90 34                    .4
        beq     score_byte_ge                   ; 8CC6 F0 03                    ..
        jmp     add_extra_life                  ; 8CC8 4C CE 8C                 L..

; ----------------------------------------------------------------------------
; if it's greater or equal and X!=0, keep looping
score_byte_ge:
        dex                                     ; 8CCB CA                       .
        bne     chk_next_byte                   ; 8CCC D0 F0                    ..
; first, calculate & store the next 7500-point target
add_extra_life:
        ldx     #$00                            ; 8CCE A2 00                    ..
        clc                                     ; 8CD0 18                       .
add_next_byte:
        lda     extra_life_points,x             ; 8CD1 BD FD 8C                 ...
        adc     next_extra_life,x               ; 8CD4 7D 03 07                 }..
        sta     next_extra_life,x               ; 8CD7 9D 03 07                 ...
        inx                                     ; 8CDA E8                       .
; we have to preserve the carry flag!
save_flags:
        php                                     ; 8CDB 08                       .
        cpx     #$03                            ; 8CDC E0 03                    ..
        beq     inc_lives                       ; 8CDE F0 04                    ..
        plp                                     ; 8CE0 28                       (
        jmp     add_next_byte                   ; 8CE1 4C D1 8C                 L..

; ----------------------------------------------------------------------------
; add 1 life, play sfx_extra_life
inc_lives:
        plp                                     ; 8CE4 28                       (
        inc     lives                           ; 8CE5 EE 0A 07                 ...
        lda     #$79                            ; 8CE8 A9 79                    .y
        sta     sfx_ptr                         ; 8CEA 8D 3C 06                 .<.
        lda     #$BE                            ; 8CED A9 BE                    ..
        sta     sfx_ptr+1                       ; 8CEF 8D 3D 06                 .=.
        lda     #$0C                            ; 8CF2 A9 0C                    ..
        jsr     cue_sfx_jv                      ; 8CF4 20 06 80                  ..
        jsr     show_lives_icons                ; 8CF7 20 BB 86                  ..
chk_done:
        jmp     score_mod_1m                    ; 8CFA 4C C0 B7                 L..

; ----------------------------------------------------------------------------
; 3 bytes, value 7500 decimal, give an extra life after this many points. not copied to RAM, meaning no level can change this.
extra_life_points:
        .byte   $4C,$1D,$00                     ; 8CFD 4C 1D 00                 L..
; ----------------------------------------------------------------------------
; just lost your last life
crumble_gameboard:
        jsr     enable_joystick_jv              ; 8D00 20 1B 80                  ..
        lda     #$86                            ; 8D03 A9 86                    ..
; $86 = distortion 8, volume 6
cgb_audc:
        sta     AUDC1                           ; 8D05 8D 01 D2                 ...
; store random N-blank-lines instruction at head of display list
shake_screen:
        lda     RANDOM                          ; 8D08 AD 0A D2                 ...
        and     #$70                            ; 8D0B 29 70                    )p
        sta     $0801                           ; 8D0D 8D 01 08                 ...
        sta     game_display_list               ; 8D10 8D 81 08                 ...
        lda     RANDOM                          ; 8D13 AD 0A D2                 ...
; random frequency
crumble_sound:
        sta     AUDF1                           ; 8D16 8D 00 D2                 ...
; get random number 0 to 12
rand_0c:lda     RANDOM                          ; 8D19 AD 0A D2                 ...
        and     #$1F                            ; 8D1C 29 1F                    ).
        cmp     #$0D                            ; 8D1E C9 0D                    ..
        bcs     rand_0c                         ; 8D20 B0 F7                    ..
        sta     $AA                             ; 8D22 85 AA                    ..
        asl     a                               ; 8D24 0A                       .
        clc                                     ; 8D25 18                       .
        adc     $AA                             ; 8D26 65 AA                    e.
        sta     $AA                             ; 8D28 85 AA                    ..
        jsr     L8D60                           ; 8D2A 20 60 8D                  `.
        inc     $AA                             ; 8D2D E6 AA                    ..
        lda     $AA                             ; 8D2F A5 AA                    ..
        pha                                     ; 8D31 48                       H
        jsr     L8D60                           ; 8D32 20 60 8D                  `.
        pla                                     ; 8D35 68                       h
        jsr     L8D60                           ; 8D36 20 60 8D                  `.
        inc     $AA                             ; 8D39 E6 AA                    ..
        lda     $AA                             ; 8D3B A5 AA                    ..
        jsr     L8D60                           ; 8D3D 20 60 8D                  `.
        ldy     #$00                            ; 8D40 A0 00                    ..
        tya                                     ; 8D42 98                       .
L8D43:  ora     $3370,y                         ; 8D43 19 70 33                 .p3
        ora     $3398,y                         ; 8D46 19 98 33                 ..3
        iny                                     ; 8D49 C8                       .
        cpy     #$28                            ; 8D4A C0 28                    .(
        bne     L8D43                           ; 8D4C D0 F5                    ..
        cmp     #$00                            ; 8D4E C9 00                    ..
        bne     shake_screen                    ; 8D50 D0 B6                    ..
; well_done_screen jumps here via work_level_sub1
well_done_scores:
        lda     #$00                            ; 8D52 A9 00                    ..
        sta     AUDF1                           ; 8D54 8D 00 D2                 ...
        sta     AUDC1                           ; 8D57 8D 01 D2                 ...
        jsr     scores_screen                   ; 8D5A 20 80 8B                  ..
        jmp     afterlife                       ; 8D5D 4C 00 96                 L..

; ----------------------------------------------------------------------------
L8D60:  clc                                     ; 8D60 18                       .
        adc     #$70                            ; 8D61 69 70                    ip
        sta     $AC                             ; 8D63 85 AC                    ..
        adc     #$28                            ; 8D65 69 28                    i(
        sta     zp_temp2                        ; 8D67 85 AE                    ..
        lda     #$3D                            ; 8D69 A9 3D                    .=
        sta     $AD                             ; 8D6B 85 AD                    ..
        sta     zp_temp2+1                      ; 8D6D 85 AF                    ..
        lda     #$57                            ; 8D6F A9 57                    .W
        sta     $AB                             ; 8D71 85 AB                    ..
        ldy     #$00                            ; 8D73 A0 00                    ..
L8D75:  lda     ($AC),y                         ; 8D75 B1 AC                    ..
        sta     (zp_temp2),y                    ; 8D77 91 AE                    ..
        sec                                     ; 8D79 38                       8
        lda     $AC                             ; 8D7A A5 AC                    ..
        sbc     #$28                            ; 8D7C E9 28                    .(
        sta     $AC                             ; 8D7E 85 AC                    ..
        bcs     L8D84                           ; 8D80 B0 02                    ..
        dec     $AD                             ; 8D82 C6 AD                    ..
L8D84:  sec                                     ; 8D84 38                       8
        lda     zp_temp2                        ; 8D85 A5 AE                    ..
        sbc     #$28                            ; 8D87 E9 28                    .(
        sta     zp_temp2                        ; 8D89 85 AE                    ..
        bcs     L8D8F                           ; 8D8B B0 02                    ..
        dec     zp_temp2+1                      ; 8D8D C6 AF                    ..
L8D8F:  dec     $AB                             ; 8D8F C6 AB                    ..
        bne     L8D75                           ; 8D91 D0 E2                    ..
        tya                                     ; 8D93 98                       .
        sta     (zp_temp2),y                    ; 8D94 91 AE                    ..
        rts                                     ; 8D96 60                       `

; ----------------------------------------------------------------------------
zero_filler_8d97:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 8D97 00 00 00 00 00 00 00 00  ........
        .byte   $00                             ; 8D9F 00                       .
; ----------------------------------------------------------------------------
L8DA0:  lda     level                           ; 8DA0 AD F6 06                 ...
        cmp     #$0B                            ; 8DA3 C9 0B                    ..
        beq     L8DAA                           ; 8DA5 F0 03                    ..
        jmp     afterlife                       ; 8DA7 4C 00 96                 L..

; ----------------------------------------------------------------------------
L8DAA:  jsr     well_done_screen                ; 8DAA 20 00 BC                  ..
        lda     #$04                            ; 8DAD A9 04                    ..
        sta     $0688                           ; 8DAF 8D 88 06                 ...
        jsr     scores_screen                   ; 8DB2 20 80 8B                  ..
        jmp     afterlife                       ; 8DB5 4C 00 96                 L..

; ----------------------------------------------------------------------------
; move player selected by X reg minus one off the left edge of the screen
hide_player:
        lda     #$02                            ; 8DB8 A9 02                    ..
        sta     HPOSM3,x                        ; 8DBA 9D 07 D0                 ...
        sta     $067C,x                         ; 8DBD 9D 7C 06                 .|.
        lda     #$00                            ; 8DC0 A9 00                    ..
        sta     $06EA,x                         ; 8DC2 9D EA 06                 ...
        rts                                     ; 8DC5 60                       `

; ----------------------------------------------------------------------------
; store A to AUDCx (and its ?shadow?)
store_audc:
        sta     AUDC1,x                         ; 8DC6 9D 01 D2                 ...
        sta     $0649,x                         ; 8DC9 9D 49 06                 .I.
        rts                                     ; 8DCC 60                       `

; ----------------------------------------------------------------------------
zero_filler_8dcd:
        .byte   $00                             ; 8DCD 00                       .
; ----------------------------------------------------------------------------
; bonus -= 100, play sfx_bonus_tick
decrement_time_bonus:
        lda     work_level_time_bonus           ; 8DCE AD 91 07                 ...
        ora     work_level_time_bonus+1         ; 8DD1 0D 92 07                 ...
        ora     work_level_offs_19              ; 8DD4 0D 93 07                 ...
; don't decrement if bonus == 0
check_bonus_0:
        beq     dec_done                        ; 8DD7 F0 20                    . 
        lda     work_level_time_bonus           ; 8DD9 AD 91 07                 ...
        sec                                     ; 8DDC 38                       8
        sbc     #$64                            ; 8DDD E9 64                    .d
        sta     work_level_time_bonus           ; 8DDF 8D 91 07                 ...
        bcs     bonus_lt_256                    ; 8DE2 B0 03                    ..
        dec     work_level_time_bonus+1         ; 8DE4 CE 92 07                 ...
bonus_lt_256:
        jsr     print_bonus_jv                  ; 8DE7 20 0F 80                  ..
        lda     #$FA                            ; 8DEA A9 FA                    ..
        sta     sfx_slot_priority               ; 8DEC 8D 3E 06                 .>.
        lda     #$8D                            ; 8DEF A9 8D                    ..
        sta     sfx_slot_timer                  ; 8DF1 8D 3F 06                 .?.
        lda     #$07                            ; 8DF4 A9 07                    ..
        jsr     cue_sfx_lowprior_jv             ; 8DF6 20 03 80                  ..
dec_done:
        rts                                     ; 8DF9 60                       `

; ----------------------------------------------------------------------------
; played when bonus timer is decremented
sfx_bonus_tick:
        .byte   $01,$A5,$00,$18,$03,$00         ; 8DFA 01 A5 00 18 03 00        ......
; ----------------------------------------------------------------------------
level_finished:
        lda     #$09                            ; 8E00 A9 09                    ..
        sta     current_speed                   ; 8E02 8D 24 06                 .$.
        sta     $067F                           ; 8E05 8D 7F 06                 ...
        lda     #$80                            ; 8E08 A9 80                    ..
        sta     num_color                       ; 8E0A 85 D5                    ..
        jsr     print_bonus_jv                  ; 8E0C 20 0F 80                  ..
; score += time_bonus;
add_time_bonus:
        clc                                     ; 8E0F 18                       .
        lda     work_level_time_bonus           ; 8E10 AD 91 07                 ...
        adc     score                           ; 8E13 6D 00 07                 m..
        sta     score                           ; 8E16 8D 00 07                 ...
        lda     work_level_time_bonus+1         ; 8E19 AD 92 07                 ...
        adc     score+1                         ; 8E1C 6D 01 07                 m..
        sta     score+1                         ; 8E1F 8D 01 07                 ...
        bcc     lt_64k                          ; 8E22 90 03                    ..
        inc     score+2                         ; 8E24 EE 02 07                 ...
lt_64k: lda     #$00                            ; 8E27 A9 00                    ..
        sta     AUDF1                           ; 8E29 8D 00 D2                 ...
        sta     num_color                       ; 8E2C 85 D5                    ..
        sta     AUDC1                           ; 8E2E 8D 01 D2                 ...
        sta     jiffy_timer_1                   ; 8E31 8D 1A 06                 ...
        sta     playing_level                   ; 8E34 8D 27 06                 .'.
        jsr     check_extra_life_jv             ; 8E37 20 0C 80                  ..
; 533ms ntsc, 640ms pal
wait_32_jiffies:
        lda     jiffy_timer_1                   ; 8E3A AD 1A 06                 ...
        cmp     #$20                            ; 8E3D C9 20                    . 
        bne     wait_32_jiffies                 ; 8E3F D0 F9                    ..
; pick random sound effect between 4 and 7
pick_random_music:
        lda     RANDOM                          ; 8E41 AD 0A D2                 ...
        and     #$03                            ; 8E44 29 03                    ).
        clc                                     ; 8E46 18                       .
        adc     #$04                            ; 8E47 69 04                    i.
        jsr     cue_music_jv                    ; 8E49 20 18 80                  ..
L8E4C:  lda     $0640                           ; 8E4C AD 40 06                 .@.
        ora     $0642                           ; 8E4F 0D 42 06                 .B.
        ora     $0644                           ; 8E52 0D 44 06                 .D.
        ora     sfx_slot_duration               ; 8E55 0D 46 06                 .F.
        bne     L8E4C                           ; 8E58 D0 F2                    ..
        sta     jiffy_timer_1                   ; 8E5A 8D 1A 06                 ...
L8E5D:  lda     jiffy_timer_1                   ; 8E5D AD 1A 06                 ...
        cmp     #$40                            ; 8E60 C9 40                    .@
        bne     L8E5D                           ; 8E62 D0 F9                    ..
        jmp     end_of_level_bonus              ; 8E64 4C 00 B8                 L..

; ----------------------------------------------------------------------------
zero_filler_8e67:
        .byte   $00,$00                         ; 8E67 00 00                    ..
; ----------------------------------------------------------------------------
; not sure what $0622, $0623 are for yet
bullet_logic:
        lda     $0622                           ; 8E69 AD 22 06                 .".
        beq     no_bullet                       ; 8E6C F0 07                    ..
        lda     $0623                           ; 8E6E AD 23 06                 .#.
        cmp     #$02                            ; 8E71 C9 02                    ..
        bne     want_bullet                     ; 8E73 D0 01                    ..
no_bullet:
        rts                                     ; 8E75 60                       `

; ----------------------------------------------------------------------------
; create a bullet unless there are already max_bullets of them
want_bullet:
        ldx     #$FF                            ; 8E76 A2 FF                    ..
next_bullet_slot:
        inx                                     ; 8E78 E8                       .
        cpx     work_level_bullet_max           ; 8E79 EC 8B 07                 ...
        beq     no_bullet                       ; 8E7C F0 F7                    ..
        lda     bullet_flags,x                  ; 8E7E BD 56 07                 .V.
        bne     fire_when_ready                 ; 8E81 D0 36                    .6
        inc     bullet_flags,x                  ; 8E83 FE 56 07                 .V.
; A = rand() % 3 + 1; // bullets only come from left, right, or top (never bottom)
rand_1_to_3:
        lda     RANDOM                          ; 8E86 AD 0A D2                 ...
        and     #$03                            ; 8E89 29 03                    ).
        beq     rand_1_to_3                     ; 8E8B F0 F9                    ..
        tay                                     ; 8E8D A8                       .
        lda     RANDOM                          ; 8E8E AD 0A D2                 ...
        sta     bullet_x_pos,x                  ; 8E91 9D 9B 06                 ...
        sta     bullet_y_pos,x                  ; 8E94 9D 9F 06                 ...
        lda     bullet_table_minus_one,y        ; 8E97 B9 42 8F                 .B.
        beq     L8E9F                           ; 8E9A F0 03                    ..
        sta     bullet_x_pos,x                  ; 8E9C 9D 9B 06                 ...
L8E9F:  lda     L8F45,y                         ; 8E9F B9 45 8F                 .E.
        beq     set_bullet_dir                  ; 8EA2 F0 03                    ..
        sta     bullet_y_pos,x                  ; 8EA4 9D 9F 06                 ...
; initial direction (before it fires)
set_bullet_dir:
        lda     RANDOM                          ; 8EA7 AD 0A D2                 ...
        and     #$03                            ; 8EAA 29 03                    ).
        tay                                     ; 8EAC A8                       .
        lda     L8F49,y                         ; 8EAD B9 49 8F                 .I.
        sta     bullet_x_delta,x                ; 8EB0 9D 5A 07                 .Z.
        lda     L8F4D,y                         ; 8EB3 B9 4D 8F                 .M.
        sta     bullet_y_delta,x                ; 8EB6 9D 5E 07                 .^.
; fire at player if lined up with him, otherwise don't. either way we end up at move_bullet
fire_when_ready:
        cmp     #$02                            ; 8EB9 C9 02                    ..
        beq     move_bullet                     ; 8EBB F0 54                    .T
        lda     bullet_x_pos,x                  ; 8EBD BD 9B 06                 ...
        sec                                     ; 8EC0 38                       8
; aim at center of body mass!
sbc3:   sbc     #$03                            ; 8EC1 E9 03                    ..
        cmp     player_x_pos                    ; 8EC3 CD 7E 06                 .~.
        beq     aim_bullet_y                    ; 8EC6 F0 0E                    ..
        lda     bullet_y_pos,x                  ; 8EC8 BD 9F 06                 ...
        sec                                     ; 8ECB 38                       8
        sbc     #$04                            ; 8ECC E9 04                    ..
        cmp     player_y_pos                    ; 8ECE CD 83 06                 ...
        beq     aim_bullet_x                    ; 8ED1 F0 11                    ..
        jmp     move_bullet                     ; 8ED3 4C 11 8F                 L..

; ----------------------------------------------------------------------------
; take aim!
aim_bullet_y:
        ldy     #$00                            ; 8ED6 A0 00                    ..
        lda     bullet_y_pos,x                  ; 8ED8 BD 9F 06                 ...
        cmp     player_y_pos                    ; 8EDB CD 83 06                 ...
        bcs     fire_bullet                     ; 8EDE B0 0F                    ..
        iny                                     ; 8EE0 C8                       .
        jmp     fire_bullet                     ; 8EE1 4C EF 8E                 L..

; ----------------------------------------------------------------------------
; take aim!
aim_bullet_x:
        ldy     #$02                            ; 8EE4 A0 02                    ..
        lda     bullet_x_pos,x                  ; 8EE6 BD 9B 06                 ...
        cmp     player_x_pos                    ; 8EE9 CD 7E 06                 .~.
        bcs     fire_bullet                     ; 8EEC B0 01                    ..
        iny                                     ; 8EEE C8                       .
; fire! Y reg indexes table of directions
fire_bullet:
        lda     L8F51,y                         ; 8EEF B9 51 8F                 .Q.
        sta     bullet_x_delta,x                ; 8EF2 9D 5A 07                 .Z.
        lda     L8F55,y                         ; 8EF5 B9 55 8F                 .U.
        sta     bullet_y_delta,x                ; 8EF8 9D 5E 07                 .^.
; let player hear report
play_sfx_bullet:
        lda     #$59                            ; 8EFB A9 59                    .Y
        sta     sfx_slot_priority               ; 8EFD 8D 3E 06                 .>.
        lda     #$8F                            ; 8F00 A9 8F                    ..
        sta     sfx_slot_timer                  ; 8F02 8D 3F 06                 .?.
        txa                                     ; 8F05 8A                       .
        pha                                     ; 8F06 48                       H
        lda     #$02                            ; 8F07 A9 02                    ..
        jsr     cue_sfx_lowprior_jv             ; 8F09 20 03 80                  ..
        pla                                     ; 8F0C 68                       h
        tax                                     ; 8F0D AA                       .
        inc     bullet_flags,x                  ; 8F0E FE 56 07                 .V.
move_bullet:
        lda     bullet_x_pos,x                  ; 8F11 BD 9B 06                 ...
        clc                                     ; 8F14 18                       .
        adc     bullet_x_delta,x                ; 8F15 7D 5A 07                 }Z.
        cmp     #$03                            ; 8F18 C9 03                    ..
        bcc     code_8f38                       ; 8F1A 90 1C                    ..
        cmp     #$FD                            ; 8F1C C9 FD                    ..
        bcs     code_8f38                       ; 8F1E B0 18                    ..
        sta     bullet_x_pos,x                  ; 8F20 9D 9B 06                 ...
        lda     bullet_y_pos,x                  ; 8F23 BD 9F 06                 ...
        clc                                     ; 8F26 18                       .
        adc     bullet_y_delta,x                ; 8F27 7D 5E 07                 }^.
        cmp     #$03                            ; 8F2A C9 03                    ..
        bcc     code_8f38                       ; 8F2C 90 0A                    ..
        cmp     #$CE                            ; 8F2E C9 CE                    ..
        bcs     code_8f38                       ; 8F30 B0 06                    ..
        sta     bullet_y_pos,x                  ; 8F32 9D 9F 06                 ...
        jmp     next_bullet_slot                ; 8F35 4C 78 8E                 Lx.

; ----------------------------------------------------------------------------
code_8f38:
        lda     #$00                            ; 8F38 A9 00                    ..
        sta     bullet_flags,x                  ; 8F3A 9D 56 07                 .V.
        sta     bullet_x_pos,x                  ; 8F3D 9D 9B 06                 ...
bullet_table_minus_one:= * + 2                  ; 1-indexed
        jmp     next_bullet_slot                ; 8F40 4C 78 8E                 Lx.

; ----------------------------------------------------------------------------
; used by bullet_logic
bullet_table:
        .byte   $04,$FC                         ; 8F43 04 FC                    ..
L8F45:  .byte   $00,$00,$00,$04                 ; 8F45 00 00 00 04              ....
L8F49:  .byte   $FF,$00,$01,$00                 ; 8F49 FF 00 01 00              ....
L8F4D:  .byte   $00,$FF,$00,$01                 ; 8F4D 00 FF 00 01              ....
L8F51:  .byte   $00,$00,$FD,$03                 ; 8F51 00 00 FD 03              ....
L8F55:  .byte   $FD,$03,$00,$00                 ; 8F55 FD 03 00 00              ....
; bang!
sfx_bullet:
        .byte   $01,$8E,$00,$14,$02,$01,$8B,$00 ; 8F59 01 8E 00 14 02 01 8B 00  ........
        .byte   $14,$03,$01,$88,$00,$14,$05,$01 ; 8F61 14 03 01 88 00 14 05 01  ........
        .byte   $85,$00,$14,$07,$01,$82,$00,$14 ; 8F69 85 00 14 07 01 82 00 14  ........
        .byte   $09,$00                         ; 8F71 09 00                    ..
; ----------------------------------------------------------------------------
; did any missile hit a player, or did players 2 or 3 hit a player...
check_pl_coll:
        lda     sav_p2pl                        ; 8F73 AD BE 06                 ...
; skip player 2 to player collisions, called with A=0, used by level 11
check_pl_coll_no_p2:
        ora     sav_p3pl                        ; 8F76 0D BF 06                 ...
; skip player 2 and 3 to player collisions, called with A=0, used by levels 3 and 10
check_pl_coll_no_pl:
        ora     sav_m0pl                        ; 8F79 0D B8 06                 ...
        ora     sav_m1pl                        ; 8F7C 0D B9 06                 ...
        ora     sav_m2pl                        ; 8F7F 0D BA 06                 ...
        ora     sav_m3pl                        ; 8F82 0D BB 06                 ...
        and     #$01                            ; 8F85 29 01                    ).
        beq     L8F91                           ; 8F87 F0 08                    ..
        lda     $0623                           ; 8F89 AD 23 06                 .#.
        bne     L8F91                           ; 8F8C D0 03                    ..
        inc     $0623                           ; 8F8E EE 23 06                 .#.
L8F91:  rts                                     ; 8F91 60                       `

; ----------------------------------------------------------------------------
; setup to play whichever music is in A reg, using 5-byte sfx stuct (a music is a pair of sfx played simultaneously)
cue_music:
        sta     $D6                             ; 8F92 85 D6                    ..
        asl     a                               ; 8F94 0A                       .
        asl     a                               ; 8F95 0A                       .
        clc                                     ; 8F96 18                       .
        adc     $D6                             ; 8F97 65 D6                    e.
        sta     $D6                             ; 8F99 85 D6                    ..
; y = a * 5; // offset into mus_struct_table
set_y:  tay                                     ; 8F9B A8                       .
        lda     mus00_addr1,y                   ; 8F9C B9 C3 8F                 ...
        sta     sfx_ptr                         ; 8F9F 8D 3C 06                 .<.
        lda     mus00_addr1+1,y                 ; 8FA2 B9 C4 8F                 ...
        sta     sfx_ptr+1                       ; 8FA5 8D 3D 06                 .=.
        lda     mus00_priority,y                ; 8FA8 B9 C7 8F                 ...
        jsr     cue_sfx_jv                      ; 8FAB 20 06 80                  ..
        ldy     $D6                             ; 8FAE A4 D6                    ..
        lda     mus00_addr2,y                   ; 8FB0 B9 C5 8F                 ...
        sta     sfx_ptr                         ; 8FB3 8D 3C 06                 .<.
        lda     mus00_addr2+1,y                 ; 8FB6 B9 C6 8F                 ...
        sta     sfx_ptr+1                       ; 8FB9 8D 3D 06                 .=.
        lda     mus00_priority,y                ; 8FBC B9 C7 8F                 ...
        jsr     cue_sfx_jv                      ; 8FBF 20 06 80                  ..
        rts                                     ; 8FC2 60                       `

; ----------------------------------------------------------------------------
; aka mus_struct_table, 5 bytes per entry
mus00_addr1:
        .addr   sfx13                           ; 8FC3 D0 BF                    ..
mus00_addr2:
        .addr   sfx14                           ; 8FC5 EA BF                    ..
; ----------------------------------------------------------------------------
mus00_priority:
        .byte   $10                             ; 8FC7 10                       .
; ----------------------------------------------------------------------------
mus01_addr1:
        .addr   sfx_jump                        ; 8FC8 BE BF                    ..
mus01_addr2:
        .addr   empty_music_entry               ; 8FCA FF 8F                    ..
; ----------------------------------------------------------------------------
mus01_priority:
        .byte   $07                             ; 8FCC 07                       .
; ----------------------------------------------------------------------------
; end of game tune
mus02_addr1:
        .addr   sfx02                           ; 8FCD 8D BE                    ..
mus02_addr2:
        .addr   sfx03                           ; 8FCF AF BE                    ..
; ----------------------------------------------------------------------------
mus02_priority:
        .byte   $10                             ; 8FD1 10                       .
; ----------------------------------------------------------------------------
mus03_addr1:
        .addr   sfx01                           ; 8FD2 25 BE                    %.
mus03_addr2:
        .addr   sfx00                           ; 8FD4 F2 BD                    ..
; ----------------------------------------------------------------------------
mus03_priority:
        .byte   $10                             ; 8FD6 10                       .
; ----------------------------------------------------------------------------
mus04_addr1:
        .addr   sfx04                           ; 8FD7 D5 BE                    ..
mus04_addr2:
        .addr   sfx05                           ; 8FD9 ED BE                    ..
; ----------------------------------------------------------------------------
mus04_priority:
        .byte   $10                             ; 8FDB 10                       .
; ----------------------------------------------------------------------------
mus05_addr1:
        .addr   sfx06                           ; 8FDC 14 BF                    ..
mus05_addr2:
        .addr   sfx07                           ; 8FDE 30 BF                    0.
; ----------------------------------------------------------------------------
mus05_priority:
        .byte   $10                             ; 8FE0 10                       .
; ----------------------------------------------------------------------------
mus06_addr1:
        .addr   sfx08                           ; 8FE1 4A BF                    J.
mus06_addr2:
        .addr   sfx09                           ; 8FE3 60 BF                    `.
; ----------------------------------------------------------------------------
mus06_priority:
        .byte   $10                             ; 8FE5 10                       .
; ----------------------------------------------------------------------------
mus07_addr1:
        .addr   sfx10                           ; 8FE6 84 BF                    ..
mus07_addr2:
        .addr   sfx11                           ; 8FE8 A6 BF                    ..
; ----------------------------------------------------------------------------
mus07_priority:
        .byte   $10                             ; 8FEA 10                       .
; ----------------------------------------------------------------------------
; tune that plays while level is being drawn
mus08_addr1:
        .addr   sfx15                           ; 8FEB BC BA                    ..
mus08_addr2:
        .addr   sfx16                           ; 8FED EA BA                    ..
; ----------------------------------------------------------------------------
mus08_priority:
        .byte   $10                             ; 8FEF 10                       .
; ----------------------------------------------------------------------------
mus09_addr1:
        .addr   empty_music_entry               ; 8FF0 FF 8F                    ..
mus09_addr2:
        .addr   empty_music_entry               ; 8FF2 FF 8F                    ..
; ----------------------------------------------------------------------------
mus09_priority:
        .byte   $01                             ; 8FF4 01                       .
; ----------------------------------------------------------------------------
mus10_addr1:
        .addr   empty_music_entry               ; 8FF5 FF 8F                    ..
mus10_addr2:
        .addr   empty_music_entry               ; 8FF7 FF 8F                    ..
; ----------------------------------------------------------------------------
mus10_priority:
        .byte   $01                             ; 8FF9 01                       .
; ----------------------------------------------------------------------------
mus11_addr1:
        .addr   empty_music_entry               ; 8FFA FF 8F                    ..
mus11_addr2:
        .addr   empty_music_entry               ; 8FFC FF 8F                    ..
; ----------------------------------------------------------------------------
mus11_priority:
        .byte   $01                             ; 8FFE 01                       .
; empty music table entries point here
empty_music_entry:
        .byte   $00                             ; 8FFF 00                       .
; ----------------------------------------------------------------------------
; called from cart_entry_point routine
init_game:
        lda     #$00                            ; 9000 A9 00                    ..
        sta     option_key_enabled              ; 9002 8D C6 06                 ...
        sta     start_key_enabled               ; 9005 8D C8 06                 ...
        nop                                     ; 9008 EA                       .
        nop                                     ; 9009 EA                       .
        nop                                     ; 900A EA                       .
        nop                                     ; 900B EA                       .
; this entry point doesn't disable start/option keys
reinit_game:
        jsr     enable_joystick_jv              ; 900C 20 1B 80                  ..
        lda     #$00                            ; 900F A9 00                    ..
        sta     $A0                             ; 9011 85 A0                    ..
        sta     select_key_vec                  ; 9013 8D C2 06                 ...
        lda     #$94                            ; 9016 A9 94                    ..
        sta     select_key_vec+1                ; 9018 8D C3 06                 ...
; set select key vector to ask_num_players at $9400, enable select key
setup_select_key_vec:
        sta     select_key_enabled              ; 901B 8D C7 06                 ...
        ldx     #$08                            ; 901E A2 08                    ..
        lda     #$FF                            ; 9020 A9 FF                    ..
; seems to try to write $FF bytes to ROM that already contains $FF's (it's the solid block character in the font). possibly left over from early development before conversion to cartridge.
try_to_write_rom:
        sta     block_char_minus_one,x          ; 9022 9D 0F 9E                 ...
        dex                                     ; 9025 CA                       .
        bne     try_to_write_rom                ; 9026 D0 FA                    ..
        ldx     #$C0                            ; 9028 A2 C0                    ..
copy_title_screen:
        lda     title_screen_data_minus_one,x   ; 902A BD CE 91                 ...
        sta     $2FFF,x                         ; 902D 9D FF 2F                 ../
        dex                                     ; 9030 CA                       .
        bne     copy_title_screen               ; 9031 D0 F7                    ..
        lda     #$46                            ; 9033 A9 46                    .F
        sta     COLOR1                          ; 9035 8D C5 02                 ...
        lda     #$C4                            ; 9038 A9 C4                    ..
        sta     COLOR2                          ; 903A 8D C6 02                 ...
        lda     #$00                            ; 903D A9 00                    ..
        sta     $9C                             ; 903F 85 9C                    ..
        sta     $9D                             ; 9041 85 9D                    ..
        sta     COLOR3                          ; 9043 8D C7 02                 ...
        lda     #$B3                            ; 9046 A9 B3                    ..
        sta     dlist_shadow_lo                 ; 9048 8D AC 06                 ...
        lda     #$91                            ; 904B A9 91                    ..
        sta     dlist_shadow_hi                 ; 904D 8D AD 06                 ...
        lda     #$00                            ; 9050 A9 00                    ..
        sta     HSCROL                          ; 9052 8D 04 D4                 ...
        lda     #$A5                            ; 9055 A9 A5                    ..
        sta     AUDC1                           ; 9057 8D 01 D2                 ...
        lda     #$ED                            ; 905A A9 ED                    ..
        sta     dli_vec_shadow_lo               ; 905C 8D AE 06                 ...
; set work_level_sub0 to fade_in_letters
ts_setup_sub0:
        lda     #$92                            ; 905F A9 92                    ..
        sta     dli_vec_shadow_hi               ; 9061 8D AF 06                 ...
        lda     #$3C                            ; 9064 A9 3C                    .<
        sta     work_level_sub0                 ; 9066 8D 82 07                 ...
        lda     #$91                            ; 9069 A9 91                    ..
        sta     work_level_sub0+1               ; 906B 8D 83 07                 ...
; fade_in_letters increments $9c after every letter, $0e means they're all done (since there are 14 of them and we start counting at zero)
wait_letters_done:
        lda     $9C                             ; 906E A5 9C                    ..
        cmp     #$0E                            ; 9070 C9 0E                    ..
        bne     wait_letters_done               ; 9072 D0 FA                    ..
        lda     #$E6                            ; 9074 A9 E6                    ..
        sta     work_level_sub0                 ; 9076 8D 82 07                 ...
        lda     #$06                            ; 9079 A9 06                    ..
        sta     work_level_sub0+1               ; 907B 8D 83 07                 ...
        lda     #$00                            ; 907E A9 00                    ..
        sta     sfx_ptr                         ; 9080 8D 3C 06                 .<.
        lda     #$93                            ; 9083 A9 93                    ..
        sta     sfx_ptr+1                       ; 9085 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; 9088 20 06 80                  ..
        lda     #$51                            ; 908B A9 51                    .Q
        sta     sfx_ptr                         ; 908D 8D 3C 06                 .<.
        lda     #$93                            ; 9090 A9 93                    ..
        sta     sfx_ptr+1                       ; 9092 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; 9095 20 06 80                  ..
        lda     #$9C                            ; 9098 A9 9C                    ..
        sta     sfx_ptr                         ; 909A 8D 3C 06                 .<.
        lda     #$93                            ; 909D A9 93                    ..
        sta     sfx_ptr+1                       ; 909F 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; 90A2 20 06 80                  ..
        lda     #$D7                            ; 90A5 A9 D7                    ..
        sta     sfx_ptr                         ; 90A7 8D 3C 06                 .<.
        lda     #$93                            ; 90AA A9 93                    ..
        sta     sfx_ptr+1                       ; 90AC 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; 90AF 20 06 80                  ..
        lda     #$00                            ; 90B2 A9 00                    ..
        sta     $9C                             ; 90B4 85 9C                    ..
        sta     $9D                             ; 90B6 85 9D                    ..
        lda     #$07                            ; 90B8 A9 07                    ..
        sta     $B9                             ; 90BA 85 B9                    ..
; set _sub0 to title_dancing
start_dancing:
        lda     #$72                            ; 90BC A9 72                    .r
        sta     work_level_sub0                 ; 90BE 8D 82 07                 ...
        lda     #$91                            ; 90C1 A9 91                    ..
        sta     work_level_sub0+1               ; 90C3 8D 83 07                 ...
        ldx     #$FF                            ; 90C6 A2 FF                    ..
; lot going on here, not understood yet
funky_init_loop:
        inx                                     ; 90C8 E8                       .
        cpx     #$02                            ; 90C9 E0 02                    ..
        beq     funky_init_loop                 ; 90CB F0 FB                    ..
        cpx     #$05                            ; 90CD E0 05                    ..
        beq     L910A                           ; 90CF F0 39                    .9
        ldy     L92A3,x                         ; 90D1 BC A3 92                 ...
L90D4:  lda     $0649,y                         ; 90D4 B9 49 06                 .I.
        and     #$0F                            ; 90D7 29 0F                    ).
        beq     L90D4                           ; 90D9 F0 F9                    ..
        lda     #$00                            ; 90DB A9 00                    ..
        sta     $066E,x                         ; 90DD 9D 6E 06                 .n.
        lda     #$9D                            ; 90E0 A9 9D                    ..
        sta     $0673,x                         ; 90E2 9D 73 06                 .s.
        lda     #$0A                            ; 90E5 A9 0A                    ..
        sta     $0678,x                         ; 90E7 9D 78 06                 .x.
        lda     #$01                            ; 90EA A9 01                    ..
        sta     $0687,x                         ; 90EC 9D 87 06                 ...
        lda     #$5C                            ; 90EF A9 5C                    .\
        sta     $0682,x                         ; 90F1 9D 82 06                 ...
        lda     L929E,x                         ; 90F4 BD 9E 92                 ...
        sta     $067D,x                         ; 90F7 9D 7D 06                 .}.
        sta     $0669,x                         ; 90FA 9D 69 06                 .i.
        ldy     L92E8,x                         ; 90FD BC E8 92                 ...
        lda     #$0F                            ; 9100 A9 0F                    ..
        sta     PCOLR0,y                        ; 9102 99 C0 02                 ...
        inc     $9C                             ; 9105 E6 9C                    ..
        jmp     funky_init_loop                 ; 9107 4C C8 90                 L..

; ----------------------------------------------------------------------------
L910A:  lda     $9D                             ; 910A A5 9D                    ..
        cmp     #$1D                            ; 910C C9 1D                    ..
        beq     try_to_write_rom_again          ; 910E F0 16                    ..
        cmp     #$20                            ; 9110 C9 20                    . 
        bcc     L910A                           ; 9112 90 F6                    ..
; set work_level_sub0 to $06e6 (just an RTS)
ts_clear_sub0:
        lda     #$E6                            ; 9114 A9 E6                    ..
        sta     work_level_sub0                 ; 9116 8D 82 07                 ...
        lda     #$06                            ; 9119 A9 06                    ..
        sta     work_level_sub0+1               ; 911B 8D 83 07                 ...
        lda     #$08                            ; 911E A9 08                    ..
        sta     COLOR0                          ; 9120 8D C4 02                 ...
        jmp     demo_mode                       ; 9123 4C 6B B9                 Lk.

; ----------------------------------------------------------------------------
; see comment at try_to_write_rom. this writes something else to the block character in the font, which causes the graphics corruption on cracked disk versions. it doesn't seem to actually hurt anything though.
try_to_write_rom_again:
        ldx     #$08                            ; 9126 A2 08                    ..
L9128:  lda     replacement_block_char_minus_one,x; 9128 BD 33 91               .3.
        sta     block_char_minus_one,x          ; 912B 9D 0F 9E                 ...
        dex                                     ; 912E CA                       .
        bne     L9128                           ; 912F D0 F7                    ..
replacement_block_char_minus_one:= * + 2        ; 1-indexed...
        jmp     L910A                           ; 9131 4C 0A 91                 L..

; ----------------------------------------------------------------------------
replacement_block_char:
        .byte   $BF,$BF,$CF,$EF,$E7,$DB,$D9,$BF ; 9134 BF BF CF EF E7 DB D9 BF  ........
; ----------------------------------------------------------------------------
; rotate colors and play the descending tone as each letter appears on the title screen. called once per frame, uses $9c to keep track of letter. caller stops this routine being called when $9c holds $0e (meaning the last letter is done).
fade_in_letters:
        lda     $062A                           ; 913C AD 2A 06                 .*.
        sta     COLOR0                          ; 913F 8D C4 02                 ...
        ldy     $9C                             ; 9142 A4 9C                    ..
; don't 'fade-in' the space in the title (offset 7)
skip_space:
        cpy     #$07                            ; 9144 C0 07                    ..
        beq     turn_letter_white               ; 9146 F0 1C                    ..
        clc                                     ; 9148 18                       .
        lda     $9D                             ; 9149 A5 9D                    ..
        adc     #$04                            ; 914B 69 04                    i.
        sta     $9D                             ; 914D 85 9D                    ..
        beq     turn_letter_white               ; 914F F0 13                    ..
        sta     AUDF1                           ; 9151 8D 00 D2                 ...
; the luminance stays the same
rotate_hue:
        lsr     a                               ; 9154 4A                       J
        lsr     a                               ; 9155 4A                       J
        lsr     a                               ; 9156 4A                       J
        lsr     a                               ; 9157 4A                       J
        ora     #$60                            ; 9158 09 60                    .`
        sta     COLOR3                          ; 915A 8D C7 02                 ...
        lda     title_letters,y                 ; 915D B9 8F 92                 ...
; $3000 is screen memory, at this point
show_letter:
        sta     $3045,y                         ; 9160 99 45 30                 .E0
        rts                                     ; 9163 60                       `

; ----------------------------------------------------------------------------
; clear the high 2 bits on the letter, in screen memory
turn_letter_white:
        lda     $3045,y                         ; 9164 B9 45 30                 .E0
        and     #$3F                            ; 9167 29 3F                    )?
        sta     $3045,y                         ; 9169 99 45 30                 .E0
        inc     $9C                             ; 916C E6 9C                    ..
        iny                                     ; 916E C8                       .
        jmp     rotate_hue                      ; 916F 4C 54 91                 LT.

; ----------------------------------------------------------------------------
; make jumpmen dance on title screen, called once/frame
title_dancing:
        lda     $062A                           ; 9172 AD 2A 06                 .*.
        sta     COLOR0                          ; 9175 8D C4 02                 ...
        lda     $9C                             ; 9178 A5 9C                    ..
        cmp     #$04                            ; 917A C9 04                    ..
        beq     L917F                           ; 917C F0 01                    ..
L917E:  rts                                     ; 917E 60                       `

; ----------------------------------------------------------------------------
L917F:  lda     $0649                           ; 917F AD 49 06                 .I.
        and     #$0F                            ; 9182 29 0F                    ).
        bne     L917E                           ; 9184 D0 F8                    ..
        inc     $B9                             ; 9186 E6 B9                    ..
        lda     $B9                             ; 9188 A5 B9                    ..
        and     #$0F                            ; 918A 29 0F                    ).
        sta     $B9                             ; 918C 85 B9                    ..
        bne     L917E                           ; 918E D0 EE                    ..
        ldx     $9D                             ; 9190 A6 9D                    ..
        ldy     #$FF                            ; 9192 A0 FF                    ..
L9194:  iny                                     ; 9194 C8                       .
        cpy     #$02                            ; 9195 C0 02                    ..
        beq     L9194                           ; 9197 F0 FB                    ..
        cpy     #$05                            ; 9199 C0 05                    ..
        beq     L91B0                           ; 919B F0 13                    ..
        lda     L92C8,x                         ; 919D BD C8 92                 ...
        sta     $0687,y                         ; 91A0 99 87 06                 ...
        clc                                     ; 91A3 18                       .
        lda     L92A8,x                         ; 91A4 BD A8 92                 ...
        adc     $067D,y                         ; 91A7 79 7D 06                 y}.
        sta     $067D,y                         ; 91AA 99 7D 06                 .}.
        jmp     L9194                           ; 91AD 4C 94 91                 L..

; ----------------------------------------------------------------------------
L91B0:  inc     $9D                             ; 91B0 E6 9D                    ..
        rts                                     ; 91B2 60                       `

; ----------------------------------------------------------------------------
; display list for title screen
title_display_list:
        .byte   $70,$70,$70,$47,$00,$30,$06,$60 ; 91B3 70 70 70 47 00 30 06 60  pppG.0.`
        .byte   $60,$70,$70,$70,$70,$17,$17,$97 ; 91BB 60 70 70 70 70 17 17 97  `pppp...
        .byte   $70,$70,$70,$70,$70,$70,$70,$02 ; 91C3 70 70 70 70 70 70 70 02  ppppppp.
        .byte   $02,$41,$B3                     ; 91CB 02 41 B3                 .A.
title_screen_data_minus_one:
        .byte   $91                             ; 91CE 91                       .
; title screen data
title_screen_data:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 91CF 00 00 00 00 00 00 00 00  ........
        .byte   $65,$70,$79,$78,$00,$00,$00,$00 ; 91D7 65 70 79 78 00 00 00 00  epyx....
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 91DF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$70,$72,$65,$73,$65,$6E ; 91E7 00 00 70 72 65 73 65 6E  ..presen
        .byte   $74,$73,$00,$00,$00,$00,$00,$00 ; 91EF 74 73 00 00 00 00 00 00  ts......
        .byte   $00,$00,$00,$82,$82,$82,$82,$82 ; 91F7 00 00 00 82 82 82 82 82  ........
        .byte   $82,$82,$82,$82,$82,$82,$82,$82 ; 91FF 82 82 82 82 82 82 82 82  ........
        .byte   $82,$82,$82,$82,$82,$00,$00,$00 ; 9207 82 82 82 82 82 00 00 00  ........
        .byte   $00,$00,$00,$82,$00,$00,$00,$00 ; 920F 00 00 00 82 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9217 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$82,$00,$00,$00 ; 921F 00 00 00 00 82 00 00 00  ........
        .byte   $00,$00,$00,$82,$82,$82,$82,$82 ; 9227 00 00 00 82 82 82 82 82  ........
        .byte   $82,$82,$82,$82,$82,$82,$82,$82 ; 922F 82 82 82 82 82 82 82 82  ........
        .byte   $82,$82,$82,$82,$82,$00,$00,$00 ; 9237 82 82 82 82 82 00 00 00  ........
        .byte   $40,$40,$40,$40,$40,$40,$40,$40 ; 923F 40 40 40 40 40 40 40 40  @@@@@@@@
        .byte   $40,$40,$40,$40,$48,$63,$49,$40 ; 9247 40 40 40 40 48 63 49 40  @@@@HcI@
        .byte   $51,$59,$58,$53,$40,$62,$79,$40 ; 924F 51 59 58 53 40 62 79 40  QYXS@by@
        .byte   $65,$70,$79,$78,$40,$40,$40,$40 ; 9257 65 70 79 78 40 40 40 40  epyx@@@@
        .byte   $40,$40,$40,$40,$40,$40,$40,$40 ; 925F 40 40 40 40 40 40 40 40  @@@@@@@@
        .byte   $40,$40,$40,$40,$40,$40,$40,$40 ; 9267 40 40 40 40 40 40 40 40  @@@@@@@@
        .byte   $63,$72,$65,$61,$74,$65,$64,$40 ; 926F 63 72 65 61 74 65 64 40  created@
        .byte   $62,$79,$5A,$40,$72,$61,$6E,$64 ; 9277 62 79 5A 40 72 61 6E 64  byZ@rand
        .byte   $79,$40,$67,$6C,$6F,$76,$65,$72 ; 927F 79 40 67 6C 6F 76 65 72  y@glover
        .byte   $40,$40,$40,$40,$40,$40,$40,$40 ; 9287 40 40 40 40 40 40 40 40  @@@@@@@@
; JUMPMAN JUNIOR in screen codes with high bit set
title_letters:
        .byte   $EA,$F5,$ED,$F0,$ED,$E1,$EE,$00 ; 928F EA F5 ED F0 ED E1 EE 00  ........
        .byte   $EA,$F5,$EE,$E9,$EF,$F2,$00     ; 9297 EA F5 EE E9 EF F2 00     .......
L929E:  .byte   $6A,$76,$00,$82,$8E             ; 929E 6A 76 00 82 8E           jv...
L92A3:  .byte   $00,$02,$00,$04,$06             ; 92A3 00 02 00 04 06           .....
L92A8:  .byte   $02,$02,$FE,$FE,$FE,$FE,$02,$02 ; 92A8 02 02 FE FE FE FE 02 02  ........
        .byte   $02,$02,$02,$02,$FE,$FE,$FE,$FE ; 92B0 02 02 02 02 FE FE FE FE  ........
        .byte   $FE,$FE,$FE,$FE,$02,$02,$02,$02 ; 92B8 FE FE FE FE 02 02 02 02  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 92C0 00 00 00 00 00 00 00 00  ........
L92C8:  .byte   $08,$09,$08,$09,$0C,$0D,$0C,$0D ; 92C8 08 09 08 09 0C 0D 0C 0D  ........
        .byte   $08,$06,$09,$06,$08,$10,$09,$10 ; 92D0 08 06 09 06 08 10 09 10  ........
        .byte   $0C,$06,$0D,$06,$0C,$11,$0D,$11 ; 92D8 0C 06 0D 06 0C 11 0D 11  ........
        .byte   $12,$13,$14,$15,$04,$04,$04,$04 ; 92E0 12 13 14 15 04 04 04 04  ........
L92E8:  .byte   $07,$00,$00,$02,$03,$48,$A9,$94 ; 92E8 07 00 00 02 03 48 A9 94  .....H..
        .byte   $8D,$0A,$D4,$8D,$18,$D0,$A9,$CA ; 92F0 8D 0A D4 8D 18 D0 A9 CA  ........
        .byte   $8D,$17,$D0,$68,$40,$00,$00,$00 ; 92F8 8D 17 D0 68 40 00 00 00  ...h@...
; title screen music. only use of 4-part harmony in the game, this and _v1 _v2 _v3.
sfx_title_v0:
        .byte   $01,$A0,$02,$0A,$80,$01,$A5,$02 ; 9300 01 A0 02 0A 80 01 A5 02  ........
        .byte   $3C,$20,$79,$20,$51,$20,$5B,$08 ; 9308 3C 20 79 20 51 20 5B 08  < y Q [.
        .byte   $60,$08,$6C,$08,$5B,$08,$60,$10 ; 9310 60 08 6C 08 5B 08 60 10  `.l.[.`.
        .byte   $79,$10,$5B,$08,$60,$08,$6C,$08 ; 9318 79 10 5B 08 60 08 6C 08  y.[.`.l.
        .byte   $5B,$08,$60,$10,$79,$10,$79,$20 ; 9320 5B 08 60 10 79 10 79 20  [.`.y.y 
        .byte   $79,$20,$79,$08,$6C,$08,$60,$08 ; 9328 79 20 79 08 6C 08 60 08  y y.l.`.
        .byte   $51,$08,$3C,$20,$3C,$08,$51,$08 ; 9330 51 08 3C 20 3C 08 51 08  Q.< <.Q.
        .byte   $60,$08,$51,$08,$79,$20,$79,$08 ; 9338 60 08 51 08 79 20 79 08  `.Q.y y.
        .byte   $6C,$08,$60,$08,$5B,$08,$51,$08 ; 9340 6C 08 60 08 5B 08 51 08  l.`.[.Q.
        .byte   $48,$08,$40,$08,$51,$08,$3C,$40 ; 9348 48 08 40 08 51 08 3C 40  H.@.Q.<@
        .byte   $00                             ; 9350 00                       .
sfx_title_v1:
        .byte   $01,$A0,$02,$0A,$60,$01,$A3,$02 ; 9351 01 A0 02 0A 60 01 A3 02  ....`...
        .byte   $51,$40,$79,$10,$A2,$10,$79,$10 ; 9359 51 40 79 10 A2 10 79 10  Q@y...y.
        .byte   $6C,$10,$79,$08,$A2,$08,$F3,$10 ; 9361 6C 10 79 08 A2 08 F3 10  l.y.....
        .byte   $F3,$20,$79,$08,$A2,$08,$F3,$10 ; 9369 F3 20 79 08 A2 08 F3 10  . y.....
        .byte   $A2,$10,$79,$10,$A2,$20,$F3,$20 ; 9371 A2 10 79 10 A2 20 F3 20  ..y.. . 
        .byte   $79,$10,$A2,$10,$79,$10,$A2,$10 ; 9379 79 10 A2 10 79 10 A2 10  y...y...
        .byte   $79,$10,$A2,$10,$F3,$10,$F3,$10 ; 9381 79 10 A2 10 F3 10 F3 10  y.......
        .byte   $F3,$08,$D9,$08,$C1,$08,$B6,$08 ; 9389 F3 08 D9 08 C1 08 B6 08  ........
        .byte   $A2,$08,$90,$08,$80,$08,$A2,$08 ; 9391 A2 08 90 08 80 08 A2 08  ........
        .byte   $79,$40,$00                     ; 9399 79 40 00                 y@.
sfx_title_v2:
        .byte   $01,$A0,$02,$0A,$40,$01,$A4,$02 ; 939C 01 A0 02 0A 40 01 A4 02  ....@...
        .byte   $60,$60,$01,$A0,$02,$0A,$10,$01 ; 93A4 60 60 01 A0 02 0A 10 01  ``......
        .byte   $A3,$02,$F3,$20,$A2,$30,$A2,$10 ; 93AC A3 02 F3 20 A2 30 A2 10  ... .0..
        .byte   $C1,$10,$02,$A6,$93,$01,$01,$A0 ; 93B4 C1 10 02 A6 93 01 01 A0  ........
        .byte   $02,$0A,$10,$01,$A3,$02,$A2,$20 ; 93BC 02 0A 10 01 A3 02 A2 20  ....... 
        .byte   $A2,$20,$F3,$30,$01,$A0,$02,$0A ; 93C4 A2 20 F3 30 01 A0 02 0A  . .0....
        .byte   $40,$01,$A4,$02,$79,$10,$A2,$10 ; 93CC 40 01 A4 02 79 10 A2 10  @...y...
        .byte   $F3,$20,$00                     ; 93D4 F3 20 00                 . .
sfx_title_v3:
        .byte   $01,$A0,$02,$0A,$20,$01,$A4,$02 ; 93D7 01 A0 02 0A 20 01 A4 02  .... ...
        .byte   $79,$78,$01,$A0,$02,$0A,$FF,$0A ; 93DF 79 78 01 A0 02 0A FF 0A  yx......
        .byte   $FF,$0A,$40,$00,$00,$00,$00,$00 ; 93E7 FF 0A 40 00 00 00 00 00  ..@.....
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 93EF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 93F7 00 00 00 00 00 00 00 00  ........
        .byte   $00                             ; 93FF 00                       .
; ----------------------------------------------------------------------------
ask_num_players:
        ldx     #$FF                            ; 9400 A2 FF                    ..
        lda     #$00                            ; 9402 A9 00                    ..
        sta     select_key_enabled              ; 9404 8D C7 06                 ...
        sta     level                           ; 9407 8D F6 06                 ...
        dec     level                           ; 940A CE F6 06                 ...
; clear area where NUMBER OF PLAYERS? will be displayed
anp_clear_loop:
        sta     $37FF,x                         ; 940D 9D FF 37                 ..7
        dex                                     ; 9410 CA                       .
        bne     anp_clear_loop                  ; 9411 D0 FA                    ..
        jsr     enable_joystick_jv              ; 9413 20 1B 80                  ..
        ldx     #$2C                            ; 9416 A2 2C                    .,
; copy NUMBER OF PLAYERS to screen RAM
anp_copy_loop:
        lda     numplayers_screen_data_minus_one,x; 9418 BD 9A 95               ...
        sta     $37FF,x                         ; 941B 9D FF 37                 ..7
        dex                                     ; 941E CA                       .
        bne     anp_copy_loop                   ; 941F D0 F7                    ..
; X is now 0
anp_loop_done:
        stx     $B7                             ; 9421 86 B7                    ..
        stx     $B8                             ; 9423 86 B8                    ..
        stx     randomizer_mode                 ; 9425 8E F3 06                 ...
        stx     COLOR4                          ; 9428 8E C8 02                 ...
        lda     #$04                            ; 942B A9 04                    ..
        sta     HSCROL                          ; 942D 8D 04 D4                 ...
        sta     $A0                             ; 9430 85 A0                    ..
        lda     #$1A                            ; 9432 A9 1A                    ..
        sta     COLOR3                          ; 9434 8D C7 02                 ...
        lda     #$96                            ; 9437 A9 96                    ..
        sta     COLOR2                          ; 9439 8D C6 02                 ...
        lda     #$C6                            ; 943C A9 C6                    ..
        sta     COLOR1                          ; 943E 8D C5 02                 ...
        jsr     init_struct_users_jv            ; 9441 20 24 80                  $.
; set dlist shadow to point to numplayer_display_list
setup_numplayer_dlist:
        lda     #$5F                            ; 9444 A9 5F                    ._
        sta     dlist_shadow_lo                 ; 9446 8D AC 06                 ...
        lda     #$95                            ; 9449 A9 95                    ..
        sta     dlist_shadow_hi                 ; 944B 8D AD 06                 ...
; set dli vector to point to num_player_dli_service
setup_numplayer_dli_sr:
        lda     #$78                            ; 944E A9 78                    .x
        sta     dli_vec_shadow_lo               ; 9450 8D AE 06                 ...
        lda     #$95                            ; 9453 A9 95                    ..
        sta     dli_vec_shadow_hi               ; 9455 8D AF 06                 ...
; we'll jump to $9489 aka option_key_handler when option key is pressed
setup_option_key_vec:
        lda     #$89                            ; 9458 A9 89                    ..
        sta     option_key_vec                  ; 945A 8D C0 06                 ...
        lda     #$94                            ; 945D A9 94                    ..
        sta     option_key_vec+1                ; 945F 8D C1 06                 ...
        sta     option_key_enabled              ; 9462 8D C6 06                 ...
; we'll jump to $94de aka get_player_speeds when start key is pressed
setup_start_key_vec:
        lda     #$DE                            ; 9465 A9 DE                    ..
        sta     start_key_vec                   ; 9467 8D C4 06                 ...
        lda     #$94                            ; 946A A9 94                    ..
        sta     start_key_vec+1                 ; 946C 8D C5 06                 ...
; play sfx_select_key at $95f1
play_select_key_sfx:
        lda     #$F1                            ; 946F A9 F1                    ..
        sta     sfx_ptr                         ; 9471 8D 3C 06                 .<.
        lda     #$95                            ; 9474 A9 95                    ..
        sta     sfx_ptr+1                       ; 9476 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; 9479 20 06 80                  ..
; wait for sound to finish playing
wait_sfx:
        lda     sfx_slot_duration               ; 947C AD 46 06                 .F.
        bne     wait_sfx                        ; 947F D0 FB                    ..
        lda     #$01                            ; 9481 A9 01                    ..
        sta     start_key_enabled               ; 9483 8D C8 06                 ...
; initialization done, everything's done in interrupts from here on out
hang_main_thread:
        jmp     hang_main_thread                ; 9486 4C 86 94                 L..

; ----------------------------------------------------------------------------
; called via option_key_vec when someone presses option
option_key_handler:
        lda     #$00                            ; 9489 A9 00                    ..
        sta     option_key_enabled              ; 948B 8D C6 06                 ...
        lda     $B8                             ; 948E A5 B8                    ..
        clc                                     ; 9490 18                       .
        adc     #$01                            ; 9491 69 01                    i.
        and     #$03                            ; 9493 29 03                    ).
        sta     $B8                             ; 9495 85 B8                    ..
        tay                                     ; 9497 A8                       .
        lda     number_names_0,y                ; 9498 B9 DD 95                 ...
        sta     $381D                           ; 949B 8D 1D 38                 ..8
        lda     number_names_1,y                ; 949E B9 E1 95                 ...
        sta     $381E                           ; 94A1 8D 1E 38                 ..8
        lda     number_names_2,y                ; 94A4 B9 E5 95                 ...
        sta     $381F                           ; 94A7 8D 1F 38                 ..8
        lda     number_names_3,y                ; 94AA B9 E9 95                 ...
        sta     $3820                           ; 94AD 8D 20 38                 . 8
        lda     number_names_4,y                ; 94B0 B9 ED 95                 ...
        sta     $3821                           ; 94B3 8D 21 38                 .!8
        lda     num_name_hscrol_table,y         ; 94B6 B9 D9 95                 ...
        sta     HSCROL                          ; 94B9 8D 04 D4                 ...
play_opt_key_sfx:
        lda     #$B0                            ; 94BC A9 B0                    ..
        sta     sfx_ptr                         ; 94BE 8D 3C 06                 .<.
        lda     #$8A                            ; 94C1 A9 8A                    ..
        sta     sfx_ptr+1                       ; 94C3 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; 94C6 20 06 80                  ..
        lda     #$00                            ; 94C9 A9 00                    ..
        sta     jiffy_timer_1                   ; 94CB 8D 1A 06                 ...
; wait until it's done playing
wait_opt_key_sfx:
        lda     jiffy_timer_1                   ; 94CE AD 1A 06                 ...
        cmp     #$08                            ; 94D1 C9 08                    ..
        bcc     wait_opt_key_sfx                ; 94D3 90 F9                    ..
        sta     option_key_enabled              ; 94D5 8D C6 06                 ...
        sta     start_key_enabled               ; 94D8 8D C8 06                 ...
        jmp     hang_main_thread                ; 94DB 4C 86 94                 L..

; ----------------------------------------------------------------------------
; loop up to 4 times, ask PLAYER #n SPEED? and wait for number key press
get_player_speeds:
        lda     $B8                             ; 94DE A5 B8                    ..
        sta     $B9                             ; 94E0 85 B9                    ..
        sta     number_of_users                 ; 94E2 8D FF 06                 ...
        sta     users_still_alive               ; 94E5 8D F4 06                 ...
        lda     #$00                            ; 94E8 A9 00                    ..
        sta     $B8                             ; 94EA 85 B8                    ..
; disable start and option keys
disable_start_opt:
        sta     option_key_enabled              ; 94EC 8D C6 06                 ...
        sta     start_key_enabled               ; 94EF 8D C8 06                 ...
        sta     $BA                             ; 94F2 85 BA                    ..
        inc     $B9                             ; 94F4 E6 B9                    ..
        inc     $BA                             ; 94F6 E6 BA                    ..
        tay                                     ; 94F8 A8                       .
; copy PLAYER #n SPEED? to screen RAM
show_player_speed_prompt:
        ldx     #$00                            ; 94F9 A2 00                    ..
psprompt_loop:
        lda     player_x_speed,x                ; 94FB BD C5 95                 ...
        sta     $382C,y                         ; 94FE 99 2C 38                 .,8
        inx                                     ; 9501 E8                       .
        iny                                     ; 9502 C8                       .
        cpx     #$14                            ; 9503 E0 14                    ..
        bne     psprompt_loop                   ; 9505 D0 F4                    ..
        lda     $BA                             ; 9507 A5 BA                    ..
        sta     current_user                    ; 9509 8D FE 06                 ...
        ora     #$90                            ; 950C 09 90                    ..
        inc     $BA                             ; 950E E6 BA                    ..
        sta     $3821,y                         ; 9510 99 21 38                 .!8
        dec     $B9                             ; 9513 C6 B9                    ..
        bne     show_player_speed_prompt        ; 9515 D0 E2                    ..
; set select key vector to ask_num_players at $9400, enable select key
setup_select_key_vec_again:
        lda     #$00                            ; 9517 A9 00                    ..
        sta     select_key_vec                  ; 9519 8D C2 06                 ...
        lda     #$94                            ; 951C A9 94                    ..
        sta     select_key_vec+1                ; 951E 8D C3 06                 ...
        sta     select_key_enabled              ; 9521 8D C7 06                 ...
        dec     $BA                             ; 9524 C6 BA                    ..
        ldy     #$12                            ; 9526 A0 12                    ..
        ldx     #$00                            ; 9528 A2 00                    ..
; initialize speed to -1
init_speed:
        lda     #$FF                            ; 952A A9 FF                    ..
        sta     speed_value                     ; 952C 8D F9 06                 ...
; wait for keyboard IRQ handler to set a speed <= 8
wait_for_speed:
        lda     speed_value                     ; 952F AD F9 06                 ...
        cmp     #$09                            ; 9532 C9 09                    ..
        bcs     wait_for_speed                  ; 9534 B0 F9                    ..
        sta     $0714,x                         ; 9536 9D 14 07                 ...
        pha                                     ; 9539 48                       H
        clc                                     ; 953A 18                       .
; 11-byte per-user struct?
add_11_to_x:
        txa                                     ; 953B 8A                       .
        adc     #$0B                            ; 953C 69 0B                    i.
        tax                                     ; 953E AA                       .
        pla                                     ; 953F 68                       h
; convert to ASCII digit
speed_to_ascii:
        ora     #$90                            ; 9540 09 90                    ..
; show it to the user
display_speed:
        sta     $382C,y                         ; 9542 99 2C 38                 .,8
        tya                                     ; 9545 98                       .
        clc                                     ; 9546 18                       .
        adc     #$14                            ; 9547 69 14                    i.
        tay                                     ; 9549 A8                       .
        inc     $B8                             ; 954A E6 B8                    ..
        dec     $BA                             ; 954C C6 BA                    ..
        bne     init_speed                      ; 954E D0 DA                    ..
        inc     number_of_users                 ; 9550 EE FF 06                 ...
        lda     number_of_users                 ; 9553 AD FF 06                 ...
        sta     current_user                    ; 9556 8D FE 06                 ...
        inc     current_user                    ; 9559 EE FE 06                 ...
        jmp     afterlife                       ; 955C 4C 00 96                 L..

; ----------------------------------------------------------------------------
; display list for 'number of players' screen
numplayer_display_list:
        .byte   $70,$70,$70,$70,$47,$00,$38,$70 ; 955F 70 70 70 70 47 00 38 70  ppppG.8p
        .byte   $70,$97,$70,$70,$87,$70,$70,$87 ; 9567 70 97 70 70 87 70 70 87  p.pp.pp.
        .byte   $70,$70,$87,$70,$70,$07,$41,$5F ; 956F 70 70 87 70 70 07 41 5F  pp.pp.A_
        .byte   $95                             ; 9577 95                       .
; ----------------------------------------------------------------------------
; DLI service routine, changes COLPF2, address gets stored in $6ae/$6af by code at $944e
num_players_dli_service:
        pha                                     ; 9578 48                       H
        lda     $B7                             ; 9579 A5 B7                    ..
        cmp     $B8                             ; 957B C5 B8                    ..
        sta     WSYNC                           ; 957D 8D 0A D4                 ...
        bne     L9592                           ; 9580 D0 10                    ..
        lda     $062A                           ; 9582 AD 2A 06                 .*.
        sta     COLPF2                          ; 9585 8D 18 D0                 ...
L9588:  inc     $B7                             ; 9588 E6 B7                    ..
        lda     $B7                             ; 958A A5 B7                    ..
        and     #$03                            ; 958C 29 03                    ).
        sta     $B7                             ; 958E 85 B7                    ..
        pla                                     ; 9590 68                       h
        rti                                     ; 9591 40                       @

; ----------------------------------------------------------------------------
L9592:  lda     COLOR2                          ; 9592 AD C6 02                 ...
        sta     COLPF2                          ; 9595 8D 18 D0                 ...
numplayers_screen_data_minus_one:= * + 2        ; 1-indexed loop copies from here+1
        jmp     L9588                           ; 9598 4C 88 95                 L..

; ----------------------------------------------------------------------------
; 'number of players?', gets copied to $3800, see option_key_handler
numplayers_screen_data:
        .byte   $00,$6E,$75,$6D,$62,$65,$72,$00 ; 959B 00 6E 75 6D 62 65 72 00  .number.
        .byte   $6F,$66,$00,$70,$6C,$61,$79,$65 ; 95A3 6F 66 00 70 6C 61 79 65  of.playe
        .byte   $72,$73,$5F,$00,$00,$00,$00,$00 ; 95AB 72 73 5F 00 00 00 00 00  rs_.....
        .byte   $00,$00,$00,$00,$00,$00,$EF,$EE ; 95B3 00 00 00 00 00 00 EF EE  ........
        .byte   $E5,$00,$00,$00,$00,$00,$00,$00 ; 95BB E5 00 00 00 00 00 00 00  ........
        .byte   $00,$00                         ; 95C3 00 00                    ..
; ' PLAYER #  SPEED?   ' in PF2 color
player_x_speed:
        .byte   $00,$B0,$AC,$A1,$B9,$A5,$B2,$00 ; 95C5 00 B0 AC A1 B9 A5 B2 00  ........
        .byte   $83,$80,$80,$B3,$B0,$A5,$A5,$A4 ; 95CD 83 80 80 B3 B0 A5 A5 A4  ........
        .byte   $9F,$00,$00,$00                 ; 95D5 9F 00 00 00              ....
; used for centering ONE TWO THREE FOUR, see option_key_handler
num_name_hscrol_table:
        .byte   $04,$04,$04,$00                 ; 95D9 04 04 04 00              ....
; space space T space    (names ONE TWO THREE FOUR)
number_names_0:
        .byte   $00,$00,$F4,$00                 ; 95DD 00 00 F4 00              ....
; O     T     H     F
number_names_1:
        .byte   $EF,$F4,$E8,$E6                 ; 95E1 EF F4 E8 E6              ....
; N     W     R     O
number_names_2:
        .byte   $EE,$F7,$F2,$EF                 ; 95E5 EE F7 F2 EF              ....
; E     O     E     U
number_names_3:
        .byte   $E5,$EF,$E5,$F5                 ; 95E9 E5 EF E5 F5              ....
; space space E     R
number_names_4:
        .byte   $00,$00,$E5,$F2                 ; 95ED 00 00 E5 F2              ....
; played when select key pressed, 4 notes, descending
sfx_select_key:
        .byte   $01,$A4,$00,$1D,$08,$3C,$08,$79 ; 95F1 01 A4 00 1D 08 3C 08 79  .....<.y
        .byte   $08,$F3,$08,$00,$3C,$02,$00     ; 95F9 08 F3 08 00 3C 02 00     ....<..
; ----------------------------------------------------------------------------
; multiple code paths jump here. replay level, load next level, or go back to ask_num_players
afterlife:
        jsr     enable_joystick_jv              ; 9600 20 1B 80                  ..
        jsr     next_player_jv                  ; 9603 20 27 80                  '.
        lda     $06F8                           ; 9606 AD F8 06                 ...
        beq     L960E                           ; 9609 F0 03                    ..
        jmp     ask_num_players                 ; 960B 4C 00 94                 L..

; ----------------------------------------------------------------------------
L960E:  lda     $06F7                           ; 960E AD F7 06                 ...
        beq     L9616                           ; 9611 F0 03                    ..
        jsr     init_next_level                 ; 9613 20 E8 9B                  ..
L9616:  lda     #$00                            ; 9616 A9 00                    ..
        sta     bonus_jiffy_timer               ; 9618 8D 26 06                 .&.
        sta     $06F5                           ; 961B 8D F5 06                 ...
        sta     COLOR4                          ; 961E 8D C8 02                 ...
        jmp     L9BD0                           ; 9621 4C D0 9B                 L..

; ----------------------------------------------------------------------------
; only in multiplayer games
show_get_ready_prompt:
        ldx     current_user                    ; 9624 AE FE 06                 ...
        lda     color0_table_minus_one,x        ; 9627 BD 27 97                 .'.
        sta     COLOR4                          ; 962A 8D C8 02                 ...
        sta     COLOR0                          ; 962D 8D C4 02                 ...
        ldy     #$14                            ; 9630 A0 14                    ..
L9632:  lda     L9713,y                         ; 9632 B9 13 97                 ...
        sta     $0741,y                         ; 9635 99 41 07                 .A.
        dey                                     ; 9638 88                       .
        bne     L9632                           ; 9639 D0 F7                    ..
        lda     current_user                    ; 963B AD FE 06                 ...
        ora     #$10                            ; 963E 09 10                    ..
        sta     $074A                           ; 9640 8D 4A 07                 .J.
        lda     #$00                            ; 9643 A9 00                    ..
        sta     $B9                             ; 9645 85 B9                    ..
        sta     jiffy_timer_2                   ; 9647 8D 1B 06                 ...
; 06ac/06ad gets address of get_ready_dlist (why not SDLSTL/H?)
setup_get_ready_dl:
        lda     #$2C                            ; 964A A9 2C                    .,
        sta     dlist_shadow_lo                 ; 964C 8D AC 06                 ...
        lda     #$97                            ; 964F A9 97                    ..
        sta     dlist_shadow_hi                 ; 9651 8D AD 06                 ...
        lda     #$E6                            ; 9654 A9 E6                    ..
        sta     work_level_sub0                 ; 9656 8D 82 07                 ...
        lda     #$96                            ; 9659 A9 96                    ..
        sta     work_level_sub0+1               ; 965B 8D 83 07                 ...
        jsr     clear_screen_mem_jv             ; 965E 20 1E 80                  ..
        lda     cur_level_map                   ; 9661 AD D6 07                 ...
        sta     dm_progctr                      ; 9664 85 C0                    ..
        lda     cur_level_map+1                 ; 9666 AD D7 07                 ...
        sta     dm_progctr+1                    ; 9669 85 C1                    ..
        jsr     draw_map_jv                     ; 966B 20 00 80                  ..
L966E:  lda     jiffy_timer_2                   ; 966E AD 1B 06                 ...
        cmp     #$F2                            ; 9671 C9 F2                    ..
        bne     L966E                           ; 9673 D0 F9                    ..
L9675:  ldx     #$00                            ; 9675 A2 00                    ..
; copy cur_level_desc to work_level_desc. done in between players, in a multiplayer game (so each player starts out with a fresh level)
copy_work_level_desc:
        lda     cur_level_desc,x                ; 9677 BD C0 07                 ...
        sta     work_level_desc,x               ; 967A 9D 80 07                 ...
        inx                                     ; 967D E8                       .
        cpx     #$40                            ; 967E E0 40                    .@
        bne     copy_work_level_desc            ; 9680 D0 F5                    ..
; call start subroutine for current level
init_level:
        lda     work_level_init                 ; 9682 AD A2 07                 ...
        sta     $06E1                           ; 9685 8D E1 06                 ...
        lda     work_level_init+1               ; 9688 AD A3 07                 ...
        sta     $06E2                           ; 968B 8D E2 06                 ...
        jsr     L06E0                           ; 968E 20 E0 06                  ..
; set color regs from level descriptor (COLOR4 always $00, black)
set_level_colors:
        lda     #$00                            ; 9691 A9 00                    ..
        sta     COLOR4                          ; 9693 8D C8 02                 ...
        sta     $06AB                           ; 9696 8D AB 06                 ...
        lda     work_level_colpf0               ; 9699 AD AF 07                 ...
        sta     COLOR0                          ; 969C 8D C4 02                 ...
        lda     work_level_colpf1               ; 969F AD B0 07                 ...
        sta     COLOR1                          ; 96A2 8D C5 02                 ...
        lda     work_level_colpf2               ; 96A5 AD B1 07                 ...
        sta     COLOR2                          ; 96A8 8D C6 02                 ...
        lda     work_level_colpf3               ; 96AB AD AE 07                 ...
        sta     COLOR3                          ; 96AE 8D C7 02                 ...
        jsr     setup_gameboard_dlist_jv        ; 96B1 20 15 80                  ..
        inc     $06F5                           ; 96B4 EE F5 06                 ...
        jmp     L9BDD                           ; 96B7 4C DD 9B                 L..

; ----------------------------------------------------------------------------
; maybe this should be check_level or init_level?
enter_level:
        lda     #$00                            ; 96BA A9 00                    ..
        tay                                     ; 96BC A8                       .
        sta     $D7                             ; 96BD 85 D7                    ..
        sta     $D8                             ; 96BF 85 D8                    ..
        inc     level                           ; 96C1 EE F6 06                 ...
        lda     level                           ; 96C4 AD F6 06                 ...
        cmp     #$0C                            ; 96C7 C9 0C                    ..
        bne     copy_level_desc                 ; 96C9 D0 03                    ..
        jmp     ask_num_players                 ; 96CB 4C 00 94                 L..

; ----------------------------------------------------------------------------
; copy level descriptor from levelXX_desc at $A000+(level*$40) to cur_level_desc at $07c0-$07ff
copy_level_desc:
        lsr     a                               ; 96CE 4A                       J
        ror     $D7                             ; 96CF 66 D7                    f.
        lsr     a                               ; 96D1 4A                       J
        ror     $D7                             ; 96D2 66 D7                    f.
        ora     #$A0                            ; 96D4 09 A0                    ..
        sta     $D8                             ; 96D6 85 D8                    ..
sl_loop:lda     ($D7),y                         ; 96D8 B1 D7                    ..
        sta     cur_level_desc,y                ; 96DA 99 C0 07                 ...
        iny                                     ; 96DD C8                       .
        cpy     #$40                            ; 96DE C0 40                    .@
        bne     sl_loop                         ; 96E0 D0 F6                    ..
        jsr     draw_level_jv                   ; 96E2 20 2A 80                  *.
        rts                                     ; 96E5 60                       `

; ----------------------------------------------------------------------------
        lda     jiffy_timer_2                   ; 96E6 AD 1B 06                 ...
        cmp     #$F0                            ; 96E9 C9 F0                    ..
        bcs     L9709                           ; 96EB B0 1C                    ..
        and     #$1F                            ; 96ED 29 1F                    ).
        beq     L96F2                           ; 96EF F0 01                    ..
        rts                                     ; 96F1 60                       `

; ----------------------------------------------------------------------------
L96F2:  lda     COLOR0                          ; 96F2 AD C4 02                 ...
        cmp     #$0F                            ; 96F5 C9 0F                    ..
        beq     L96FF                           ; 96F7 F0 06                    ..
        lda     #$0F                            ; 96F9 A9 0F                    ..
        sta     COLOR0                          ; 96FB 8D C4 02                 ...
        rts                                     ; 96FE 60                       `

; ----------------------------------------------------------------------------
L96FF:  ldx     current_user                    ; 96FF AE FE 06                 ...
        lda     color0_table_minus_one,x        ; 9702 BD 27 97                 .'.
        sta     COLOR0                          ; 9705 8D C4 02                 ...
        rts                                     ; 9708 60                       `

; ----------------------------------------------------------------------------
L9709:  lda     #$E6                            ; 9709 A9 E6                    ..
        sta     work_level_sub0                 ; 970B 8D 82 07                 ...
        lda     #$06                            ; 970E A9 06                    ..
        sta     work_level_sub0+1               ; 9710 8D 83 07                 ...
L9713:  rts                                     ; 9713 60                       `

; ----------------------------------------------------------------------------
; PLAYER   GET READY
get_ready_msg:
        .byte   $00,$30,$2C,$21,$39,$25,$32,$00 ; 9714 00 30 2C 21 39 25 32 00  .0,!9%2.
        .byte   $00,$00,$27,$25,$34,$00,$32,$25 ; 971C 00 00 27 25 34 00 32 25  ..'%4.2%
        .byte   $21,$24,$39                     ; 9724 21 24 39                 !$9
; 1-indexed
color0_table_minus_one:
        .byte   $00                             ; 9727 00                       .
; background colors for GET READY screen (different for each player)
color0_table:
        .byte   $96,$24,$C6,$54                 ; 9728 96 24 C6 54              .$.T
; 112 blank scanlines, then one GR.2 line, loaded from $0742
get_ready_dlist:
        .byte   $70,$70,$70,$70,$70,$70,$70,$70 ; 972C 70 70 70 70 70 70 70 70  pppppppp
        .byte   $70,$70,$70,$70,$70,$70,$47,$42 ; 9734 70 70 70 70 70 70 47 42  ppppppGB
        .byte   $07,$41,$2C,$97                 ; 973C 07 41 2C 97              .A,.
; ----------------------------------------------------------------------------
game_main_loop:
        jsr     materialize_jumpman             ; 9740 20 7B 97                  {.
L9743:  jsr     check_bomb_coll_jv              ; 9743 20 33 80                  3.
        lda     work_level_num_bombs            ; 9746 AD 8A 07                 ...
        beq     got_all_bombs                   ; 9749 F0 1B                    ..
        lda     $0623                           ; 974B AD 23 06                 .#.
        cmp     #$02                            ; 974E C9 02                    ..
        bne     L9743                           ; 9750 D0 F1                    ..
L9752:  lda     $0623                           ; 9752 AD 23 06                 .#.
        cmp     #$02                            ; 9755 C9 02                    ..
        beq     L9752                           ; 9757 F0 F9                    ..
        lda     lives                           ; 9759 AD 0A 07                 ...
        cmp     #$FF                            ; 975C C9 FF                    ..
        bne     game_main_loop                  ; 975E D0 E0                    ..
        jsr     call_eol_sub                    ; 9760 20 6C 97                  l.
        jmp     crumble_gameboard_jv            ; 9763 4C 30 80                 L0.

; ----------------------------------------------------------------------------
got_all_bombs:
        jsr     call_eol_sub                    ; 9766 20 6C 97                  l.
        jmp     level_finished_jv               ; 9769 4C 2D 80                 L-.

; ----------------------------------------------------------------------------
call_eol_sub:
        lda     work_level_sub_eol              ; 976C AD A6 07                 ...
        sta     $06E4                           ; 976F 8D E4 06                 ...
        lda     work_level_sub_eol+1            ; 9772 AD A7 07                 ...
        sta     $06E5                           ; 9775 8D E5 06                 ...
        jmp     L06E3                           ; 9778 4C E3 06                 L..

; ----------------------------------------------------------------------------
materialize_jumpman:
        jsr     update_status_window_jv         ; 977B 20 12 80                  ..
        ldx     #$04                            ; 977E A2 04                    ..
        lda     #$00                            ; 9780 A9 00                    ..
mj_clear_loop:
        sta     $0755,x                         ; 9782 9D 55 07                 .U.
        sta     $069A,x                         ; 9785 9D 9A 06                 ...
        sta     $06EA,x                         ; 9788 9D EA 06                 ...
        sta     jump_frame,x                    ; 978B 9D EB 06                 ...
        dex                                     ; 978E CA                       .
        bne     mj_clear_loop                   ; 978F D0 F1                    ..
        sta     $0697                           ; 9791 8D 97 06                 ...
        sta     $0698                           ; 9794 8D 98 06                 ...
        sta     PCOLR0                          ; 9797 8D C0 02                 ...
        sta     $BA                             ; 979A 85 BA                    ..
        sta     AUDF4                           ; 979C 8D 06 D2                 ...
        lda     work_level_y_start              ; 979F AD 8C 07                 ...
        sta     player_y_pos                    ; 97A2 8D 83 06                 ...
        lda     work_level_x_start              ; 97A5 AD 8D 07                 ...
        sta     player_x_pos                    ; 97A8 8D 7E 06                 .~.
        lda     #$01                            ; 97AB A9 01                    ..
        sta     $0688                           ; 97AD 8D 88 06                 ...
        lda     #$A5                            ; 97B0 A9 A5                    ..
        sta     AUDC4                           ; 97B2 8D 07 D2                 ...
        inc     $066A                           ; 97B5 EE 6A 06                 .j.
        inc     $066B                           ; 97B8 EE 6B 06                 .k.
mj_set_freq_and_color:
        inc     $BA                             ; 97BB E6 BA                    ..
        beq     mj_done                         ; 97BD F0 1C                    ..
        lda     $BA                             ; 97BF A5 BA                    ..
        sta     AUDF4                           ; 97C1 8D 06 D2                 ...
        lsr     a                               ; 97C4 4A                       J
        lsr     a                               ; 97C5 4A                       J
        lsr     a                               ; 97C6 4A                       J
        lsr     a                               ; 97C7 4A                       J
        sta     PCOLR0                          ; 97C8 8D C0 02                 ...
        ldx     #$FF                            ; 97CB A2 FF                    ..
mj_delay:
        dex                                     ; 97CD CA                       .
        nop                                     ; 97CE EA                       .
        nop                                     ; 97CF EA                       .
        nop                                     ; 97D0 EA                       .
        nop                                     ; 97D1 EA                       .
        nop                                     ; 97D2 EA                       .
        nop                                     ; 97D3 EA                       .
        nop                                     ; 97D4 EA                       .
        nop                                     ; 97D5 EA                       .
        bne     mj_delay                        ; 97D6 D0 F5                    ..
        jmp     mj_set_freq_and_color           ; 97D8 4C BB 97                 L..

; ----------------------------------------------------------------------------
mj_done:lda     #$00                            ; 97DB A9 00                    ..
        sta     AUDF4                           ; 97DD 8D 06 D2                 ...
        sta     AUDC4                           ; 97E0 8D 07 D2                 ...
        sta     $0623                           ; 97E3 8D 23 06                 .#.
        lda     initial_speed                   ; 97E6 AD 25 06                 .%.
        sta     current_speed                   ; 97E9 8D 24 06                 .$.
        inc     playing_level                   ; 97EC EE 27 06                 .'.
        rts                                     ; 97EF 60                       `

; ----------------------------------------------------------------------------
zero_filler_97f0:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 97F0 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 97F8 00 00 00 00 00 00 00 00  ........
; ----------------------------------------------------------------------------
; called via vector in page 6
check_falling_1:
        lda     falling_flag                    ; 9800 AD 21 06                 .!.
        bne     L9806                           ; 9803 D0 01                    ..
L9805:  rts                                     ; 9805 60                       `

; ----------------------------------------------------------------------------
L9806:  lda     $0623                           ; 9806 AD 23 06                 .#.
        bne     L9805                           ; 9809 D0 FA                    ..
        lda     player_y_pos                    ; 980B AD 83 06                 ...
        cmp     #$C6                            ; 980E C9 C6                    ..
        bcs     L982E                           ; 9810 B0 1C                    ..
        lda     jump_frame                      ; 9812 AD EB 06                 ...
        beq     check_collisions_2              ; 9815 F0 03                    ..
        jmp     mid_jump                        ; 9817 4C A8 99                 L..

; ----------------------------------------------------------------------------
; did player 0 or 1 hit the playfield...
check_collisions_2:
        lda     #$01                            ; 981A A9 01                    ..
        sta     $0688                           ; 981C 8D 88 06                 ...
        lda     $06ED                           ; 981F AD ED 06                 ...
        beq     check_collisions_3              ; 9822 F0 0E                    ..
        lda     sav_p0pf                        ; 9824 AD B4 06                 ...
        ora     sav_p1pf                        ; 9827 0D B5 06                 ...
        and     #$03                            ; 982A 29 03                    ).
        bne     check_collisions_3              ; 982C D0 04                    ..
L982E:  inc     $0623                           ; 982E EE 23 06                 .#.
        rts                                     ; 9831 60                       `

; ----------------------------------------------------------------------------
; movement/jumping only allowed if player's touching the playfield
check_collisions_3:
        lda     #$00                            ; 9832 A9 00                    ..
        sta     $06ED                           ; 9834 8D ED 06                 ...
        lda     sav_p0pf                        ; 9837 AD B4 06                 ...
        ora     sav_p1pf                        ; 983A 0D B5 06                 ...
        and     #$03                            ; 983D 29 03                    ).
        bne     check_trigger_state             ; 983F D0 0C                    ..
        inc     $06ED                           ; 9841 EE ED 06                 ...
        inc     player_y_pos                    ; 9844 EE 83 06                 ...
        inc     player_y_pos                    ; 9847 EE 83 06                 ...
        jmp     L989F                           ; 984A 4C 9F 98                 L..

; ----------------------------------------------------------------------------
; did user press the trigger?
check_trigger_state:
        lda     trigger_state                   ; 984D AD 35 06                 .5.
        bne     check_up_down                   ; 9850 D0 03                    ..
; yes, jump to handler
trig_jmp:
        jmp     trigger_handler                 ; 9852 4C 85 99                 L..

; ----------------------------------------------------------------------------
; did user move joystick up/down?
check_up_down:
        lda     joystick_state                  ; 9855 AD 33 06                 .3.
        cmp     #$0E                            ; 9858 C9 0E                    ..
        beq     L9863                           ; 985A F0 07                    ..
        cmp     #$0D                            ; 985C C9 0D                    ..
        beq     L9863                           ; 985E F0 03                    ..
; no, jump over handler
cud_jmp:jmp     L9892                           ; 9860 4C 92 98                 L..

; ----------------------------------------------------------------------------
L9863:  lda     sav_p0pf                        ; 9863 AD B4 06                 ...
        ora     sav_p1pf                        ; 9866 0D B5 06                 ...
        and     #$02                            ; 9869 29 02                    ).
        bne     L9870                           ; 986B D0 03                    ..
        jmp     L98D0                           ; 986D 4C D0 98                 L..

; ----------------------------------------------------------------------------
L9870:  jsr     check_up_down_2                 ; 9870 20 3B 99                  ;.
        bcs     L9878                           ; 9873 B0 03                    ..
        jmp     L98D0                           ; 9875 4C D0 98                 L..

; ----------------------------------------------------------------------------
L9878:  sta     player_x_pos                    ; 9878 8D 7E 06                 .~.
        lda     player_delta_y                  ; 987B AD 31 06                 .1.
        asl     a                               ; 987E 0A                       .
        clc                                     ; 987F 18                       .
        adc     player_y_pos                    ; 9880 6D 83 06                 m..
        sta     player_y_pos                    ; 9883 8D 83 06                 ...
        lda     $0620                           ; 9886 AD 20 06                 . .
        clc                                     ; 9889 18                       .
        adc     #$04                            ; 988A 69 04                    i.
        sta     $0688                           ; 988C 8D 88 06                 ...
        jmp     play_sfx_climb                  ; 988F 4C 80 8A                 L..

; ----------------------------------------------------------------------------
L9892:  lda     sav_p0pf                        ; 9892 AD B4 06                 ...
        ora     sav_p1pf                        ; 9895 0D B5 06                 ...
        and     #$01                            ; 9898 29 01                    ).
        bne     L989F                           ; 989A D0 03                    ..
        jmp     L98D0                           ; 989C 4C D0 98                 L..

; ----------------------------------------------------------------------------
L989F:  lda     player_delta_x                  ; 989F AD 30 06                 .0.
        beq     L98D0                           ; 98A2 F0 2C                    .,
        asl     a                               ; 98A4 0A                       .
        ldx     #$08                            ; 98A5 A2 08                    ..
        cmp     #$02                            ; 98A7 C9 02                    ..
        beq     L98AD                           ; 98A9 F0 02                    ..
        ldx     #$0C                            ; 98AB A2 0C                    ..
L98AD:  clc                                     ; 98AD 18                       .
        adc     player_x_pos                    ; 98AE 6D 7E 06                 m~.
        sta     player_x_pos                    ; 98B1 8D 7E 06                 .~.
        txa                                     ; 98B4 8A                       .
        clc                                     ; 98B5 18                       .
        adc     $0620                           ; 98B6 6D 20 06                 m .
        sta     $0688                           ; 98B9 8D 88 06                 ...
        lda     $061F                           ; 98BC AD 1F 06                 ...
        bne     L98D0                           ; 98BF D0 0F                    ..
; horizontal movement
play_sfx_walk:
        lda     #$73                            ; 98C1 A9 73                    .s
        sta     sfx_slot_priority               ; 98C3 8D 3E 06                 .>.
        lda     #$BE                            ; 98C6 A9 BE                    ..
        sta     sfx_slot_timer                  ; 98C8 8D 3F 06                 .?.
        lda     #$01                            ; 98CB A9 01                    ..
        jsr     cue_sfx_lowprior_jv             ; 98CD 20 03 80                  ..
L98D0:  lda     sav_p0pf                        ; 98D0 AD B4 06                 ...
        ora     sav_p1pf                        ; 98D3 0D B5 06                 ...
        and     #$02                            ; 98D6 29 02                    ).
        beq     L98F0                           ; 98D8 F0 16                    ..
        jsr     L9971                           ; 98DA 20 71 99                  q.
        bcc     L990F                           ; 98DD 90 30                    .0
        inc     player_y_pos                    ; 98DF EE 83 06                 ...
        inc     player_y_pos                    ; 98E2 EE 83 06                 ...
        lda     $061F                           ; 98E5 AD 1F 06                 ...
        ora     #$02                            ; 98E8 09 02                    ..
        sta     $0688                           ; 98EA 8D 88 06                 ...
        jmp     L9925                           ; 98ED 4C 25 99                 L%.

; ----------------------------------------------------------------------------
L98F0:  lda     sav_p0pf                        ; 98F0 AD B4 06                 ...
        and     #$01                            ; 98F3 29 01                    ).
        beq     L990F                           ; 98F5 F0 18                    ..
        dec     player_y_pos                    ; 98F7 CE 83 06                 ...
        dec     player_y_pos                    ; 98FA CE 83 06                 ...
        lda     $0688                           ; 98FD AD 88 06                 ...
        cmp     #$01                            ; 9900 C9 01                    ..
        bne     L990F                           ; 9902 D0 0B                    ..
        lda     $061F                           ; 9904 AD 1F 06                 ...
        ora     #$02                            ; 9907 09 02                    ..
        sta     $0688                           ; 9909 8D 88 06                 ...
        jmp     L9925                           ; 990C 4C 25 99                 L%.

; ----------------------------------------------------------------------------
L990F:  lda     $0688                           ; 990F AD 88 06                 ...
        cmp     #$01                            ; 9912 C9 01                    ..
        bne     L9925                           ; 9914 D0 0F                    ..
        lda     sav_p0pf                        ; 9916 AD B4 06                 ...
        ora     sav_p1pf                        ; 9919 0D B5 06                 ...
        and     #$02                            ; 991C 29 02                    ).
        beq     L9925                           ; 991E F0 05                    ..
        lda     #$04                            ; 9920 A9 04                    ..
        sta     $0688                           ; 9922 8D 88 06                 ...
L9925:  lda     $0688                           ; 9925 AD 88 06                 ...
        sta     $0689                           ; 9928 8D 89 06                 ...
        lda     player_x_pos                    ; 992B AD 7E 06                 .~.
        sta     $067F                           ; 992E 8D 7F 06                 ...
        lda     player_y_pos                    ; 9931 AD 83 06                 ...
        clc                                     ; 9934 18                       .
        adc     #$0A                            ; 9935 69 0A                    i.
        sta     $0684                           ; 9937 8D 84 06                 ...
        rts                                     ; 993A 60                       `

; ----------------------------------------------------------------------------
; did user move joystick up/down?
check_up_down_2:
        lda     joystick_state                  ; 993B AD 33 06                 .3.
        cmp     #$0D                            ; 993E C9 0D                    ..
        bne     L9949                           ; 9940 D0 07                    ..
        lda     player_y_pos                    ; 9942 AD 83 06                 ...
        cmp     #$C0                            ; 9945 C9 C0                    ..
        bcs     L9967                           ; 9947 B0 1E                    ..
L9949:  lda     player_x_pos                    ; 9949 AD 7E 06                 .~.
        sec                                     ; 994C 38                       8
        sbc     #$30                            ; 994D E9 30                    .0
        sta     zp_temp1                        ; 994F 85 CB                    ..
        ldx     #$08                            ; 9951 A2 08                    ..
L9953:  lda     work_level_colpf2,x             ; 9953 BD B1 07                 ...
        clc                                     ; 9956 18                       .
        adc     #$02                            ; 9957 69 02                    i.
        cmp     zp_temp1                        ; 9959 C5 CB                    ..
        bcc     L9964                           ; 995B 90 07                    ..
        sec                                     ; 995D 38                       8
        sbc     #$05                            ; 995E E9 05                    ..
        cmp     zp_temp1                        ; 9960 C5 CB                    ..
        bcc     L9969                           ; 9962 90 05                    ..
L9964:  dex                                     ; 9964 CA                       .
        bne     L9953                           ; 9965 D0 EC                    ..
L9967:  clc                                     ; 9967 18                       .
        rts                                     ; 9968 60                       `

; ----------------------------------------------------------------------------
L9969:  lda     work_level_colpf2,x             ; 9969 BD B1 07                 ...
        clc                                     ; 996C 18                       .
        adc     #$30                            ; 996D 69 30                    i0
        sec                                     ; 996F 38                       8
        rts                                     ; 9970 60                       `

; ----------------------------------------------------------------------------
L9971:  lda     player_x_pos                    ; 9971 AD 7E 06                 .~.
        sec                                     ; 9974 38                       8
        sbc     #$30                            ; 9975 E9 30                    .0
        ldx     #$06                            ; 9977 A2 06                    ..
L9979:  cmp     work_level_offs_55+2,x          ; 9979 DD B9 07                 ...
        beq     L9983                           ; 997C F0 05                    ..
        dex                                     ; 997E CA                       .
        bne     L9979                           ; 997F D0 F8                    ..
        clc                                     ; 9981 18                       .
        rts                                     ; 9982 60                       `

; ----------------------------------------------------------------------------
L9983:  sec                                     ; 9983 38                       8
        rts                                     ; 9984 60                       `

; ----------------------------------------------------------------------------
; handle trigger presses, maybe start a jump, if player is moving up, left, or right
trigger_handler:
        ldx     #$04                            ; 9985 A2 04                    ..
        lda     joystick_state                  ; 9987 AD 33 06                 .3.
        cmp     #$0E                            ; 998A C9 0E                    ..
        beq     start_jump                      ; 998C F0 12                    ..
        ldx     #$10                            ; 998E A2 10                    ..
        lda     player_delta_x                  ; 9990 AD 30 06                 .0.
        cmp     #$01                            ; 9993 C9 01                    ..
        beq     start_jump                      ; 9995 F0 09                    ..
        ldx     #$11                            ; 9997 A2 11                    ..
        cmp     #$FF                            ; 9999 C9 FF                    ..
        beq     start_jump                      ; 999B F0 03                    ..
        jmp     check_up_down                   ; 999D 4C 55 98                 LU.

; ----------------------------------------------------------------------------
; start jumping, play sfx_jump
start_jump:
        stx     $0688                           ; 99A0 8E 88 06                 ...
        lda     #$01                            ; 99A3 A9 01                    ..
        jsr     cue_music_jv                    ; 99A5 20 18 80                  ..
; check & see if we're done jumping
mid_jump:
        inc     jump_frame                      ; 99A8 EE EB 06                 ...
        lda     jump_frame                      ; 99AB AD EB 06                 ...
; $15 aka 21 frames?
is_jump_done:
        cmp     #$16                            ; 99AE C9 16                    ..
        bne     continue_jump                   ; 99B0 D0 0B                    ..
; we hit a girder/rope/ladder in mid-jump, or else the jump finished without hitting anything(?). this does not (?) include the bottom of the level
end_jump:
        lda     #$00                            ; 99B2 A9 00                    ..
        sta     jump_frame                      ; 99B4 8D EB 06                 ...
        sta     $06ED                           ; 99B7 8D ED 06                 ...
        jmp     check_collisions_2              ; 99BA 4C 1A 98                 L..

; ----------------------------------------------------------------------------
; we're in mid-jump and didn't hit anything, keep going
continue_jump:
        ldx     jump_frame                      ; 99BD AE EB 06                 ...
        lda     jump_delta_x_table_minus_one,x  ; 99C0 BD 1B 9A                 ...
        tay                                     ; 99C3 A8                       .
        lda     $0688                           ; 99C4 AD 88 06                 ...
        cmp     #$10                            ; 99C7 C9 10                    ..
        beq     L99DD                           ; 99C9 F0 12                    ..
        cmp     #$11                            ; 99CB C9 11                    ..
        bne     L99DB                           ; 99CD D0 0C                    ..
        tya                                     ; 99CF 98                       .
        sta     zp_temp1+1                      ; 99D0 85 CC                    ..
        lda     #$00                            ; 99D2 A9 00                    ..
        sec                                     ; 99D4 38                       8
        sbc     zp_temp1+1                      ; 99D5 E5 CC                    ..
        tay                                     ; 99D7 A8                       .
        jmp     L99DD                           ; 99D8 4C DD 99                 L..

; ----------------------------------------------------------------------------
L99DB:  ldy     #$00                            ; 99DB A0 00                    ..
L99DD:  clc                                     ; 99DD 18                       .
        tya                                     ; 99DE 98                       .
        adc     player_x_pos                    ; 99DF 6D 7E 06                 m~.
        sta     player_x_pos                    ; 99E2 8D 7E 06                 .~.
        lda     jump_delta_y_table_minus_one,x  ; 99E5 BD 31 9A                 .1.
        clc                                     ; 99E8 18                       .
        adc     player_y_pos                    ; 99E9 6D 83 06                 m..
        sta     player_y_pos                    ; 99EC 8D 83 06                 ...
        txa                                     ; 99EF 8A                       .
        cmp     #$08                            ; 99F0 C9 08                    ..
        bcs     code_99f7                       ; 99F2 B0 03                    ..
        jmp     L9925                           ; 99F4 4C 25 99                 L%.

; ----------------------------------------------------------------------------
code_99f7:
        lda     sav_p0pf                        ; 99F7 AD B4 06                 ...
        ora     sav_p1pf                        ; 99FA 0D B5 06                 ...
        lsr     a                               ; 99FD 4A                       J
        bcs     end_jump                        ; 99FE B0 B2                    ..
        lsr     a                               ; 9A00 4A                       J
        bcc     L9A19                           ; 9A01 90 16                    ..
        lda     $0688                           ; 9A03 AD 88 06                 ...
        cmp     #$04                            ; 9A06 C9 04                    ..
        beq     L9A19                           ; 9A08 F0 0F                    ..
        jsr     L9971                           ; 9A0A 20 71 99                  q.
        bcs     end_jump                        ; 9A0D B0 A3                    ..
        jsr     check_up_down_2                 ; 9A0F 20 3B 99                  ;.
        bcc     L9A19                           ; 9A12 90 05                    ..
        cmp     player_x_pos                    ; 9A14 CD 7E 06                 .~.
        beq     end_jump                        ; 9A17 F0 99                    ..
L9A19:
jump_delta_x_table_minus_one:= * + 2            ; 1-indexed...
        jmp     L9925                           ; 9A19 4C 25 99                 L%.

; ----------------------------------------------------------------------------
; used by continue_jump, the amount of X movement per frame of jumping (for either direction, left or right)
jump_delta_x_table:
        .byte   $02,$00,$02,$00,$02,$02,$02,$02 ; 9A1C 02 00 02 00 02 02 02 02  ........
        .byte   $02,$02,$02,$00,$02,$00,$02,$00 ; 9A24 02 02 02 00 02 00 02 00  ........
        .byte   $00,$02,$00,$00,$00             ; 9A2C 00 02 00 00 00           .....
; 1-indexed...
jump_delta_y_table_minus_one:
        .byte   $02                             ; 9A31 02                       .
; used by continue_jump, amount of Y movement per frame ($FE is -2, or 2 scanlines up, $02 is 2 scanlines down)
jump_delta_y_table:
        .byte   $FE,$FE,$FE,$FE,$FE,$FE,$00,$00 ; 9A32 FE FE FE FE FE FE 00 00  ........
        .byte   $00,$02,$02,$02,$02,$02,$02,$02 ; 9A3A 00 02 02 02 02 02 02 02  ........
        .byte   $02,$02,$02,$02,$02,$00         ; 9A42 02 02 02 02 02 00        ......
zero_filler_9a48:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9A48 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9A50 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00                 ; 9A58 00 00 00 00              ....
; ----------------------------------------------------------------------------
; work_user and struct_user_{1..4}, 11 * 5 (55 aka $37) bytes
init_struct_users:
        ldy     #$00                            ; 9A5C A0 00                    ..
isu_next_su:
        ldx     #$00                            ; 9A5E A2 00                    ..
isu_next_byte:
        lda     struct_users_init_contents,x    ; 9A60 BD 71 9A                 .q.
        sta     score,y                         ; 9A63 99 00 07                 ...
        inx                                     ; 9A66 E8                       .
        iny                                     ; 9A67 C8                       .
        cpx     #$0B                            ; 9A68 E0 0B                    ..
        bne     isu_next_byte                   ; 9A6A D0 F4                    ..
        cpy     #$37                            ; 9A6C C0 37                    .7
        bne     isu_next_su                     ; 9A6E D0 EE                    ..
        rts                                     ; 9A70 60                       `

; ----------------------------------------------------------------------------
; work_user and struct_user_1 to _4 are initialized to this
struct_users_init_contents:
        .byte   $00,$00,$00,$4C,$1D,$00,$00,$00 ; 9A71 00 00 00 4C 1D 00 00 00  ...L....
        .byte   $00,$06,$03                     ; 9A79 00 06 03                 ...
; ----------------------------------------------------------------------------
; multiply current player number by 11, return result in Y
mul_player_11:
        ldx     current_user                    ; 9A7C AE FE 06                 ...
        lda     #$00                            ; 9A7F A9 00                    ..
        clc                                     ; 9A81 18                       .
add_11: dex                                     ; 9A82 CA                       .
        beq     return_y                        ; 9A83 F0 05                    ..
        adc     #$0B                            ; 9A85 69 0B                    i.
        jmp     add_11                          ; 9A87 4C 82 9A                 L..

; ----------------------------------------------------------------------------
return_y:
        tay                                     ; 9A8A A8                       .
        rts                                     ; 9A8B 60                       `

; ----------------------------------------------------------------------------
save_struct_user:
        ldx     #$00                            ; 9A8C A2 00                    ..
ssp_loop:
        lda     score,x                         ; 9A8E BD 00 07                 ...
        sta     struct_user_1,y                 ; 9A91 99 0B 07                 ...
        inx                                     ; 9A94 E8                       .
        iny                                     ; 9A95 C8                       .
        cpx     #$0B                            ; 9A96 E0 0B                    ..
        bne     ssp_loop                        ; 9A98 D0 F4                    ..
        rts                                     ; 9A9A 60                       `

; ----------------------------------------------------------------------------
load_struct_user:
        ldx     #$00                            ; 9A9B A2 00                    ..
lsp_loop:
        lda     struct_user_1,y                 ; 9A9D B9 0B 07                 ...
        sta     score,x                         ; 9AA0 9D 00 07                 ...
        inx                                     ; 9AA3 E8                       .
        iny                                     ; 9AA4 C8                       .
        cpx     #$0B                            ; 9AA5 E0 0B                    ..
        bne     lsp_loop                        ; 9AA7 D0 F4                    ..
        rts                                     ; 9AA9 60                       `

; ----------------------------------------------------------------------------
; used in multiplayer games, also called in single player (?)
next_player:
        jsr     mul_player_11                   ; 9AAA 20 7C 9A                  |.
        jsr     save_struct_user                ; 9AAD 20 8C 9A                  ..
        lda     #$00                            ; 9AB0 A9 00                    ..
        sta     $06F7                           ; 9AB2 8D F7 06                 ...
        sta     $06F8                           ; 9AB5 8D F8 06                 ...
; wraparound to 1 if > total users
next_user_num:
        inc     current_user                    ; 9AB8 EE FE 06                 ...
        lda     number_of_users                 ; 9ABB AD FF 06                 ...
        cmp     current_user                    ; 9ABE CD FE 06                 ...
        bcs     look_for_alive                  ; 9AC1 B0 08                    ..
        lda     #$01                            ; 9AC3 A9 01                    ..
        sta     current_user                    ; 9AC5 8D FE 06                 ...
        sta     $06F7                           ; 9AC8 8D F7 06                 ...
look_for_alive:
        ldx     users_still_alive               ; 9ACB AE F4 06                 ...
        inx                                     ; 9ACE E8                       .
        ldy     mul_11_table_minus_one,x        ; 9ACF BC FB 9A                 ...
is_user_dead:
        lda     $0715,y                         ; 9AD2 B9 15 07                 ...
        cmp     #$FF                            ; 9AD5 C9 FF                    ..
        bne     check_lives                     ; 9AD7 D0 0C                    ..
        tya                                     ; 9AD9 98                       .
        sec                                     ; 9ADA 38                       8
        sbc     #$0B                            ; 9ADB E9 0B                    ..
        tay                                     ; 9ADD A8                       .
        dex                                     ; 9ADE CA                       .
        bne     is_user_dead                    ; 9ADF D0 F1                    ..
        inc     $06F8                           ; 9AE1 EE F8 06                 ...
        rts                                     ; 9AE4 60                       `

; ----------------------------------------------------------------------------
; if user hasn't been eliminated, but is out of lives, eliminate him
check_lives:
        stx     number_of_users                 ; 9AE5 8E FF 06                 ...
        jsr     mul_player_11                   ; 9AE8 20 7C 9A                  |.
        jsr     load_struct_user                ; 9AEB 20 9B 9A                  ..
        lda     lives                           ; 9AEE AD 0A 07                 ...
        cmp     #$FF                            ; 9AF1 C9 FF                    ..
        beq     next_user_num                   ; 9AF3 F0 C3                    ..
; found the next user that isn't dead
user_alive:
        lda     $0709                           ; 9AF5 AD 09 07                 ...
        sta     initial_speed                   ; 9AF8 8D 25 06                 .%.
; 1-indexed
mul_11_table_minus_one:
        rts                                     ; 9AFB 60                       `

; ----------------------------------------------------------------------------
mul_11_table:
        .byte   $00,$0B,$16,$21                 ; 9AFC 00 0B 16 21              ...!
; ----------------------------------------------------------------------------
; for some reason there are 2 copies of the display list, at $0800 and $0881
setup_gameboard_dlist:
        ldx     #$00                            ; 9B00 A2 00                    ..
        lda     dlist_shadow_lo                 ; 9B02 AD AC 06                 ...
        bne     L9B09                           ; 9B05 D0 02                    ..
        ldx     #$81                            ; 9B07 A2 81                    ..
L9B09:  lda     #$70                            ; 9B09 A9 70                    .p
        stx     $9F                             ; 9B0B 86 9F                    ..
        ldy     #$03                            ; 9B0D A0 03                    ..
        sty     $9D                             ; 9B0F 84 9D                    ..
L9B11:  sta     $0800,x                         ; 9B11 9D 00 08                 ...
        inx                                     ; 9B14 E8                       .
        dey                                     ; 9B15 88                       .
        bne     L9B11                           ; 9B16 D0 F9                    ..
        ldy     $06AB                           ; 9B18 AC AB 06                 ...
L9B1B:  lda     gameboard_dlist_data,y          ; 9B1B B9 62 9B                 .b.
        sta     $0800,x                         ; 9B1E 9D 00 08                 ...
        iny                                     ; 9B21 C8                       .
        inx                                     ; 9B22 E8                       .
        dec     $9D                             ; 9B23 C6 9D                    ..
        bne     L9B1B                           ; 9B25 D0 F4                    ..
L9B27:  lda     gameboard_dlist_data,y          ; 9B27 B9 62 9B                 .b.
        beq     L9B3E                           ; 9B2A F0 12                    ..
        sta     $9D                             ; 9B2C 85 9D                    ..
        iny                                     ; 9B2E C8                       .
        lda     gameboard_dlist_data,y          ; 9B2F B9 62 9B                 .b.
L9B32:  sta     $0800,x                         ; 9B32 9D 00 08                 ...
        inx                                     ; 9B35 E8                       .
        dec     $9D                             ; 9B36 C6 9D                    ..
        bne     L9B32                           ; 9B38 D0 F8                    ..
        iny                                     ; 9B3A C8                       .
        jmp     L9B27                           ; 9B3B 4C 27 9B                 L'.

; ----------------------------------------------------------------------------
L9B3E:  lda     #$41                            ; 9B3E A9 41                    .A
        sta     $0800,x                         ; 9B40 9D 00 08                 ...
        inx                                     ; 9B43 E8                       .
        lda     $9F                             ; 9B44 A5 9F                    ..
        sta     $0800,x                         ; 9B46 9D 00 08                 ...
        sta     dlist_shadow_lo                 ; 9B49 8D AC 06                 ...
        inx                                     ; 9B4C E8                       .
        lda     #$08                            ; 9B4D A9 08                    ..
        sta     $0800,x                         ; 9B4F 9D 00 08                 ...
        sta     dlist_shadow_hi                 ; 9B52 8D AD 06                 ...
        lda     L9B63,y                         ; 9B55 B9 63 9B                 .c.
        sta     dli_vec_shadow_lo               ; 9B58 8D AE 06                 ...
        lda     L9B64,y                         ; 9B5B B9 64 9B                 .d.
        sta     dli_vec_shadow_hi               ; 9B5E 8D AF 06                 ...
        rts                                     ; 9B61 60                       `

; ----------------------------------------------------------------------------
; this isn't used as-is for a display list, see setup_gameboard_dlist
gameboard_dlist_data:
        .byte   $4D                             ; 9B62 4D                       M
L9B63:  .byte   $00                             ; 9B63 00                       .
L9B64:  .byte   $30,$56,$0D,$01,$8D,$01,$8D,$01 ; 9B64 30 56 0D 01 8D 01 8D 01  0V......
        .byte   $06,$01,$86,$00,$72,$9B         ; 9B6C 06 01 86 00 72 9B        ....r.
; ----------------------------------------------------------------------------
; changes DLI vector to point to dli_chained_2
dli_chained_1:
        pha                                     ; 9B72 48                       H
        lda     #$54                            ; 9B73 A9 54                    .T
        sta     WSYNC                           ; 9B75 8D 0A D4                 ...
        sta     COLBK                           ; 9B78 8D 1A D0                 ...
        lda     #$87                            ; 9B7B A9 87                    ..
        sta     VDSLST                          ; 9B7D 8D 00 02                 ...
        lda     #$9B                            ; 9B80 A9 9B                    ..
        sta     VDSLST+1                        ; 9B82 8D 01 02                 ...
        pla                                     ; 9B85 68                       h
        rti                                     ; 9B86 40                       @

; ----------------------------------------------------------------------------
; changes DLI vector to point to dli_chained_3
dli_chained_2:
        pha                                     ; 9B87 48                       H
        lda     #$00                            ; 9B88 A9 00                    ..
        sta     WSYNC                           ; 9B8A 8D 0A D4                 ...
        sta     COLBK                           ; 9B8D 8D 1A D0                 ...
        lda     $062A                           ; 9B90 AD 2A 06                 .*.
        sta     COLPF0                          ; 9B93 8D 16 D0                 ...
        lda     #$28                            ; 9B96 A9 28                    .(
        sta     COLPF1                          ; 9B98 8D 17 D0                 ...
        lda     #$AA                            ; 9B9B A9 AA                    ..
        sta     COLPF2                          ; 9B9D 8D 18 D0                 ...
        lda     #$0F                            ; 9BA0 A9 0F                    ..
        sta     COLPF3                          ; 9BA2 8D 19 D0                 ...
        lda     #$B1                            ; 9BA5 A9 B1                    ..
        sta     VDSLST                          ; 9BA7 8D 00 02                 ...
        lda     #$9B                            ; 9BAA A9 9B                    ..
        sta     VDSLST+1                        ; 9BAC 8D 01 02                 ...
        pla                                     ; 9BAF 68                       h
        rti                                     ; 9BB0 40                       @

; ----------------------------------------------------------------------------
; changes DLI vector to point to dli_chained_1
dli_chained_3:
        pha                                     ; 9BB1 48                       H
        lda     #$54                            ; 9BB2 A9 54                    .T
        sta     WSYNC                           ; 9BB4 8D 0A D4                 ...
        sta     COLBK                           ; 9BB7 8D 1A D0                 ...
        lda     #$72                            ; 9BBA A9 72                    .r
        sta     VDSLST                          ; 9BBC 8D 00 02                 ...
        lda     #$9B                            ; 9BBF A9 9B                    ..
        sta     VDSLST+1                        ; 9BC1 8D 01 02                 ...
        pla                                     ; 9BC4 68                       h
        rti                                     ; 9BC5 40                       @

; ----------------------------------------------------------------------------
; filler, or leftover after a binary patch?
random_9b:
        .byte   $9B                             ; 9BC6 9B                       .
; ----------------------------------------------------------------------------
        sta     VDSLST+1                        ; 9BC7 8D 01 02                 ...
        pla                                     ; 9BCA 68                       h
        rti                                     ; 9BCB 40                       @

; ----------------------------------------------------------------------------
zero_filler_9bcc:
        .byte   $00,$00,$00,$00                 ; 9BCC 00 00 00 00              ....
; ----------------------------------------------------------------------------
L9BD0:  lda     users_still_alive               ; 9BD0 AD F4 06                 ...
        cmp     #$00                            ; 9BD3 C9 00                    ..
        beq     L9BDA                           ; 9BD5 F0 03                    ..
        jmp     show_get_ready_prompt           ; 9BD7 4C 24 96                 L$.

; ----------------------------------------------------------------------------
L9BDA:  jmp     L9675                           ; 9BDA 4C 75 96                 Lu.

; ----------------------------------------------------------------------------
L9BDD:  lda     #$06                            ; 9BDD A9 06                    ..
        sta     $085E                           ; 9BDF 8D 5E 08                 .^.
        sta     $08DF                           ; 9BE2 8D DF 08                 ...
        jmp     (work_level_sub6)               ; 9BE5 6C A4 07                 l..

; ----------------------------------------------------------------------------
; ...
init_next_level:
        lda     randomizer_mode                 ; 9BE8 AD F3 06                 ...
        beq     L9BFC                           ; 9BEB F0 0F                    ..
; only after beating levels 1-12 in order
randomize_level:
        lda     RANDOM                          ; 9BED AD 0A D2                 ...
        and     #$0F                            ; 9BF0 29 0F                    ).
        cmp     #$0C                            ; 9BF2 C9 0C                    ..
        bcs     randomize_level                 ; 9BF4 B0 F7                    ..
        sta     level                           ; 9BF6 8D F6 06                 ...
        dec     level                           ; 9BF9 CE F6 06                 ...
L9BFC:  jmp     enter_level                     ; 9BFC 4C BA 96                 L..

; ----------------------------------------------------------------------------
zero_filler_9bff:
        .byte   $00                             ; 9BFF 00                       .
; ----------------------------------------------------------------------------
; only use of keyboard is to enter player speed(s) before starting game
keyboard_isr:
        txa                                     ; 9C00 8A                       .
        pha                                     ; 9C01 48                       H
        ldx     #$08                            ; 9C02 A2 08                    ..
        lda     KBCODE                          ; 9C04 AD 09 D2                 ...
check_keycode:
        cmp     keycode_table_minus_one,x       ; 9C07 DD 18 9C                 ...
        beq     store_speed_value               ; 9C0A F0 07                    ..
        dex                                     ; 9C0C CA                       .
        bne     check_keycode                   ; 9C0D D0 F8                    ..
keyboard_isr_exit:
        pla                                     ; 9C0F 68                       h
        tax                                     ; 9C10 AA                       .
        pla                                     ; 9C11 68                       h
        rti                                     ; 9C12 40                       @

; ----------------------------------------------------------------------------
store_speed_value:
        stx     speed_value                     ; 9C13 8E F9 06                 ...
keycode_table_minus_one:= * + 2
        jmp     keyboard_isr_exit               ; 9C16 4C 0F 9C                 L..

; ----------------------------------------------------------------------------
keycode_table:
        .byte   $1F,$1E,$1A,$18,$1D,$1B,$33,$35 ; 9C19 1F 1E 1A 18 1D 1B 33 35  ......35
; definitions for level graphics objects aka shapes. (girder segment, ladder, rope, etc)
level_gfx:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9C21 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9C29 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00                         ; 9C31 00 00                    ..
; 3 rows of pixels. 1st: 04 = 4 pixels wide, 00 00 = no X/Y offset, 01 01 01 01 = actual pixel data (4 color0 pixels). see level_maps.txt
sh_girder:
        .byte   $04,$00,$00,$01,$01,$01,$01,$04 ; 9C33 04 00 00 01 01 01 01 04  ........
        .byte   $00,$01,$01,$00,$01,$00,$04,$00 ; 9C3B 00 01 01 00 01 00 04 00  ........
        .byte   $02,$01,$01,$01,$01,$FF         ; 9C43 02 01 01 01 01 FF        ......
; all the bombs on blackout are drawn as this
sh_black_4x3:
        .byte   $04,$00,$00,$00,$00,$00,$00,$04 ; 9C49 04 00 00 00 00 00 00 04  ........
        .byte   $00,$01,$00,$00,$00,$00,$04,$00 ; 9C51 00 01 00 00 00 00 04 00  ........
        .byte   $02,$00,$00,$00,$00,$FF         ; 9C59 02 00 00 00 00 FF        ......
sh_ladder:
        .byte   $02,$00,$00,$02,$02,$02,$06,$00 ; 9C5F 02 00 00 02 02 02 06 00  ........
        .byte   $02,$02,$02,$00,$01,$02,$02,$02 ; 9C67 02 02 02 00 01 02 02 02  ........
        .byte   $06,$01,$02,$02,$08,$00,$02,$02 ; 9C6F 06 01 02 02 08 00 02 02  ........
        .byte   $02,$02,$02,$02,$02,$02,$02,$02 ; 9C77 02 02 02 02 02 02 02 02  ........
        .byte   $00,$03,$02,$02,$02,$06,$03,$02 ; 9C7F 00 03 02 02 02 06 03 02  ........
        .byte   $02,$FF                         ; 9C87 02 FF                    ..
; ladder in black pixels, used for erasing ladders
sh_black_ladder:
        .byte   $02,$00,$00,$00,$00,$02,$06,$00 ; 9C89 02 00 00 00 00 02 06 00  ........
        .byte   $00,$00,$02,$00,$01,$00,$00,$02 ; 9C91 00 00 02 00 01 00 00 02  ........
        .byte   $06,$01,$00,$00,$08,$00,$02,$00 ; 9C99 06 01 00 00 08 00 02 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$02 ; 9CA1 00 00 00 00 00 00 00 02  ........
        .byte   $00,$03,$00,$00,$02,$06,$03,$00 ; 9CA9 00 03 00 00 02 06 03 00  ........
        .byte   $00,$FF                         ; 9CB1 00 FF                    ..
sh_bomb:.byte   $04,$00,$00,$00,$03,$03,$00,$04 ; 9CB3 04 00 00 00 03 03 00 04  ........
        .byte   $00,$01,$03,$00,$00,$03,$04,$00 ; 9CBB 00 01 03 00 00 03 04 00  ........
        .byte   $02,$00,$03,$03,$00,$FF         ; 9CC3 02 00 03 03 00 FF        ......
sh_up_rope:
        .byte   $01,$00,$00,$01,$01,$01,$01,$01 ; 9CC9 01 00 00 01 01 01 01 01  ........
        .byte   $01,$00,$02,$01,$01,$01,$03,$01 ; 9CD1 01 00 02 01 01 01 03 01  ........
        .byte   $FF                             ; 9CD9 FF                       .
sh_down_rope:
        .byte   $01,$00,$00,$02,$01,$00,$01,$02 ; 9CDA 01 00 00 02 01 00 01 02  ........
        .byte   $01,$01,$02,$02,$01,$01,$03,$02 ; 9CE2 01 01 02 02 01 01 03 02  ........
        .byte   $FF                             ; 9CEA FF                       .
; not sure where this is used, probably for erasing ropes
sh_black_2x4:
        .byte   $02,$00,$00,$00,$00,$02,$00,$01 ; 9CEB 02 00 00 00 00 02 00 01  ........
        .byte   $00,$00,$02,$00,$02,$00,$00,$02 ; 9CF3 00 00 02 00 02 00 00 02  ........
        .byte   $00,$03,$00,$00,$FF             ; 9CFB 00 03 00 00 FF           .....
; jumpman's animation frames and other sprites, seem to be 10 bytes per sprite
sprite_table:
        .byte   $18,$18,$3C,$5A,$3C,$18,$18,$18 ; 9D00 18 18 3C 5A 3C 18 18 18  ..<Z<...
        .byte   $18,$3C,$1C,$1A,$3C,$58,$38,$18 ; 9D08 18 3C 1C 1A 3C 58 38 18  .<..<X8.
        .byte   $3C,$24,$14,$14,$38,$58,$3C,$1A ; 9D10 3C 24 14 14 38 58 3C 1A  <$..8X<.
        .byte   $1C,$18,$3C,$24,$28,$28,$99,$5A ; 9D18 1C 18 3C 24 28 28 99 5A  ..<$((.Z
        .byte   $3C,$18,$18,$18,$3C,$24,$42,$C3 ; 9D20 3C 18 18 18 3C 24 42 C3  <...<$B.
        .byte   $19,$12,$3C,$58,$98,$18,$7C,$C4 ; 9D28 19 12 3C 58 98 18 7C C4  ..<X..|.
        .byte   $04,$06,$00,$18,$3C,$5A,$99,$18 ; 9D30 04 06 00 18 3C 5A 99 18  ....<Z..
        .byte   $3C,$24,$42,$C3,$98,$48,$3C,$1A ; 9D38 3C 24 42 C3 98 48 3C 1A  <$B..H<.
        .byte   $19,$18,$3E,$23,$20,$60,$18,$10 ; 9D40 19 18 3E 23 20 60 18 10  ..># `..
        .byte   $3D,$5A,$98,$18,$3C,$24,$22,$33 ; 9D48 3D 5A 98 18 3C 24 22 33  =Z..<$"3
        .byte   $18,$10,$38,$5C,$38,$18,$3C,$24 ; 9D50 18 10 38 5C 38 18 3C 24  ..8\8.<$
        .byte   $44,$66,$18,$10,$3D,$5A,$98,$18 ; 9D58 44 66 18 10 3D 5A 98 18  Df..=Z..
        .byte   $3C,$24,$22,$33,$18,$10,$38,$5C ; 9D60 3C 24 22 33 18 10 38 5C  <$"3..8\
        .byte   $38,$18,$3C,$24,$44,$66,$18,$08 ; 9D68 38 18 3C 24 44 66 18 08  8.<$Df..
        .byte   $BC,$5A,$19,$18,$3C,$24,$44,$CC ; 9D70 BC 5A 19 18 3C 24 44 CC  .Z..<$D.
        .byte   $18,$08,$1C,$3A,$1C,$18,$3C,$24 ; 9D78 18 08 1C 3A 1C 18 3C 24  ...:..<$
        .byte   $22,$66,$18,$08,$BC,$5A,$19,$18 ; 9D80 22 66 18 08 BC 5A 19 18  "f...Z..
        .byte   $3C,$24,$44,$CC,$18,$08,$1C,$3A ; 9D88 3C 24 44 CC 18 08 1C 3A  <$D....:
        .byte   $1C,$18,$3C,$24,$22,$66,$0C,$19 ; 9D90 1C 18 3C 24 22 66 0C 19  ..<$"f..
        .byte   $3E,$58,$58,$18,$3E,$42,$83,$00 ; 9D98 3E 58 58 18 3E 42 83 00  >XX.>B..
        .byte   $30,$98,$7C,$1A,$1A,$18,$7C,$42 ; 9DA0 30 98 7C 1A 1A 18 7C 42  0.|...|B
        .byte   $C1,$00,$99,$5A,$3C,$18,$18,$99 ; 9DA8 C1 00 99 5A 3C 18 18 99  ...Z<...
        .byte   $FF,$00,$00,$00,$86,$42,$22,$FE ; 9DB0 FF 00 00 00 86 42 22 FE  .....B".
        .byte   $FE,$22,$42,$86,$00,$00,$FF,$99 ; 9DB8 FE 22 42 86 00 00 FF 99  ."B.....
        .byte   $18,$18,$3C,$5A,$99,$00,$00,$00 ; 9DC0 18 18 3C 5A 99 00 00 00  ..<Z....
        .byte   $61,$42,$44,$7F,$7F,$44,$42,$61 ; 9DC8 61 42 44 7F 7F 44 42 61  aBD..DBa
        .byte   $00,$00,$08,$22,$80,$01,$58,$18 ; 9DD0 00 00 08 22 80 01 58 18  ..."..X.
        .byte   $3C,$5A,$99,$FF,$10,$44,$01,$80 ; 9DD8 3C 5A 99 FF 10 44 01 80  <Z...D..
        .byte   $1A,$18,$3C,$5A,$99,$FF,$00,$00 ; 9DE0 1A 18 3C 5A 99 FF 00 00  ..<Z....
        .byte   $3C,$3C,$3C,$E7,$06,$C3,$60,$E3 ; 9DE8 3C 3C 3C E7 06 C3 60 E3  <<<...`.
        .byte   $76,$E3,$76,$CE,$67,$CE,$67,$83 ; 9DF0 76 E3 76 CE 67 CE 67 83  v.v.g.g.
        .byte   $C1,$00,$00,$00,$00,$00,$00,$00 ; 9DF8 C1 00 00 00 00 00 00 00  ........
; GR.1/2 font, 512 bytes
charset:.byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9E00 00 00 00 00 00 00 00 00  ........
        .byte   $00,$0C,$19,$3E,$58,$1E,$22     ; 9E08 00 0C 19 3E 58 1E 22     ...>X."
; couple of places in the code try to write here
block_char_minus_one:
        .byte   $43,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; 9E0F 43 FF FF FF FF FF FF FF  C.......
        .byte   $FF,$00,$66,$FF,$66,$66,$FF,$66 ; 9E17 FF 00 66 FF 66 66 FF 66  ..f.ff.f
        .byte   $00,$18,$3E,$60,$3C,$06,$7C,$18 ; 9E1F 00 18 3E 60 3C 06 7C 18  ..>`<.|.
        .byte   $00,$00,$7C,$82,$BA,$A2,$BA,$82 ; 9E27 00 00 7C 82 BA A2 BA 82  ..|.....
        .byte   $7C,$1C,$36,$1C,$38,$6F,$66,$3B ; 9E2F 7C 1C 36 1C 38 6F 66 3B  |.6.8of;
        .byte   $00,$00,$30,$98,$7C,$1A,$78,$44 ; 9E37 00 00 30 98 7C 1A 78 44  ..0.|.xD
        .byte   $C2,$00,$0E,$1C,$18,$18,$18,$1C ; 9E3F C2 00 0E 1C 18 18 18 1C  ........
        .byte   $0E,$00,$70,$38,$18,$18,$18,$38 ; 9E47 0E 00 70 38 18 18 18 38  ..p8...8
        .byte   $70,$00,$00,$00,$00,$00,$00,$00 ; 9E4F 70 00 00 00 00 00 00 00  p.......
        .byte   $7E,$00,$18,$18,$18,$7E,$18,$18 ; 9E57 7E 00 18 18 18 7E 18 18  ~....~..
        .byte   $18,$00,$00,$00,$00,$00,$18,$18 ; 9E5F 18 00 00 00 00 00 18 18  ........
        .byte   $30,$00,$00,$00,$00,$7E,$00,$00 ; 9E67 30 00 00 00 00 7E 00 00  0....~..
        .byte   $00,$00,$00,$00,$00,$00,$00,$18 ; 9E6F 00 00 00 00 00 00 00 18  ........
        .byte   $18,$00,$06,$0C,$18,$30,$60,$40 ; 9E77 18 00 06 0C 18 30 60 40  .....0`@
        .byte   $00,$00,$3C,$66,$66,$66,$66,$66 ; 9E7F 00 00 3C 66 66 66 66 66  ..<fffff
        .byte   $3C,$00,$18,$38,$18,$18,$18,$18 ; 9E87 3C 00 18 38 18 18 18 18  <..8....
        .byte   $7E,$00,$3C,$66,$06,$0C,$18,$30 ; 9E8F 7E 00 3C 66 06 0C 18 30  ~.<f...0
        .byte   $7E,$00,$3C,$66,$06,$1C,$06,$66 ; 9E97 7E 00 3C 66 06 1C 06 66  ~.<f...f
        .byte   $3C,$00,$0C,$1C,$3C,$6C,$7E,$0C ; 9E9F 3C 00 0C 1C 3C 6C 7E 0C  <...<l~.
        .byte   $0C,$00,$7E,$60,$60,$7C,$06,$06 ; 9EA7 0C 00 7E 60 60 7C 06 06  ..~``|..
        .byte   $7C,$00,$3C,$66,$60,$7C,$66,$66 ; 9EAF 7C 00 3C 66 60 7C 66 66  |.<f`|ff
        .byte   $3C,$00,$7E,$06,$0C,$18,$30,$30 ; 9EB7 3C 00 7E 06 0C 18 30 30  <.~...00
        .byte   $30,$00,$3C,$66,$66,$3C,$66,$66 ; 9EBF 30 00 3C 66 66 3C 66 66  0.<ff<ff
        .byte   $3C,$00,$3C,$66,$66,$3E,$06,$66 ; 9EC7 3C 00 3C 66 66 3E 06 66  <.<ff>.f
        .byte   $3C,$00,$00,$18,$18,$00,$18,$18 ; 9ECF 3C 00 00 18 18 00 18 18  <.......
        .byte   $00,$00,$00,$18,$18,$00,$18,$18 ; 9ED7 00 00 00 18 18 00 18 18  ........
        .byte   $30,$06,$0C,$18,$30,$18,$0C,$06 ; 9EDF 30 06 0C 18 30 18 0C 06  0...0...
        .byte   $00,$00,$00,$00,$7E,$00,$7E,$00 ; 9EE7 00 00 00 00 7E 00 7E 00  ....~.~.
        .byte   $00,$00,$10,$7C,$10,$10,$10,$38 ; 9EEF 00 00 10 7C 10 10 10 38  ...|...8
        .byte   $7C,$00,$3C,$66,$66,$0C,$18,$00 ; 9EF7 7C 00 3C 66 66 0C 18 00  |.<ff...
        .byte   $18,$00,$3C,$66,$6E,$6E,$60,$3E ; 9EFF 18 00 3C 66 6E 6E 60 3E  ..<fnn`>
        .byte   $00,$00,$18,$3C,$66,$66,$7E,$66 ; 9F07 00 00 18 3C 66 66 7E 66  ...<ff~f
        .byte   $66,$00,$7C,$66,$66,$7C,$66,$66 ; 9F0F 66 00 7C 66 66 7C 66 66  f.|ff|ff
        .byte   $7C,$00,$3C,$66,$60,$60,$60,$66 ; 9F17 7C 00 3C 66 60 60 60 66  |.<f```f
        .byte   $3C,$00,$7C,$66,$66,$66,$66,$66 ; 9F1F 3C 00 7C 66 66 66 66 66  <.|fffff
        .byte   $7C,$00,$7E,$60,$60,$78,$60,$60 ; 9F27 7C 00 7E 60 60 78 60 60  |.~``x``
        .byte   $7E,$00,$7E,$60,$60,$78,$60,$60 ; 9F2F 7E 00 7E 60 60 78 60 60  ~.~``x``
        .byte   $60,$00,$3C,$66,$60,$60,$6E,$66 ; 9F37 60 00 3C 66 60 60 6E 66  `.<f``nf
        .byte   $3C,$00,$66,$66,$66,$7E,$66,$66 ; 9F3F 3C 00 66 66 66 7E 66 66  <.fff~ff
        .byte   $66,$00,$3C,$18,$18,$18,$18,$18 ; 9F47 66 00 3C 18 18 18 18 18  f.<.....
        .byte   $3C,$00,$06,$06,$06,$06,$66,$66 ; 9F4F 3C 00 06 06 06 06 66 66  <.....ff
        .byte   $3C,$00,$66,$6C,$78,$70,$78,$6C ; 9F57 3C 00 66 6C 78 70 78 6C  <.flxpxl
        .byte   $66,$00,$60,$60,$60,$60,$60,$60 ; 9F5F 66 00 60 60 60 60 60 60  f.``````
        .byte   $7E,$00,$63,$77,$7F,$6B,$63,$63 ; 9F67 7E 00 63 77 7F 6B 63 63  ~.cw.kcc
        .byte   $63,$00,$66,$66,$76,$7E,$6E,$66 ; 9F6F 63 00 66 66 76 7E 6E 66  c.ffv~nf
        .byte   $66,$00,$3C,$66,$66,$66,$66,$66 ; 9F77 66 00 3C 66 66 66 66 66  f.<fffff
        .byte   $3C,$00,$7C,$66,$66,$7C,$60,$60 ; 9F7F 3C 00 7C 66 66 7C 60 60  <.|ff|``
        .byte   $60,$00,$3C,$66,$66,$66,$66,$6C ; 9F87 60 00 3C 66 66 66 66 6C  `.<ffffl
        .byte   $36,$00,$7C,$66,$66,$7C,$6C,$66 ; 9F8F 36 00 7C 66 66 7C 6C 66  6.|ff|lf
        .byte   $66,$00,$3C,$66,$60,$3C,$06,$66 ; 9F97 66 00 3C 66 60 3C 06 66  f.<f`<.f
        .byte   $3C,$00,$7E,$18,$18,$18,$18,$18 ; 9F9F 3C 00 7E 18 18 18 18 18  <.~.....
        .byte   $18,$00,$66,$66,$66,$66,$66,$66 ; 9FA7 18 00 66 66 66 66 66 66  ..ffffff
        .byte   $3C,$00,$66,$66,$66,$66,$66,$3C ; 9FAF 3C 00 66 66 66 66 66 3C  <.fffff<
        .byte   $18,$00,$63,$63,$63,$6B,$7F,$77 ; 9FB7 18 00 63 63 63 6B 7F 77  ..ccck.w
        .byte   $63,$00,$66,$66,$3C,$3C,$3C,$66 ; 9FBF 63 00 66 66 3C 3C 3C 66  c.ff<<<f
        .byte   $66,$00,$66,$66,$66,$3C,$18,$18 ; 9FC7 66 00 66 66 66 3C 18 18  f.fff<..
        .byte   $18,$00,$7E,$06,$0C,$18,$30,$60 ; 9FCF 18 00 7E 06 0C 18 30 60  ..~...0`
        .byte   $7E,$00,$00,$00,$00,$00,$00,$00 ; 9FD7 7E 00 00 00 00 00 00 00  ~.......
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9FDF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9FE7 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; 9FEF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00                     ; 9FF7 00 00 00                 ...
; ----------------------------------------------------------------------------
; main entry point, note cartstart_left and cartstart_right point to the same address
cartstart_right:
        .addr   cart_entry_point                ; 9FFA C0 8A                    ..
; ----------------------------------------------------------------------------
; 0 here means 'cartridge present'
cartpresent_right:
        .byte   $00                             ; 9FFC 00                       .
; 4 here means init & start the cart, no disk boot, non-diagnostic
cartoptions_right:
        .byte   $04                             ; 9FFD 04                       .
; ----------------------------------------------------------------------------
; points to a CLC/RTS do-nothing routine (same as cartinit_left)
cartinit_right:
        .addr   cart_start_stub                 ; 9FFE FE 8A                    ..
; ----------------------------------------------------------------------------
; 64-byte level descriptors, 12 of them (1 per level). Descriptor for Nothing To It. first 2 bytes are level number in screencodes
level01_desc:
        .byte   $10,$11                         ; A000 10 11                    ..
; ----------------------------------------------------------------------------
; a subroutine
level01_sub0:
        .addr   L0000                           ; A002 00 00                    ..
; a subroutine
level01_sub1:
        .addr   L0000                           ; A004 00 00                    ..
; a subroutine
level01_sub2:
        .addr   L0000                           ; A006 00 00                    ..
; a subroutine
level01_sub3:
        .addr   check_pl_coll                   ; A008 73 8F                    s.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level01_num_bombs:
        .byte   $0C                             ; A00A 0C                       .
; 0 = no bullets, range 0-4.
level01_bullet_max:
        .byte   $01                             ; A00B 01                       .
; jumpman starting Y position
level01_y_start:
        .byte   $A0                             ; A00C A0                       .
; jumpman starting X position
level01_x_start:
        .byte   $7C                             ; A00D 7C                       |
; fudge factor for bomb locations, always $00
level01_fudge_x:
        .byte   $00                             ; A00E 00                       .
; fudge factor for bomb locations, always $06
level01_fudge_y:
        .byte   $06                             ; A00F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level01_points_per_bomb:
        .byte   $64                             ; A010 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level01_time_bonus:
        .word   $03E8                           ; A011 E8 03                    ..
; ----------------------------------------------------------------------------
; always $00
level01_offs_19:
        .byte   $00                             ; A013 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level01_unkn_table0:
        .addr   L06DF                           ; A014 DF 06                    ..
; used to draw the level initially (see also map_changes)
level01_map:
        .addr   l01_map                         ; A016 00 A3                    ..
; start of bombs in map data (which must come last!)
level01_map_bombs:
        .addr   l01_map_bombs                   ; A018 66 A3                    f.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level01_bomblist:
        .addr   l01_bombs                       ; A01A 8B A3                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level01_map_changes:
        .addr   l01_map_changes                 ; A01C A4 A3                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level01_indirect_subs:
        .byte   $00,$00                         ; A01E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level01_sub_bomb:
        .addr   L06E6                           ; A020 E6 06                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level01_init:
        .addr   L06E6                           ; A022 E6 06                    ..
; always $9740 aka game_main_loop
level01_sub6:
        .addr   game_main_loop                  ; A024 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level01_sub_eol:
        .addr   L06E6                           ; A026 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level01_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A028 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level01_colpf3:
        .byte   $CA                             ; A02E CA                       .
; color for girders and up-ropes
level01_colpf0:
        .byte   $96                             ; A02F 96                       .
; color for ladders and down-ropes
level01_colpf1:
        .byte   $18                             ; A030 18                       .
; color for bombs
level01_colpf2:
        .byte   $5A                             ; A031 5A                       Z
; unknown
level01_offs_50:
        .byte   $0C,$24,$4C,$74,$8C             ; A032 0C 24 4C 74 8C           .$Lt.
; unknown, always $00 $00 $00
level01_offs_55:
        .byte   $00,$00,$00                     ; A037 00 00 00                 ...
; unknown, not a ROM address
level01_offs_58:
        .byte   $1A,$7E                         ; A03A 1A 7E                    .~
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level01_offs_60:
        .byte   $00,$00,$00,$00                 ; A03C 00 00 00 00              ....
; Descriptor for Electrocution. first 2 bytes are level number in screencodes
level02_desc:
        .byte   $10,$12                         ; A040 10 12                    ..
; ----------------------------------------------------------------------------
; a subroutine
level02_sub0:
        .addr   electrocution_done              ; A042 DD A4                    ..
; a subroutine
level02_sub1:
        .addr   electrocute                     ; A044 09 A5                    ..
; a subroutine
level02_sub2:
        .addr   L0000                           ; A046 00 00                    ..
; a subroutine
level02_sub3:
        .addr   level03_collisions              ; A048 3D A5                    =.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level02_num_bombs:
        .byte   $10                             ; A04A 10                       .
; 0 = no bullets, range 0-4.
level02_bullet_max:
        .byte   $02                             ; A04B 02                       .
; jumpman starting Y position
level02_y_start:
        .byte   $20                             ; A04C 20                        
; jumpman starting X position
level02_x_start:
        .byte   $7C                             ; A04D 7C                       |
; fudge factor for bomb locations, always $00
level02_fudge_x:
        .byte   $00                             ; A04E 00                       .
; fudge factor for bomb locations, always $06
level02_fudge_y:
        .byte   $06                             ; A04F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level02_points_per_bomb:
        .byte   $64                             ; A050 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level02_time_bonus:
        .word   $07D0                           ; A051 D0 07                    ..
; ----------------------------------------------------------------------------
; always $00
level02_offs_19:
        .byte   $00                             ; A053 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level02_unkn_table0:
        .addr   LA5C2                           ; A054 C2 A5                    ..
; used to draw the level initially (see also map_changes)
level02_map:
        .addr   l02_map                         ; A056 E0 A3                    ..
; start of bombs in map data (which must come last!)
level02_map_bombs:
        .addr   l02_map_bombs                   ; A058 46 A4                    F.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level02_bomblist:
        .addr   l02_bombs                       ; A05A 77 A4                    w.
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level02_map_changes:
        .addr   L0000                           ; A05C 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level02_indirect_subs:
        .byte   $00,$00                         ; A05E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level02_sub_bomb:
        .addr   electrocution_bomb_pickup       ; A060 98 A4                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level02_init:
        .addr   special_init_jv                 ; A062 36 80                    6.
; always $9740 aka game_main_loop
level02_sub6:
        .addr   game_main_loop                  ; A064 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level02_sub_eol:
        .addr   L06E6                           ; A066 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level02_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A068 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level02_colpf3:
        .byte   $6A                             ; A06E 6A                       j
; color for girders and up-ropes
level02_colpf0:
        .byte   $08                             ; A06F 08                       .
; color for ladders and down-ropes
level02_colpf1:
        .byte   $C6                             ; A070 C6                       .
; color for bombs
level02_colpf2:
        .byte   $1A                             ; A071 1A                       .
; unknown
level02_offs_50:
        .byte   $18,$4C,$80,$00,$00             ; A072 18 4C 80 00 00           .L...
; unknown, always $00 $00 $00
level02_offs_55:
        .byte   $00,$00,$00                     ; A077 00 00 00                 ...
; unknown, not a ROM address
level02_offs_58:
        .byte   $02,$94                         ; A07A 02 94                    ..
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level02_offs_60:
        .byte   $00,$00,$00,$00                 ; A07C 00 00 00 00              ....
; Descriptor for Dumbwaiter. first 2 bytes are level number in screencodes
level03_desc:
        .byte   $10,$13                         ; A080 10 13                    ..
; ----------------------------------------------------------------------------
; a subroutine
level03_sub0:
        .addr   dumbwaiter_sub0                 ; A082 BD A6                    ..
; a subroutine
level03_sub1:
        .addr   L0000                           ; A084 00 00                    ..
; a subroutine
level03_sub2:
        .addr   L0000                           ; A086 00 00                    ..
; a subroutine
level03_sub3:
        .addr   dumbwaiter_sub3                 ; A088 24 A7                    $.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level03_num_bombs:
        .byte   $0C                             ; A08A 0C                       .
; 0 = no bullets, range 0-4.
level03_bullet_max:
        .byte   $00                             ; A08B 00                       .
; jumpman starting Y position
level03_y_start:
        .byte   $40                             ; A08C 40                       @
; jumpman starting X position
level03_x_start:
        .byte   $B4                             ; A08D B4                       .
; fudge factor for bomb locations, always $00
level03_fudge_x:
        .byte   $00                             ; A08E 00                       .
; fudge factor for bomb locations, always $06
level03_fudge_y:
        .byte   $06                             ; A08F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level03_points_per_bomb:
        .byte   $64                             ; A090 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level03_time_bonus:
        .word   $09C4                           ; A091 C4 09                    ..
; ----------------------------------------------------------------------------
; always $00
level03_offs_19:
        .byte   $00                             ; A093 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level03_unkn_table0:
        .addr   l03_unkn                        ; A094 6D A6                    m.
; used to draw the level initially (see also map_changes)
level03_map:
        .addr   l03_map                         ; A096 F0 A5                    ..
; start of bombs in map data (which must come last!)
level03_map_bombs:
        .addr   l03_map_bombs                   ; A098 2F A6                    /.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level03_bomblist:
        .addr   l03_bombs                       ; A09A 54 A6                    T.
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level03_map_changes:
        .addr   L0000                           ; A09C 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level03_indirect_subs:
        .byte   $00,$00                         ; A09E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level03_sub_bomb:
        .addr   L06E6                           ; A0A0 E6 06                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level03_init:
        .addr   dumbwaiter_setup                ; A0A2 8C A6                    ..
; always $9740 aka game_main_loop
level03_sub6:
        .addr   game_main_loop                  ; A0A4 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level03_sub_eol:
        .addr   L06E6                           ; A0A6 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level03_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A0A8 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level03_colpf3:
        .byte   $1A                             ; A0AE 1A                       .
; color for girders and up-ropes
level03_colpf0:
        .byte   $C6                             ; A0AF C6                       .
; color for ladders and down-ropes
level03_colpf1:
        .byte   $96                             ; A0B0 96                       .
; color for bombs
level03_colpf2:
        .byte   $1A                             ; A0B1 1A                       .
; unknown
level03_offs_50:
        .byte   $0C,$8C,$00,$00,$00             ; A0B2 0C 8C 00 00 00           .....
; unknown, always $00 $00 $00
level03_offs_55:
        .byte   $00,$00,$00                     ; A0B7 00 00 00                 ...
; unknown, not a ROM address
level03_offs_58:
        .byte   $00,$00                         ; A0BA 00 00                    ..
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level03_offs_60:
        .byte   $00,$00,$00,$00                 ; A0BC 00 00 00 00              ....
; Descriptor for Hellstones. first 2 bytes are level number in screencodes
level04_desc:
        .byte   $10,$14                         ; A0C0 10 14                    ..
; ----------------------------------------------------------------------------
; a subroutine
level04_sub0:
        .addr   hellstones_sub0                 ; A0C2 36 A8                    6.
; a subroutine
level04_sub1:
        .addr   L0000                           ; A0C4 00 00                    ..
; a subroutine
level04_sub2:
        .addr   L0000                           ; A0C6 00 00                    ..
; a subroutine
level04_sub3:
        .addr   hellstones_sub3                 ; A0C8 27 A8                    '.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level04_num_bombs:
        .byte   $10                             ; A0CA 10                       .
; 0 = no bullets, range 0-4.
level04_bullet_max:
        .byte   $00                             ; A0CB 00                       .
; jumpman starting Y position
level04_y_start:
        .byte   $C0                             ; A0CC C0                       .
; jumpman starting X position
level04_x_start:
        .byte   $7C                             ; A0CD 7C                       |
; fudge factor for bomb locations, always $00
level04_fudge_x:
        .byte   $00                             ; A0CE 00                       .
; fudge factor for bomb locations, always $06
level04_fudge_y:
        .byte   $06                             ; A0CF 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level04_points_per_bomb:
        .byte   $64                             ; A0D0 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level04_time_bonus:
        .word   $07D0                           ; A0D1 D0 07                    ..
; ----------------------------------------------------------------------------
; always $00
level04_offs_19:
        .byte   $00                             ; A0D3 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level04_unkn_table0:
        .addr   L06DF                           ; A0D4 DF 06                    ..
; used to draw the level initially (see also map_changes)
level04_map:
        .addr   l04_map                         ; A0D6 90 A7                    ..
; start of bombs in map data (which must come last!)
level04_map_bombs:
        .addr   l04_map_bombs                   ; A0D8 D5 A7                    ..
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level04_bomblist:
        .addr   l04_bombs                       ; A0DA 06 A8                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level04_map_changes:
        .addr   L0000                           ; A0DC 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level04_indirect_subs:
        .byte   $00,$00                         ; A0DE 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level04_sub_bomb:
        .addr   L06E6                           ; A0E0 E6 06                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level04_init:
        .addr   special_init_jv                 ; A0E2 36 80                    6.
; always $9740 aka game_main_loop
level04_sub6:
        .addr   game_main_loop                  ; A0E4 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level04_sub_eol:
        .addr   L06E6                           ; A0E6 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level04_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A0E8 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level04_colpf3:
        .byte   $CA                             ; A0EE CA                       .
; color for girders and up-ropes
level04_colpf0:
        .byte   $96                             ; A0EF 96                       .
; color for ladders and down-ropes
level04_colpf1:
        .byte   $18                             ; A0F0 18                       .
; color for bombs
level04_colpf2:
        .byte   $5A                             ; A0F1 5A                       Z
; unknown
level04_offs_50:
        .byte   $4C,$18,$2C,$80,$6C             ; A0F2 4C 18 2C 80 6C           L.,.l
; unknown, always $00 $00 $00
level04_offs_55:
        .byte   $00,$00,$00                     ; A0F7 00 00 00                 ...
; unknown, not a ROM address
level04_offs_58:
        .byte   $00,$00                         ; A0FA 00 00                    ..
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level04_offs_60:
        .byte   $00,$00,$00,$00                 ; A0FC 00 00 00 00              ....
; Descriptor for Figurits Revenge. first 2 bytes are level number in screencodes
level05_desc:
        .byte   $10,$15                         ; A100 10 15                    ..
; ----------------------------------------------------------------------------
; a subroutine
level05_sub0:
        .addr   L0000                           ; A102 00 00                    ..
; a subroutine
level05_sub1:
        .addr   L0000                           ; A104 00 00                    ..
; a subroutine
level05_sub2:
        .addr   L0000                           ; A106 00 00                    ..
; a subroutine
level05_sub3:
        .addr   check_pl_coll                   ; A108 73 8F                    s.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level05_num_bombs:
        .byte   $0E                             ; A10A 0E                       .
; 0 = no bullets, range 0-4.
level05_bullet_max:
        .byte   $02                             ; A10B 02                       .
; jumpman starting Y position
level05_y_start:
        .byte   $C0                             ; A10C C0                       .
; jumpman starting X position
level05_x_start:
        .byte   $34                             ; A10D 34                       4
; fudge factor for bomb locations, always $00
level05_fudge_x:
        .byte   $00                             ; A10E 00                       .
; fudge factor for bomb locations, always $06
level05_fudge_y:
        .byte   $06                             ; A10F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level05_points_per_bomb:
        .byte   $64                             ; A110 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level05_time_bonus:
        .word   $07D0                           ; A111 D0 07                    ..
; ----------------------------------------------------------------------------
; always $00
level05_offs_19:
        .byte   $00                             ; A113 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level05_unkn_table0:
        .addr   L06DF                           ; A114 DF 06                    ..
; used to draw the level initially (see also map_changes)
level05_map:
        .addr   l05_map                         ; A116 D0 AA                    ..
; start of bombs in map data (which must come last!)
level05_map_bombs:
        .addr   l05_map_bombs                   ; A118 42 AB                    B.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level05_bomblist:
        .addr   l05_bombs                       ; A11A 6D AB                    m.
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level05_map_changes:
        .addr   l05_map_changes                 ; A11C 8A AB                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level05_indirect_subs:
        .byte   $00,$00                         ; A11E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level05_sub_bomb:
        .addr   L06E6                           ; A120 E6 06                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level05_init:
        .addr   L06E6                           ; A122 E6 06                    ..
; always $9740 aka game_main_loop
level05_sub6:
        .addr   game_main_loop                  ; A124 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level05_sub_eol:
        .addr   L06E6                           ; A126 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level05_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A128 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level05_colpf3:
        .byte   $6A                             ; A12E 6A                       j
; color for girders and up-ropes
level05_colpf0:
        .byte   $08                             ; A12F 08                       .
; color for ladders and down-ropes
level05_colpf1:
        .byte   $C6                             ; A130 C6                       .
; color for bombs
level05_colpf2:
        .byte   $1A                             ; A131 1A                       .
; unknown
level05_offs_50:
        .byte   $0C,$22,$84,$8E,$00             ; A132 0C 22 84 8E 00           ."...
; unknown, always $00 $00 $00
level05_offs_55:
        .byte   $00,$00,$00                     ; A137 00 00 00                 ...
; unknown, not a ROM address
level05_offs_58:
        .byte   $96,$00                         ; A13A 96 00                    ..
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level05_offs_60:
        .byte   $00,$00,$00,$00                 ; A13C 00 00 00 00              ....
; Descriptor for Walls. first 2 bytes are level number in screencodes
level06_desc:
        .byte   $10,$16                         ; A140 10 16                    ..
; ----------------------------------------------------------------------------
; a subroutine
level06_sub0:
        .addr   walls_sub0                      ; A142 3A AA                    :.
; a subroutine
level06_sub1:
        .addr   walls_sub1                      ; A144 35 AA                    5.
; a subroutine
level06_sub2:
        .addr   walls_sub2                      ; A146 55 AA                    U.
; a subroutine
level06_sub3:
        .addr   walls_sub3                      ; A148 BC AA                    ..
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level06_num_bombs:
        .byte   $10                             ; A14A 10                       .
; 0 = no bullets, range 0-4.
level06_bullet_max:
        .byte   $00                             ; A14B 00                       .
; jumpman starting Y position
level06_y_start:
        .byte   $80                             ; A14C 80                       .
; jumpman starting X position
level06_x_start:
        .byte   $34                             ; A14D 34                       4
; fudge factor for bomb locations, always $00
level06_fudge_x:
        .byte   $00                             ; A14E 00                       .
; fudge factor for bomb locations, always $06
level06_fudge_y:
        .byte   $06                             ; A14F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level06_points_per_bomb:
        .byte   $64                             ; A150 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level06_time_bonus:
        .word   $05DC                           ; A151 DC 05                    ..
; ----------------------------------------------------------------------------
; always $00
level06_offs_19:
        .byte   $00                             ; A153 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level06_unkn_table0:
        .addr   L06DF                           ; A154 DF 06                    ..
; used to draw the level initially (see also map_changes)
level06_map:
        .addr   l06_map                         ; A156 20 A9                     .
; start of bombs in map data (which must come last!)
level06_map_bombs:
        .addr   l06_map_bombs                   ; A158 74 A9                    t.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level06_bomblist:
        .addr   l06_bombs                       ; A15A A5 A9                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level06_map_changes:
        .addr   L0000                           ; A15C 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level06_indirect_subs:
        .byte   $00,$00                         ; A15E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level06_sub_bomb:
        .addr   walls_bomb_sub                  ; A160 73 AA                    s.
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level06_init:
        .addr   walls_init                      ; A162 C6 A9                    ..
; always $9740 aka game_main_loop
level06_sub6:
        .addr   game_main_loop                  ; A164 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level06_sub_eol:
        .addr   L06E6                           ; A166 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level06_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A168 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level06_colpf3:
        .byte   $56                             ; A16E 56                       V
; color for girders and up-ropes
level06_colpf0:
        .byte   $C6                             ; A16F C6                       .
; color for ladders and down-ropes
level06_colpf1:
        .byte   $96                             ; A170 96                       .
; color for bombs
level06_colpf2:
        .byte   $28                             ; A171 28                       (
; unknown
level06_offs_50:
        .byte   $04,$30,$68,$94,$00             ; A172 04 30 68 94 00           .0h..
; unknown, always $00 $00 $00
level06_offs_55:
        .byte   $00,$00,$00                     ; A177 00 00 00                 ...
; unknown, not a ROM address
level06_offs_58:
        .byte   $4C,$FF                         ; A17A 4C FF                    L.
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level06_offs_60:
        .byte   $FF,$FF,$FF,$FF                 ; A17C FF FF FF FF              ....
; Descriptor for Zig-Zag. first 2 bytes are level number in screencodes
level07_desc:
        .byte   $10,$17                         ; A180 10 17                    ..
; ----------------------------------------------------------------------------
; a subroutine
level07_sub0:
        .addr   zigzag_sub0                     ; A182 68 AD                    h.
; a subroutine
level07_sub1:
        .addr   L0000                           ; A184 00 00                    ..
; a subroutine
level07_sub2:
        .addr   L0000                           ; A186 00 00                    ..
; a subroutine
level07_sub3:
        .addr   check_pl_coll                   ; A188 73 8F                    s.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level07_num_bombs:
        .byte   $0E                             ; A18A 0E                       .
; 0 = no bullets, range 0-4.
level07_bullet_max:
        .byte   $03                             ; A18B 03                       .
; jumpman starting Y position
level07_y_start:
        .byte   $C0                             ; A18C C0                       .
; jumpman starting X position
level07_x_start:
        .byte   $7C                             ; A18D 7C                       |
; fudge factor for bomb locations, always $00
level07_fudge_x:
        .byte   $00                             ; A18E 00                       .
; fudge factor for bomb locations, always $06
level07_fudge_y:
        .byte   $06                             ; A18F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level07_points_per_bomb:
        .byte   $64                             ; A190 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level07_time_bonus:
        .word   $05DC                           ; A191 DC 05                    ..
; ----------------------------------------------------------------------------
; always $00
level07_offs_19:
        .byte   $00                             ; A193 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level07_unkn_table0:
        .addr   L06DF                           ; A194 DF 06                    ..
; used to draw the level initially (see also map_changes)
level07_map:
        .addr   l07_map                         ; A196 60 AC                    `.
; start of bombs in map data (which must come last!)
level07_map_bombs:
        .addr   l07_map_bombs                   ; A198 BA AC                    ..
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level07_bomblist:
        .addr   l07_bombs                       ; A19A E5 AC                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level07_map_changes:
        .addr   l07_map_changes                 ; A19C 02 AD                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level07_indirect_subs:
        .byte   $00,$00                         ; A19E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level07_sub_bomb:
        .addr   L06E6                           ; A1A0 E6 06                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level07_init:
        .addr   special_init_jv                 ; A1A2 36 80                    6.
; always $9740 aka game_main_loop
level07_sub6:
        .addr   game_main_loop                  ; A1A4 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level07_sub_eol:
        .addr   L06E6                           ; A1A6 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level07_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A1A8 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level07_colpf3:
        .byte   $CA                             ; A1AE CA                       .
; color for girders and up-ropes
level07_colpf0:
        .byte   $96                             ; A1AF 96                       .
; color for ladders and down-ropes
level07_colpf1:
        .byte   $18                             ; A1B0 18                       .
; color for bombs
level07_colpf2:
        .byte   $5A                             ; A1B1 5A                       Z
; unknown
level07_offs_50:
        .byte   $0C,$4C,$8C,$00,$00             ; A1B2 0C 4C 8C 00 00           .L...
; unknown, always $00 $00 $00
level07_offs_55:
        .byte   $00,$00,$00                     ; A1B7 00 00 00                 ...
; unknown, not a ROM address
level07_offs_58:
        .byte   $1C,$7E                         ; A1BA 1C 7E                    .~
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level07_offs_60:
        .byte   $00,$00,$00,$00                 ; A1BC 00 00 00 00              ....
; Descriptor for Spellbound. first 2 bytes are level number in screencodes
level08_desc:
        .byte   $10,$18                         ; A1C0 10 18                    ..
; ----------------------------------------------------------------------------
; a subroutine
level08_sub0:
        .addr   LAF1C                           ; A1C2 1C AF                    ..
; a subroutine
level08_sub1:
        .addr   L0000                           ; A1C4 00 00                    ..
; a subroutine
level08_sub2:
        .addr   L0000                           ; A1C6 00 00                    ..
; a subroutine
level08_sub3:
        .addr   check_pl_coll                   ; A1C8 73 8F                    s.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level08_num_bombs:
        .byte   $0C                             ; A1CA 0C                       .
; 0 = no bullets, range 0-4.
level08_bullet_max:
        .byte   $02                             ; A1CB 02                       .
; jumpman starting Y position
level08_y_start:
        .byte   $20                             ; A1CC 20                        
; jumpman starting X position
level08_x_start:
        .byte   $7C                             ; A1CD 7C                       |
; fudge factor for bomb locations, always $00
level08_fudge_x:
        .byte   $00                             ; A1CE 00                       .
; fudge factor for bomb locations, always $06
level08_fudge_y:
        .byte   $06                             ; A1CF 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level08_points_per_bomb:
        .byte   $64                             ; A1D0 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level08_time_bonus:
        .word   $05DC                           ; A1D1 DC 05                    ..
; ----------------------------------------------------------------------------
; always $00
level08_offs_19:
        .byte   $00                             ; A1D3 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level08_unkn_table0:
        .addr   l08_unkn0                       ; A1D4 8A AE                    ..
; used to draw the level initially (see also map_changes)
level08_map:
        .addr   l08_map                         ; A1D6 E0 AD                    ..
; start of bombs in map data (which must come last!)
level08_map_bombs:
        .addr   l08_map_bombs                   ; A1D8 4C AE                    L.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level08_bomblist:
        .addr   l08_bombs                       ; A1DA 71 AE                    q.
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level08_map_changes:
        .addr   L0000                           ; A1DC 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level08_indirect_subs:
        .byte   $00,$00                         ; A1DE 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level08_sub_bomb:
        .addr   spellbound_bomb_sub             ; A1E0 23 AF                    #.
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level08_init:
        .addr   spellbound_init                 ; A1E2 9B AE                    ..
; always $9740 aka game_main_loop
level08_sub6:
        .addr   game_main_loop                  ; A1E4 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level08_sub_eol:
        .addr   spellbound_letters              ; A1E6 58 AF                    X.
; ----------------------------------------------------------------------------
; all zeroes
level08_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A1E8 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level08_colpf3:
        .byte   $6A                             ; A1EE 6A                       j
; color for girders and up-ropes
level08_colpf0:
        .byte   $08                             ; A1EF 08                       .
; color for ladders and down-ropes
level08_colpf1:
        .byte   $C6                             ; A1F0 C6                       .
; color for bombs
level08_colpf2:
        .byte   $1A                             ; A1F1 1A                       .
; unknown
level08_offs_50:
        .byte   $0C,$30,$68,$8C,$00             ; A1F2 0C 30 68 8C 00           .0h..
; unknown, always $00 $00 $00
level08_offs_55:
        .byte   $00,$00,$00                     ; A1F7 00 00 00                 ...
; unknown, not a ROM address
level08_offs_58:
        .byte   $40,$56                         ; A1FA 40 56                    @V
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level08_offs_60:
        .byte   $00,$00,$00,$00                 ; A1FC 00 00 00 00              ....
; Descriptor for Blackout. first 2 bytes are level number in screencodes
level09_desc:
        .byte   $10,$19                         ; A200 10 19                    ..
; ----------------------------------------------------------------------------
; a subroutine
level09_sub0:
        .addr   blackout_sub0                   ; A202 40 B1                    @.
; a subroutine
level09_sub1:
        .addr   L0000                           ; A204 00 00                    ..
; a subroutine
level09_sub2:
        .addr   L0000                           ; A206 00 00                    ..
; a subroutine
level09_sub3:
        .addr   L0000                           ; A208 00 00                    ..
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level09_num_bombs:
        .byte   $08                             ; A20A 08                       .
; 0 = no bullets, range 0-4.
level09_bullet_max:
        .byte   $00                             ; A20B 00                       .
; jumpman starting Y position
level09_y_start:
        .byte   $C0                             ; A20C C0                       .
; jumpman starting X position
level09_x_start:
        .byte   $9E                             ; A20D 9E                       .
; fudge factor for bomb locations, always $00
level09_fudge_x:
        .byte   $00                             ; A20E 00                       .
; fudge factor for bomb locations, always $06
level09_fudge_y:
        .byte   $06                             ; A20F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level09_points_per_bomb:
        .byte   $64                             ; A210 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level09_time_bonus:
        .word   $07D0                           ; A211 D0 07                    ..
; ----------------------------------------------------------------------------
; always $00
level09_offs_19:
        .byte   $00                             ; A213 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level09_unkn_table0:
        .addr   L06DF                           ; A214 DF 06                    ..
; used to draw the level initially (see also map_changes)
level09_map:
        .addr   l09_map                         ; A216 A2 B0                    ..
; start of bombs in map data (which must come last!)
level09_map_bombs:
        .addr   l09_map_bombs                   ; A218 72 B0                    r.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level09_bomblist:
        .addr   l09_bombs                       ; A21A A3 B0                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level09_map_changes:
        .addr   L0000                           ; A21C 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level09_indirect_subs:
        .byte   $00,$00                         ; A21E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level09_sub_bomb:
        .addr   blackout_bomb_sub               ; A220 21 B1                    !.
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level09_init:
        .addr   blackout_init                   ; A222 C4 B0                    ..
; always $9740 aka game_main_loop
level09_sub6:
        .addr   game_main_loop                  ; A224 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level09_sub_eol:
        .addr   L06E6                           ; A226 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level09_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A228 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level09_colpf3:
        .byte   $1A                             ; A22E 1A                       .
; color for girders and up-ropes
level09_colpf0:
        .byte   $C6                             ; A22F C6                       .
; color for ladders and down-ropes
level09_colpf1:
        .byte   $96                             ; A230 96                       .
; color for bombs
level09_colpf2:
        .byte   $28                             ; A231 28                       (
; unknown
level09_offs_50:
        .byte   $0C,$3C,$00,$00,$8C             ; A232 0C 3C 00 00 8C           .<...
; unknown, always $00 $00 $00
level09_offs_55:
        .byte   $00,$00,$00                     ; A237 00 00 00                 ...
; unknown, not a ROM address
level09_offs_58:
        .byte   $80,$00                         ; A23A 80 00                    ..
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level09_offs_60:
        .byte   $00,$00,$00,$00                 ; A23C 00 00 00 00              ....
; Descriptor for HereThereEverywhere. first 2 bytes are level number in screencodes
level10_desc:
        .byte   $11,$10                         ; A240 11 10                    ..
; ----------------------------------------------------------------------------
; a subroutine
level10_sub0:
        .addr   herethere_sub0                  ; A242 7E B2                    ~.
; a subroutine
level10_sub1:
        .addr   L0000                           ; A244 00 00                    ..
; a subroutine
level10_sub2:
        .addr   L0000                           ; A246 00 00                    ..
; a subroutine
level10_sub3:
        .addr   herethere_sub3                  ; A248 E0 B2                    ..
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level10_num_bombs:
        .byte   $0C                             ; A24A 0C                       .
; 0 = no bullets, range 0-4.
level10_bullet_max:
        .byte   $02                             ; A24B 02                       .
; jumpman starting Y position
level10_y_start:
        .byte   $C0                             ; A24C C0                       .
; jumpman starting X position
level10_x_start:
        .byte   $3C                             ; A24D 3C                       <
; fudge factor for bomb locations, always $00
level10_fudge_x:
        .byte   $00                             ; A24E 00                       .
; fudge factor for bomb locations, always $06
level10_fudge_y:
        .byte   $06                             ; A24F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level10_points_per_bomb:
        .byte   $64                             ; A250 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level10_time_bonus:
        .word   $05DC                           ; A251 DC 05                    ..
; ----------------------------------------------------------------------------
; always $00
level10_offs_19:
        .byte   $00                             ; A253 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level10_unkn_table0:
        .addr   l10_unkn0                       ; A254 75 B2                    u.
; used to draw the level initially (see also map_changes)
level10_map:
        .addr   l10_map                         ; A256 E0 B1                    ..
; start of bombs in map data (which must come last!)
level10_map_bombs:
        .addr   l10_map_bombs                   ; A258 37 B2                    7.
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level10_bomblist:
        .addr   l10_bombs                       ; A25A 5C B2                    \.
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level10_map_changes:
        .addr   L0000                           ; A25C 00 00                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level10_indirect_subs:
        .byte   $00,$00                         ; A25E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level10_sub_bomb:
        .addr   herethere_bomb_sub              ; A260 FD B2                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level10_init:
        .addr   special_init_jv                 ; A262 36 80                    6.
; always $9740 aka game_main_loop
level10_sub6:
        .addr   game_main_loop                  ; A264 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level10_sub_eol:
        .addr   L06E6                           ; A266 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level10_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A268 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level10_colpf3:
        .byte   $CA                             ; A26E CA                       .
; color for girders and up-ropes
level10_colpf0:
        .byte   $96                             ; A26F 96                       .
; color for ladders and down-ropes
level10_colpf1:
        .byte   $18                             ; A270 18                       .
; color for bombs
level10_colpf2:
        .byte   $5A                             ; A271 5A                       Z
; unknown
level10_offs_50:
        .byte   $0C,$40,$8C,$00,$00             ; A272 0C 40 8C 00 00           .@...
; unknown, always $00 $00 $00
level10_offs_55:
        .byte   $00,$00,$00                     ; A277 00 00 00                 ...
; unknown, not a ROM address
level10_offs_58:
        .byte   $62,$00                         ; A27A 62 00                    b.
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level10_offs_60:
        .byte   $00,$00,$00,$00                 ; A27C 00 00 00 00              ....
; Descriptor for Hatchlings. first 2 bytes are level number in screencodes
level11_desc:
        .byte   $11,$11                         ; A280 11 11                    ..
; ----------------------------------------------------------------------------
; a subroutine
level11_sub0:
        .addr   hatch_sub0                      ; A282 57 B4                    W.
; a subroutine
level11_sub1:
        .addr   hatch_sub1                      ; A284 81 B5                    ..
; a subroutine
level11_sub2:
        .addr   L0000                           ; A286 00 00                    ..
; a subroutine
level11_sub3:
        .addr   hatch_sub3                      ; A288 7C B5                    |.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level11_num_bombs:
        .byte   $0F                             ; A28A 0F                       .
; 0 = no bullets, range 0-4.
level11_bullet_max:
        .byte   $00                             ; A28B 00                       .
; jumpman starting Y position
level11_y_start:
        .byte   $B6                             ; A28C B6                       .
; jumpman starting X position
level11_x_start:
        .byte   $C4                             ; A28D C4                       .
; fudge factor for bomb locations, always $00
level11_fudge_x:
        .byte   $00                             ; A28E 00                       .
; fudge factor for bomb locations, always $06
level11_fudge_y:
        .byte   $06                             ; A28F 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level11_points_per_bomb:
        .byte   $64                             ; A290 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level11_time_bonus:
        .word   $03E8                           ; A291 E8 03                    ..
; ----------------------------------------------------------------------------
; always $00
level11_offs_19:
        .byte   $00                             ; A293 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level11_unkn_table0:
        .addr   hatch_table_b50b                ; A294 0B B5                    ..
; used to draw the level initially (see also map_changes)
level11_map:
        .addr   l11_map                         ; A296 20 B3                     .
; start of bombs in map data (which must come last!)
level11_map_bombs:
        .addr   l11_map_bombs                   ; A298 8F B3                    ..
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level11_bomblist:
        .addr   l11_bombs                       ; A29A BD B3                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level11_map_changes:
        .addr   l11_map_changes                 ; A29C DC B3                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level11_indirect_subs:
        .byte   $00,$00                         ; A29E 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level11_sub_bomb:
        .addr   hatch_bomb_sub                  ; A2A0 4C B4                    L.
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level11_init:
        .addr   special_init_jv                 ; A2A2 36 80                    6.
; always $9740 aka game_main_loop
level11_sub6:
        .addr   game_main_loop                  ; A2A4 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level11_sub_eol:
        .addr   L06E6                           ; A2A6 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level11_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A2A8 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level11_colpf3:
        .byte   $6A                             ; A2AE 6A                       j
; color for girders and up-ropes
level11_colpf0:
        .byte   $08                             ; A2AF 08                       .
; color for ladders and down-ropes
level11_colpf1:
        .byte   $C6                             ; A2B0 C6                       .
; color for bombs
level11_colpf2:
        .byte   $1A                             ; A2B1 1A                       .
; unknown
level11_offs_50:
        .byte   $0C,$30,$54,$8C,$00             ; A2B2 0C 30 54 8C 00           .0T..
; unknown, always $00 $00 $00
level11_offs_55:
        .byte   $00,$00,$00                     ; A2B7 00 00 00                 ...
; unknown, not a ROM address
level11_offs_58:
        .byte   $00,$66                         ; A2BA 00 66                    .f
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level11_offs_60:
        .byte   $00,$00,$00,$00                 ; A2BC 00 00 00 00              ....
; Descriptor for Hurricane. first 2 bytes are level number in screencodes
level12_desc:
        .byte   $11,$12                         ; A2C0 11 12                    ..
; ----------------------------------------------------------------------------
; a subroutine
level12_sub0:
        .addr   hurr_sub0                       ; A2C2 91 B6                    ..
; a subroutine
level12_sub1:
        .addr   hurr_sub1                       ; A2C4 9B B6                    ..
; a subroutine
level12_sub2:
        .addr   hurr_sub2                       ; A2C6 09 B7                    ..
; a subroutine
level12_sub3:
        .addr   check_pl_coll                   ; A2C8 73 8F                    s.
; ----------------------------------------------------------------------------
; number of bombs to pick up on this level
level12_num_bombs:
        .byte   $0E                             ; A2CA 0E                       .
; 0 = no bullets, range 0-4.
level12_bullet_max:
        .byte   $00                             ; A2CB 00                       .
; jumpman starting Y position
level12_y_start:
        .byte   $C0                             ; A2CC C0                       .
; jumpman starting X position
level12_x_start:
        .byte   $7C                             ; A2CD 7C                       |
; fudge factor for bomb locations, always $00
level12_fudge_x:
        .byte   $00                             ; A2CE 00                       .
; fudge factor for bomb locations, always $06
level12_fudge_y:
        .byte   $06                             ; A2CF 06                       .
; points awarded per bomb pickup (always $64 aka 100)
level12_points_per_bomb:
        .byte   $64                             ; A2D0 64                       d
; ----------------------------------------------------------------------------
; amount of time bonus at start of level
level12_time_bonus:
        .word   $09C4                           ; A2D1 C4 09                    ..
; ----------------------------------------------------------------------------
; always $00
level12_offs_19:
        .byte   $00                             ; A2D3 00                       .
; ----------------------------------------------------------------------------
; pointer to ROM table or $06xx
level12_unkn_table0:
        .addr   l12_unkn0                       ; A2D4 58 B6                    X.
; used to draw the level initially (see also map_changes)
level12_map:
        .addr   l12_map                         ; A2D6 90 B5                    ..
; start of bombs in map data (which must come last!)
level12_map_bombs:
        .addr   l12_map_bombs                   ; A2D8 D2 B5                    ..
; addr of list of bombs, indexed by player position on coarse 8x8 grid. 2 bytes each, 1st is coarse-grid position, 2nd is: hi 4 bits = change_map index, lo 4 = indirect sub (unused). terminated by $FF.
level12_bomblist:
        .addr   l12_bombs                       ; A2DA FD B5                    ..
; address of list of addresses of map data, used for changing the map when certain bombs are picked up
level12_map_changes:
        .addr   l12_map_changes                 ; A2DC 1A B6                    ..
; ----------------------------------------------------------------------------
; pointer to list of indirect subs, always $0000 in this game
level12_indirect_subs:
        .byte   $00,$00                         ; A2DE 00 00                    ..
; ----------------------------------------------------------------------------
; called when a bomb is picked up. $06E6 for most levels (just an RTS), or else a ROM subroutine
level12_sub_bomb:
        .addr   L06E6                           ; A2E0 E6 06                    ..
; called at start of level, $06E6 for some levels, or else a ROM subroutine
level12_init:
        .addr   special_init_jv                 ; A2E2 36 80                    6.
; always $9740 aka game_main_loop
level12_sub6:
        .addr   game_main_loop                  ; A2E4 40 97                    @.
; called at end of level (all bombs picked up). $06E6 for all but level08
level12_sub_eol:
        .addr   L06E6                           ; A2E6 E6 06                    ..
; ----------------------------------------------------------------------------
; all zeroes
level12_offs_40:
        .byte   $00,$00,$00,$00,$00,$00         ; A2E8 00 00 00 00 00 00        ......
; color (not sure what gets drawn in this color yet)
level12_colpf3:
        .byte   $08                             ; A2EE 08                       .
; color for girders and up-ropes
level12_colpf0:
        .byte   $C6                             ; A2EF C6                       .
; color for ladders and down-ropes
level12_colpf1:
        .byte   $96                             ; A2F0 96                       .
; color for bombs
level12_colpf2:
        .byte   $28                             ; A2F1 28                       (
; unknown
level12_offs_50:
        .byte   $0C,$2A,$4C,$6A,$8C             ; A2F2 0C 2A 4C 6A 8C           .*Lj.
; unknown, always $00 $00 $00
level12_offs_55:
        .byte   $00,$00,$00                     ; A2F7 00 00 00                 ...
; unknown, not a ROM address
level12_offs_58:
        .byte   $00,$00                         ; A2FA 00 00                    ..
; unknown, level06 (walls) has $ff $ff $ff $ff, all others $00 $00 $00 $00
level12_offs_60:
        .byte   $00,$00,$00,$00                 ; A2FC 00 00 00 00              ....
; level map data starts here
l01_map:.byte   $FE,$33,$9C,$FD,$04,$00,$44,$05 ; A300 FE 33 9C FD 04 00 44 05  .3....D.
        .byte   $06,$04,$15,$0A,$74,$15,$0A,$24 ; A308 06 04 15 0A 74 15 0A 24  ....t..$
        .byte   $22,$02,$74,$22,$02,$24,$25,$16 ; A310 22 02 74 22 02 24 25 16  ".t".$%.
        .byte   $04,$45,$04,$44,$45,$06,$8C,$45 ; A318 04 45 04 44 45 06 8C 45  .E.DE..E
        .byte   $04,$04,$55,$08,$34,$55,$0E,$7C ; A320 04 04 55 08 34 55 0E 7C  ..U.4U.|
        .byte   $55,$08,$FD,$04,$FF,$34,$09,$04 ; A328 55 08 FD 04 FF 34 09 04  U....4..
        .byte   $5C,$44,$0A,$FD,$04,$01,$5C,$06 ; A330 5C 44 0A FD 04 01 5C 06  \D....\.
        .byte   $04,$1C,$3B,$0A,$FE,$5F,$9C,$FD ; A338 04 1C 3B 0A FE 5F 9C FD  ..;.._..
        .byte   $00,$04,$0C,$41,$05,$8C,$41,$05 ; A340 00 04 0C 41 05 8C 41 05  ...A..A.
        .byte   $24,$01,$05,$74,$01,$05,$4C,$01 ; A348 24 01 05 74 01 05 4C 01  $..t..L.
        .byte   $15,$FE,$C9,$9C,$06,$18,$0A,$99 ; A350 15 FE C9 9C 06 18 0A 99  ........
        .byte   $18,$0A,$FE,$DA,$9C,$1D,$38,$06 ; A358 18 0A FE DA 9C 1D 38 06  ......8.
        .byte   $81,$38,$06,$FE,$B3,$9C         ; A360 81 38 06 FE B3 9C        .8....
; gfx_draw instructions for bombs, used by bomb_pickup to get bomb coords. $ff terminated
l01_map_bombs:
        .byte   $04,$12,$01,$38,$02,$01,$64,$02 ; A366 04 12 01 38 02 01 64 02  ...8..d.
        .byte   $01,$98,$12,$01,$44,$22,$01,$58 ; A36E 01 98 12 01 44 22 01 58  ....D".X
        .byte   $22,$01,$04,$42,$01,$98,$42,$01 ; A376 22 01 04 42 01 98 42 01  "..B..B.
        .byte   $04,$52,$01,$38,$52,$01,$64,$52 ; A37E 04 52 01 38 52 01 64 52  .R.8R.dR
        .byte   $01,$98,$52,$01,$FF             ; A386 01 98 52 01 FF           ..R..
; 2 bytes per entry, terminated by $FF. 1st byte is coarse grid coords (top nybble = X, bottom = Y), 2nd byte is index into map_changes
l01_bombs:
        .byte   $24,$00,$62,$10,$82,$20,$C4,$00 ; A38B 24 00 62 10 82 20 C4 00  $.b.. ..
        .byte   $66,$30,$86,$40,$2A,$00,$CA,$00 ; A393 66 30 86 40 2A 00 CA 00  f0.@*...
        .byte   $2C,$00,$6C,$00,$8C,$00,$CC,$00 ; A39B 2C 00 6C 00 8C 00 CC 00  ,.l.....
; terminator for l01_bombs
l01_bombs_term:
        .byte   $FF                             ; A3A3 FF                       .
; ----------------------------------------------------------------------------
; 0000 = no change
l01_map_changes:
        .addr   L0000                           ; A3A4 00 00                    ..
        .addr   l01_map_change_0                ; A3A6 AE A3                    ..
        .addr   l01_map_change_1                ; A3A8 B8 A3                    ..
        .addr   l01_map_change_2                ; A3AA C2 A3                    ..
        .addr   l01_map_change_3                ; A3AC CC A3                    ..
; ----------------------------------------------------------------------------
l01_map_change_0:
        .byte   $FE,$49,$9C,$FD,$04,$01,$64,$08 ; A3AE FE 49 9C FD 04 01 64 08  .I....d.
        .byte   $02,$FF                         ; A3B6 02 FF                    ..
l01_map_change_1:
        .byte   $FE,$49,$9C,$FD,$04,$FF,$34,$09 ; A3B8 FE 49 9C FD 04 FF 34 09  .I....4.
        .byte   $02,$FF                         ; A3C0 02 FF                    ..
l01_map_change_2:
        .byte   $FE,$49,$9C,$FD,$04,$00,$2C,$25 ; A3C2 FE 49 9C FD 04 00 2C 25  .I....,%
        .byte   $05,$FF                         ; A3CA 05 FF                    ..
l01_map_change_3:
        .byte   $FE,$49,$9C,$FD,$04,$00,$60,$25 ; A3CC FE 49 9C FD 04 00 60 25  .I....`%
        .byte   $05,$FF                         ; A3D4 05 FF                    ..
zero_filler_a3d6:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; A3D6 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00                         ; A3DE 00 00                    ..
; level map data starts here
l02_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; A3E0 FE 33 9C FD 04 00 04 05  .3......
        .byte   $08,$34,$05,$0E,$7C,$05,$08,$14 ; A3E8 08 34 05 0E 7C 05 08 14  .4..|...
        .byte   $15,$04,$34,$15,$04,$5C,$15,$04 ; A3F0 15 04 34 15 04 5C 15 04  ..4..\..
        .byte   $7C,$15,$04,$04,$25,$10,$5C,$25 ; A3F8 7C 15 04 04 25 10 5C 25  |...%.\%
        .byte   $10,$20,$3C,$07,$64,$3C,$07,$04 ; A400 10 20 3C 07 64 3C 07 04  . <.d<..
        .byte   $55,$09,$38,$55,$0C,$78,$55,$09 ; A408 55 09 38 55 0C 78 55 09  U.8U.xU.
        .byte   $FD,$04,$FF,$04,$19,$04,$80,$3B ; A410 FD 04 FF 04 19 04 80 3B  .......;
        .byte   $07,$FD,$04,$01,$8C,$16,$04,$04 ; A418 07 FD 04 01 8C 16 04 04  ........
        .byte   $35,$07,$FE,$5F,$9C,$FD,$00,$04 ; A420 35 07 FE 5F 9C FD 00 04  5.._....
        .byte   $18,$01,$05,$4C,$01,$15,$80,$01 ; A428 18 01 05 4C 01 15 80 01  ...L....
        .byte   $05,$FE,$C9,$9C,$19,$3C,$05,$85 ; A430 05 FE C9 9C 19 3C 05 85  .....<..
        .byte   $3C,$05,$FE,$DA,$9C,$05,$30,$08 ; A438 3C 05 FE DA 9C 05 30 08  <.....0.
        .byte   $99,$30,$08,$FE,$B3,$9C         ; A440 99 30 08 FE B3 9C        .0....
l02_map_bombs:
        .byte   $04,$02,$01,$38,$02,$01,$64,$02 ; A446 04 02 01 38 02 01 64 02  ...8..d.
        .byte   $01,$98,$02,$01,$04,$12,$01,$38 ; A44E 01 98 02 01 04 12 01 38  .......8
        .byte   $12,$01,$64,$12,$01,$98,$12,$01 ; A456 12 01 64 12 01 98 12 01  ..d.....
        .byte   $20,$22,$01,$7C,$22,$01,$38,$32 ; A45E 20 22 01 7C 22 01 38 32   ".|".82
        .byte   $01,$64,$32,$01,$04,$52,$01,$38 ; A466 01 64 32 01 04 52 01 38  .d2..R.8
        .byte   $52,$01,$64,$52,$01,$98,$52,$01 ; A46E 52 01 64 52 01 98 52 01  R.dR..R.
        .byte   $FF                             ; A476 FF                       .
l02_bombs:
        .byte   $22,$00,$62,$00,$82,$00,$C2,$00 ; A477 22 00 62 00 82 00 C2 00  ".b.....
        .byte   $24,$00,$64,$00,$84,$00,$C4,$00 ; A47F 24 00 64 00 84 00 C4 00  $.d.....
        .byte   $46,$00,$A6,$00,$68,$00,$88,$00 ; A487 46 00 A6 00 68 00 88 00  F...h...
        .byte   $2C,$00,$6C,$00,$8C,$00,$CC,$00 ; A48F 2C 00 6C 00 8C 00 CC 00  ,.l.....
l02_bombs_term:
        .byte   $FF                             ; A497 FF                       .
; ----------------------------------------------------------------------------
; not sure what this actually does
electrocution_bomb_pickup:
        ldy     bomb_idx                        ; A498 A4 B2                    ..
        lda     elec_bomb_table,y               ; A49A B9 42 A5                 .B.
        clc                                     ; A49D 18                       .
        adc     #$30                            ; A49E 69 30                    i0
        sta     $0680                           ; A4A0 8D 80 06                 ...
        lda     LA543,y                         ; A4A3 B9 43 A5                 .C.
        asl     a                               ; A4A6 0A                       .
        adc     #$20                            ; A4A7 69 20                    i 
        sta     $0685                           ; A4A9 8D 85 06                 ...
        lda     LA582,y                         ; A4AC B9 82 A5                 ...
        sta     $068A                           ; A4AF 8D 8A 06                 ...
        lda     LA583,y                         ; A4B2 B9 83 A5                 ...
        sta     PCOLR2                          ; A4B5 8D C2 02                 ...
        lda     LA562,y                         ; A4B8 B9 62 A5                 .b.
        clc                                     ; A4BB 18                       .
        adc     #$30                            ; A4BC 69 30                    i0
        sta     $0681                           ; A4BE 8D 81 06                 ...
        lda     LA563,y                         ; A4C1 B9 63 A5                 .c.
        asl     a                               ; A4C4 0A                       .
        adc     #$20                            ; A4C5 69 20                    i 
        sta     $0686                           ; A4C7 8D 86 06                 ...
        lda     LA5A2,y                         ; A4CA B9 A2 A5                 ...
        sta     $068B                           ; A4CD 8D 8B 06                 ...
        lda     LA5A3,y                         ; A4D0 B9 A3 A5                 ...
        sta     PCOLR3                          ; A4D3 8D C3 02                 ...
        sta     $066C                           ; A4D6 8D 6C 06                 .l.
        sta     $066D                           ; A4D9 8D 6D 06                 .m.
        rts                                     ; A4DC 60                       `

; ----------------------------------------------------------------------------
; turn off electrocution effect (?)
electrocution_done:
        lda     $0623                           ; A4DD AD 23 06                 .#.
        bne     LA4FF                           ; A4E0 D0 1D                    ..
        lda     falling_flag                    ; A4E2 AD 21 06                 .!.
        bne     LA4E8                           ; A4E5 D0 01                    ..
        rts                                     ; A4E7 60                       `

; ----------------------------------------------------------------------------
LA4E8:  ldx     #$01                            ; A4E8 A2 01                    ..
        lda     sav_p2pl                        ; A4EA AD BE 06                 ...
        and     #$03                            ; A4ED 29 03                    ).
        bne     LA505                           ; A4EF D0 14                    ..
        inx                                     ; A4F1 E8                       .
        lda     sav_p3pl                        ; A4F2 AD BF 06                 ...
        and     #$03                            ; A4F5 29 03                    ).
        bne     LA505                           ; A4F7 D0 0C                    ..
        lda     initial_speed                   ; A4F9 AD 25 06                 .%.
        sta     current_speed                   ; A4FC 8D 24 06                 .$.
LA4FF:  lda     #$00                            ; A4FF A9 00                    ..
        sta     $0770                           ; A501 8D 70 07                 .p.
        rts                                     ; A504 60                       `

; ----------------------------------------------------------------------------
LA505:  stx     $0770                           ; A505 8E 70 07                 .p.
        rts                                     ; A508 60                       `

; ----------------------------------------------------------------------------
; electrocution effect
electrocute:
        ldx     $0770                           ; A509 AE 70 07                 .p.
        bne     LA50F                           ; A50C D0 01                    ..
        rts                                     ; A50E 60                       `

; ----------------------------------------------------------------------------
LA50F:  lda     RANDOM                          ; A50F AD 0A D2                 ...
        sta     COLPM1,x                        ; A512 9D 13 D0                 ...
        sta     COLPM0                          ; A515 8D 12 D0                 ...
        lda     #$08                            ; A518 A9 08                    ..
        sta     current_speed                   ; A51A 8D 24 06                 .$.
        lda     #$2D                            ; A51D A9 2D                    .-
        sta     sfx_slot_priority               ; A51F 8D 3E 06                 .>.
        lda     #$A5                            ; A522 A9 A5                    ..
        sta     sfx_slot_timer                  ; A524 8D 3F 06                 .?.
        lda     #$01                            ; A527 A9 01                    ..
        jsr     cue_sfx_lowprior_jv             ; A529 20 03 80                  ..
        rts                                     ; A52C 60                       `

; ----------------------------------------------------------------------------
sfx_electrocution:
        .byte   $01,$81,$00,$0A,$02,$01,$81,$00 ; A52D 01 81 00 0A 02 01 81 00  ........
        .byte   $32,$02,$01,$81,$00,$1E,$02,$00 ; A535 32 02 01 81 00 1E 02 00  2.......
; ----------------------------------------------------------------------------
; skip a couple of the collision regs, so we don't register a collision when Jumpman is being electrocuted
level03_collisions:
        lda     #$00                            ; A53D A9 00                    ..
        jmp     check_pl_coll_no_pl             ; A53F 4C 79 8F                 Ly.

; ----------------------------------------------------------------------------
; dunno exactly how it's used yet, referenced by electrocution_bomb_pickup
elec_bomb_table:
        .byte   $0C                             ; A542 0C                       .
LA543:  .byte   $05,$18,$09,$58,$05,$80,$15,$18 ; A543 05 18 09 58 05 80 15 18  ...X....
        .byte   $09,$28,$25,$4C,$1D,$80,$09,$18 ; A54B 09 28 25 4C 1D 80 09 18  .(%L....
        .byte   $15,$70,$25,$2C,$3C,$4C,$45,$0C ; A553 15 70 25 2C 3C 4C 45 0C  .p%,<LE.
        .byte   $55,$20,$55,$4C,$4D,$8C,$55     ; A55B 55 20 55 4C 4D 8C 55     U ULM.U
LA562:  .byte   $18                             ; A562 18                       .
LA563:  .byte   $15,$40,$05,$80,$09,$8C,$05,$18 ; A563 15 40 05 80 09 8C 05 18  .@......
        .byte   $09,$4C,$0D,$70,$25,$80,$09,$28 ; A56B 09 4C 0D 70 25 80 09 28  .L.p%..(
        .byte   $25,$80,$15,$4C,$35,$6C,$3C,$0C ; A573 25 80 15 4C 35 6C 3C 0C  %..L5l<.
        .byte   $55,$4C,$4D,$78,$55,$8C,$55     ; A57B 55 4C 4D 78 55 8C 55     ULMxU.U
LA582:  .byte   $01                             ; A582 01                       .
LA583:  .byte   $08,$02,$C6,$01,$08,$01,$08,$02 ; A583 08 02 C6 01 08 01 08 02  ........
        .byte   $C6,$01,$08,$02,$C6,$02,$C6,$01 ; A58B C6 01 08 02 C6 02 C6 01  ........
        .byte   $08,$01,$08,$01,$08,$02,$C6,$01 ; A593 08 01 08 01 08 02 C6 01  ........
        .byte   $08,$01,$08,$02,$C6,$01,$08     ; A59B 08 01 08 02 C6 01 08     .......
LA5A2:  .byte   $01                             ; A5A2 01                       .
LA5A3:  .byte   $08,$01,$08,$02,$C6,$01,$08,$02 ; A5A3 08 01 08 02 C6 01 08 02  ........
        .byte   $C6,$02,$C6,$01,$08,$02,$C6,$01 ; A5AB C6 02 C6 01 08 02 C6 01  ........
        .byte   $08,$01,$08,$02,$C6,$01,$08,$01 ; A5B3 08 01 08 02 C6 01 08 01  ........
        .byte   $08,$02,$C6,$01,$08,$01,$08     ; A5BB 08 02 C6 01 08 01 08     .......
LA5C2:  .byte   $03,$D3,$A5,$08,$00,$00,$01,$00 ; A5C2 03 D3 A5 08 00 00 01 00  ........
        .byte   $04,$D3,$A5,$08,$00,$00,$01,$00 ; A5CA 04 D3 A5 08 00 00 01 00  ........
        .byte   $FF,$FF,$FF,$AA,$AA,$FF,$FF,$00 ; A5D2 FF FF FF AA AA FF FF 00  ........
        .byte   $00,$C3,$C3,$C3,$C3,$FF,$FF,$C3 ; A5DA 00 C3 C3 C3 C3 FF FF C3  ........
        .byte   $C3,$00,$00,$00,$00,$00,$00,$00 ; A5E2 C3 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00         ; A5EA 00 00 00 00 00 00        ......
; level map data starts here
l03_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; A5F0 FE 33 9C FD 04 00 04 05  .3......
        .byte   $06,$84,$05,$06,$04,$15,$06,$84 ; A5F8 06 84 05 06 04 15 06 84  ........
        .byte   $15,$06,$04,$25,$0C,$6C,$25,$0C ; A600 15 06 04 25 0C 6C 25 0C  ...%.l%.
        .byte   $04,$35,$0C,$6C,$35,$0C,$04,$45 ; A608 04 35 0C 6C 35 0C 04 45  .5.l5..E
        .byte   $04,$24,$45,$04,$6C,$45,$04,$8C ; A610 04 24 45 04 6C 45 04 8C  .$E.lE..
        .byte   $45,$04,$04,$55,$06,$84,$55,$06 ; A618 45 04 04 55 06 84 55 06  E..U..U.
        .byte   $FE,$5F,$9C,$FD,$00,$04,$0C,$01 ; A620 FE 5F 9C FD 00 04 0C 01  ._......
        .byte   $05,$8C,$01,$05,$FE,$B3,$9C     ; A628 05 8C 01 05 FE B3 9C     .......
l03_map_bombs:
        .byte   $04,$02,$01,$04,$12,$01,$04,$22 ; A62F 04 02 01 04 12 01 04 22  ......."
        .byte   $01,$04,$32,$01,$04,$42,$01,$04 ; A637 01 04 32 01 04 42 01 04  ..2..B..
        .byte   $52,$01,$98,$02,$01,$98,$12,$01 ; A63F 52 01 98 02 01 98 12 01  R.......
        .byte   $98,$22,$01,$98,$32,$01,$98,$42 ; A647 98 22 01 98 32 01 98 42  ."..2..B
        .byte   $01,$98,$52,$01,$FF             ; A64F 01 98 52 01 FF           ..R..
l03_bombs:
        .byte   $22,$00,$24,$00,$26,$00,$28,$00 ; A654 22 00 24 00 26 00 28 00  ".$.&.(.
        .byte   $2A,$00,$2C,$00,$C2,$00,$C4,$00 ; A65C 2A 00 2C 00 C2 00 C4 00  *.,.....
        .byte   $C6,$00,$C8,$00,$CA,$00,$CC,$00 ; A664 C6 00 C8 00 CA 00 CC 00  ........
l03_bombs_term:
        .byte   $FF                             ; A66C FF                       .
l03_unkn:
        .byte   $00,$00,$00,$01,$7A,$01,$01,$66 ; A66D 00 00 00 01 7A 01 01 66  ....z..f
        .byte   $03,$86,$A6,$06,$4C,$4A,$01,$66 ; A675 03 86 A6 06 4C 4A 01 66  ....LJ.f
        .byte   $04,$86,$A6,$06,$A4,$CA,$01,$66 ; A67D 04 86 A6 06 A4 CA 01 66  .......f
; horizontally moving platforms from level03
dw_platform_sprite:
        .byte   $FF,$FF,$FF,$AA,$55,$FF,$FF     ; A685 FF FF FF AA 55 FF FF     ....U..
; ----------------------------------------------------------------------------
; gets called at start of level
dumbwaiter_setup:
        jsr     special_init_jv                 ; A68C 20 36 80                  6.
        lda     #$06                            ; A68F A9 06                    ..
        sta     bullet_y_delta+2                ; A691 8D 60 07                 .`.
        ldy     #$2A                            ; A694 A0 2A                    .*
LA696:  ldx     #$06                            ; A696 A2 06                    ..
LA698:  lda     LA781,x                         ; A698 BD 81 A7                 ...
        sta     $2B00,y                         ; A69B 99 00 2B                 ..+
        iny                                     ; A69E C8                       .
        dex                                     ; A69F CA                       .
        bne     LA698                           ; A6A0 D0 F6                    ..
        tya                                     ; A6A2 98                       .
        clc                                     ; A6A3 18                       .
        adc     #$1A                            ; A6A4 69 1A                    i.
        tay                                     ; A6A6 A8                       .
        dec     bullet_y_delta+2                ; A6A7 CE 60 07                 .`.
        bne     LA696                           ; A6AA D0 EA                    ..
        lda     #$FF                            ; A6AC A9 FF                    ..
        sta     SIZEM                           ; A6AE 8D 0C D0                 ...
        stx     $068C                           ; A6B1 8E 8C 06                 ...
        lda     #$01                            ; A6B4 A9 01                    ..
        sta     SIZEP2                          ; A6B6 8D 0A D0                 ...
        sta     SIZEP3                          ; A6B9 8D 0B D0                 ...
LA6BC:  rts                                     ; A6BC 60                       `

; ----------------------------------------------------------------------------
; gets called every frame
dumbwaiter_sub0:
        lda     $06F5                           ; A6BD AD F5 06                 ...
        beq     LA6BC                           ; A6C0 F0 FA                    ..
        cmp     #$01                            ; A6C2 C9 01                    ..
        bne     LA6DC                           ; A6C4 D0 16                    ..
        inc     $06F5                           ; A6C6 EE F5 06                 ...
        inc     $0669                           ; A6C9 EE 69 06                 .i.
        inc     $066C                           ; A6CC EE 6C 06                 .l.
        inc     $066D                           ; A6CF EE 6D 06                 .m.
        lda     #$01                            ; A6D2 A9 01                    ..
        sta     $0770                           ; A6D4 8D 70 07                 .p.
        lda     #$FF                            ; A6D7 A9 FF                    ..
        sta     $0771                           ; A6D9 8D 71 07                 .q.
LA6DC:  lda     $0623                           ; A6DC AD 23 06                 .#.
        cmp     #$02                            ; A6DF C9 02                    ..
        beq     LA6BC                           ; A6E1 F0 D9                    ..
        lda     $0622                           ; A6E3 AD 22 06                 .".
        beq     LA6BC                           ; A6E6 F0 D4                    ..
        ldx     #$02                            ; A6E8 A2 02                    ..
LA6EA:  inx                                     ; A6EA E8                       .
        cpx     #$05                            ; A6EB E0 05                    ..
        beq     LA70F                           ; A6ED F0 20                    . 
        clc                                     ; A6EF 18                       .
        lda     $067D,x                         ; A6F0 BD 7D 06                 .}.
        adc     $076D,x                         ; A6F3 7D 6D 07                 }m.
        sta     $067D,x                         ; A6F6 9D 7D 06                 .}.
        cmp     #$4B                            ; A6F9 C9 4B                    .K
        beq     LA701                           ; A6FB F0 04                    ..
        cmp     #$A4                            ; A6FD C9 A4                    ..
        bne     LA6EA                           ; A6FF D0 E9                    ..
LA701:  lda     $076D,x                         ; A701 BD 6D 07                 .m.
        eor     #$FF                            ; A704 49 FF                    I.
        sta     $076D,x                         ; A706 9D 6D 07                 .m.
        inc     $076D,x                         ; A709 FE 6D 07                 .m.
        jmp     LA6EA                           ; A70C 4C EA A6                 L..

; ----------------------------------------------------------------------------
LA70F:  lda     $2BCF                           ; A70F AD CF 2B                 ..+
        sta     $2B0E                           ; A712 8D 0E 2B                 ..+
        ldy     #$CF                            ; A715 A0 CF                    ..
        ldx     #$CE                            ; A717 A2 CE                    ..
LA719:  lda     $2B00,x                         ; A719 BD 00 2B                 ..+
        sta     $2B00,y                         ; A71C 99 00 2B                 ..+
        dex                                     ; A71F CA                       .
        dey                                     ; A720 88                       .
        bne     LA719                           ; A721 D0 F6                    ..
        rts                                     ; A723 60                       `

; ----------------------------------------------------------------------------
; gets called every frame
dumbwaiter_sub3:
        lda     $0623                           ; A724 AD 23 06                 .#.
        cmp     #$02                            ; A727 C9 02                    ..
        beq     LA778                           ; A729 F0 4D                    .M
        lda     $0622                           ; A72B AD 22 06                 .".
        beq     LA778                           ; A72E F0 48                    .H
        lda     $0778                           ; A730 AD 78 07                 .x.
        beq     LA73D                           ; A733 F0 08                    ..
        lda     #$00                            ; A735 A9 00                    ..
        sta     $06ED                           ; A737 8D ED 06                 ...
        sta     $0778                           ; A73A 8D 78 07                 .x.
LA73D:  lda     sav_m0pl                        ; A73D AD B8 06                 ...
        ora     sav_m1pl                        ; A740 0D B9 06                 ...
        ora     sav_m2pl                        ; A743 0D BA 06                 ...
        ora     sav_m3pl                        ; A746 0D BB 06                 ...
        tax                                     ; A749 AA                       .
        ora     sav_p2pl                        ; A74A 0D BE 06                 ...
        ora     sav_p3pl                        ; A74D 0D BF 06                 ...
        tay                                     ; A750 A8                       .
        and     #$01                            ; A751 29 01                    ).
        beq     LA760                           ; A753 F0 0B                    ..
        lda     sav_p0pf                        ; A755 AD B4 06                 ...
        ora     #$01                            ; A758 09 01                    ..
        sta     sav_p0pf                        ; A75A 8D B4 06                 ...
        inc     player_y_pos                    ; A75D EE 83 06                 ...
LA760:  tya                                     ; A760 98                       .
        and     #$02                            ; A761 29 02                    ).
        beq     LA779                           ; A763 F0 14                    ..
        lda     sav_p1pf                        ; A765 AD B5 06                 ...
        ora     #$01                            ; A768 09 01                    ..
        sta     sav_p1pf                        ; A76A 8D B5 06                 ...
        txa                                     ; A76D 8A                       .
        and     #$02                            ; A76E 29 02                    ).
        beq     LA778                           ; A770 F0 06                    ..
        inc     player_y_pos                    ; A772 EE 83 06                 ...
        sta     $0778                           ; A775 8D 78 07                 .x.
LA778:  rts                                     ; A778 60                       `

; ----------------------------------------------------------------------------
LA779:  lda     player_y_pos                    ; A779 AD 83 06                 ...
        and     #$FE                            ; A77C 29 FE                    ).
        sta     player_y_pos                    ; A77E 8D 83 06                 ...
LA781:  rts                                     ; A781 60                       `

; ----------------------------------------------------------------------------
; the dumbwaiters from level03. stored upside-down. trailing 00's might just be filler.
dumbwaiter_sprite:
        .byte   $18,$3C,$7E,$FF,$FF,$FF,$00,$00 ; A782 18 3C 7E FF FF FF 00 00  .<~.....
        .byte   $00,$00,$00,$00,$00,$00         ; A78A 00 00 00 00 00 00        ......
; level map data starts here
l04_map:.byte   $FE,$33,$9C,$FD,$04,$00,$40,$05 ; A790 FE 33 9C FD 04 00 40 05  .3....@.
        .byte   $08,$18,$15,$0A,$04,$25,$14,$18 ; A798 08 18 15 0A 04 25 14 18  .....%..
        .byte   $35,$0A,$2C,$45,$0A,$04,$55,$0F ; A7A0 35 0A 2C 45 0A 04 55 0F  5.,E..U.
        .byte   $60,$55,$0F,$4C,$15,$0F,$60,$25 ; A7A8 60 55 0F 4C 15 0F 60 25  `U.L..`%
        .byte   $0F,$4C,$35,$0F,$60,$45,$05,$FE ; A7B0 0F 4C 35 0F 60 45 05 FE  .L5.`E..
        .byte   $5F,$9C,$FD,$00,$04,$4C,$01,$05 ; A7B8 5F 9C FD 00 04 4C 01 05  _....L..
        .byte   $4C,$21,$05,$4C,$41,$05,$18,$11 ; A7C0 4C 21 05 4C 41 05 18 11  L!.LA...
        .byte   $05,$80,$11,$05,$2C,$31,$05,$6C ; A7C8 05 80 11 05 2C 31 05 6C  ....,1.l
        .byte   $31,$05,$FE,$B3,$9C             ; A7D0 31 05 FE B3 9C           1....
l04_map_bombs:
        .byte   $40,$02,$01,$5C,$02,$01,$24,$12 ; A7D5 40 02 01 5C 02 01 24 12  @..\..$.
        .byte   $01,$3C,$12,$01,$60,$12,$01,$78 ; A7DD 01 3C 12 01 60 12 01 78  .<..`..x
        .byte   $12,$01,$04,$22,$01,$3C,$22,$01 ; A7E5 12 01 04 22 01 3C 22 01  ...".<".
        .byte   $60,$22,$01,$98,$22,$01,$18,$32 ; A7ED 60 22 01 98 22 01 18 32  `".."..2
        .byte   $01,$84,$32,$01,$3C,$42,$01,$60 ; A7F5 01 84 32 01 3C 42 01 60  ..2.<B.`
        .byte   $42,$01,$04,$52,$01,$98,$52,$01 ; A7FD 42 01 04 52 01 98 52 01  B..R..R.
        .byte   $FF                             ; A805 FF                       .
l04_bombs:
        .byte   $62,$00,$82,$00,$44,$00,$64,$00 ; A806 62 00 82 00 44 00 64 00  b...D.d.
        .byte   $84,$00,$A4,$00,$26,$00,$66,$00 ; A80E 84 00 A4 00 26 00 66 00  ....&.f.
        .byte   $86,$00,$C6,$00,$48,$00,$A8,$00 ; A816 86 00 C6 00 48 00 A8 00  ....H...
        .byte   $6A,$00,$8A,$00,$2C,$00,$CC,$00 ; A81E 6A 00 8A 00 2C 00 CC 00  j...,...
l04_bombs_term:
        .byte   $FF                             ; A826 FF                       .
; ----------------------------------------------------------------------------
hellstones_sub3:
        lda     jiffy_timer_3_lo                ; A827 AD 19 06                 ...
        asl     a                               ; A82A 0A                       .
        asl     a                               ; A82B 0A                       .
        asl     a                               ; A82C 0A                       .
        asl     a                               ; A82D 0A                       .
        ora     #$08                            ; A82E 09 08                    ..
        sta     COLOR3                          ; A830 8D C7 02                 ...
        jmp     check_pl_coll                   ; A833 4C 73 8F                 Ls.

; ----------------------------------------------------------------------------
hellstones_sub0:
        lda     $0623                           ; A836 AD 23 06                 .#.
        cmp     #$02                            ; A839 C9 02                    ..
        beq     LA842                           ; A83B F0 05                    ..
        lda     $0622                           ; A83D AD 22 06                 .".
        bne     LA843                           ; A840 D0 01                    ..
LA842:  rts                                     ; A842 60                       `

; ----------------------------------------------------------------------------
LA843:  ldx     #$05                            ; A843 A2 05                    ..
LA845:  dex                                     ; A845 CA                       .
        beq     LA842                           ; A846 F0 FA                    ..
        lda     bullet_y_delta+1,x              ; A848 BD 5F 07                 ._.
        bne     LA865                           ; A84B D0 18                    ..
        lda     RANDOM                          ; A84D AD 0A D2                 ...
        and     #$1F                            ; A850 29 1F                    ).
        bne     LA845                           ; A852 D0 F1                    ..
        inc     bullet_y_delta+1,x              ; A854 FE 5F 07                 ._.
        lda     #$00                            ; A857 A9 00                    ..
        sta     bullet_y_pos_minus_one,x        ; A859 9D 9E 06                 ...
        lda     player_x_pos                    ; A85C AD 7E 06                 .~.
        clc                                     ; A85F 18                       .
        adc     #$03                            ; A860 69 03                    i.
        sta     $069A,x                         ; A862 9D 9A 06                 ...
LA865:  lda     $0763,x                         ; A865 BD 63 07                 .c.
        bne     LA89E                           ; A868 D0 34                    .4
        lda     dli_vec_shadow_hi,x             ; A86A BD AF 06                 ...
        and     #$01                            ; A86D 29 01                    ).
        beq     LA89E                           ; A86F F0 2D                    .-
        lda     player_x_pos                    ; A871 AD 7E 06                 .~.
        clc                                     ; A874 18                       .
        adc     #$03                            ; A875 69 03                    i.
        ldy     #$01                            ; A877 A0 01                    ..
        cmp     $069A,x                         ; A879 DD 9A 06                 ...
        beq     LA882                           ; A87C F0 04                    ..
        iny                                     ; A87E C8                       .
        bcc     LA882                           ; A87F 90 01                    ..
        iny                                     ; A881 C8                       .
LA882:  tya                                     ; A882 98                       .
        sta     $0763,x                         ; A883 9D 63 07                 .c.
        lda     #$00                            ; A886 A9 00                    ..
        sta     $0767,x                         ; A888 9D 67 07                 .g.
        txa                                     ; A88B 8A                       .
        pha                                     ; A88C 48                       H
play_hellstone_sfx:
        lda     #$0D                            ; A88D A9 0D                    ..
        sta     sfx_slot_priority               ; A88F 8D 3E 06                 .>.
        lda     #$A9                            ; A892 A9 A9                    ..
        sta     sfx_slot_timer                  ; A894 8D 3F 06                 .?.
        lda     #$03                            ; A897 A9 03                    ..
        jsr     cue_sfx_lowprior_jv             ; A899 20 03 80                  ..
        pla                                     ; A89C 68                       h
        tax                                     ; A89D AA                       .
LA89E:  lda     $0763,x                         ; A89E BD 63 07                 .c.
        bne     LA8C1                           ; A8A1 D0 1E                    ..
LA8A3:  clc                                     ; A8A3 18                       .
        lda     bullet_y_pos_minus_one,x        ; A8A4 BD 9E 06                 ...
        adc     #$02                            ; A8A7 69 02                    i.
        cmp     #$CE                            ; A8A9 C9 CE                    ..
        bcs     LA8B3                           ; A8AB B0 06                    ..
        sta     bullet_y_pos_minus_one,x        ; A8AD 9D 9E 06                 ...
        jmp     LA845                           ; A8B0 4C 45 A8                 LE.

; ----------------------------------------------------------------------------
LA8B3:  lda     #$00                            ; A8B3 A9 00                    ..
        sta     $069A,x                         ; A8B5 9D 9A 06                 ...
        sta     bullet_y_delta+1,x              ; A8B8 9D 5F 07                 ._.
        sta     $0763,x                         ; A8BB 9D 63 07                 .c.
        jmp     LA845                           ; A8BE 4C 45 A8                 LE.

; ----------------------------------------------------------------------------
LA8C1:  lda     $0767,x                         ; A8C1 BD 67 07                 .g.
        cmp     #$08                            ; A8C4 C9 08                    ..
        bne     LA8D4                           ; A8C6 D0 0C                    ..
        lda     #$00                            ; A8C8 A9 00                    ..
        sta     $0763,x                         ; A8CA 9D 63 07                 .c.
        cpx     #$03                            ; A8CD E0 03                    ..
        bcc     LA8A3                           ; A8CF 90 D2                    ..
        jmp     LA865                           ; A8D1 4C 65 A8                 Le.

; ----------------------------------------------------------------------------
LA8D4:  tay                                     ; A8D4 A8                       .
        clc                                     ; A8D5 18                       .
        lda     bullet_y_pos_minus_one,x        ; A8D6 BD 9E 06                 ...
        adc     hellstone_deltas_2,y            ; A8D9 79 05 A9                 y..
        sta     bullet_y_pos_minus_one,x        ; A8DC 9D 9E 06                 ...
        lda     hellstone_deltas_1,y            ; A8DF B9 FD A8                 ...
        tay                                     ; A8E2 A8                       .
        beq     LA8EF                           ; A8E3 F0 0A                    ..
        tay                                     ; A8E5 A8                       .
        lda     $0763,x                         ; A8E6 BD 63 07                 .c.
        cmp     #$03                            ; A8E9 C9 03                    ..
        beq     LA8EF                           ; A8EB F0 02                    ..
        ldy     #$FE                            ; A8ED A0 FE                    ..
LA8EF:  tya                                     ; A8EF 98                       .
        clc                                     ; A8F0 18                       .
        adc     $069A,x                         ; A8F1 7D 9A 06                 }..
        sta     $069A,x                         ; A8F4 9D 9A 06                 ...
        inc     $0767,x                         ; A8F7 FE 67 07                 .g.
        jmp     LA845                           ; A8FA 4C 45 A8                 LE.

; ----------------------------------------------------------------------------
; dunno, look like movement deltas, referenced by hellstones_sub0
hellstone_deltas_1:
        .byte   $00,$02,$02,$02,$02,$02,$02,$00 ; A8FD 00 02 02 02 02 02 02 00  ........
; dunno, look like movement deltas, referenced by hellstones_sub0
hellstone_deltas_2:
        .byte   $FE,$FE,$FE,$00,$00,$02,$02,$02 ; A905 FE FE FE 00 00 02 02 02  ........
sfx_hellstone:
        .byte   $01,$83,$00,$0A,$03,$00,$00,$00 ; A90D 01 83 00 0A 03 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; A915 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00                     ; A91D 00 00 00                 ...
l06_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; A920 FE 33 9C FD 04 00 04 05  .3......
        .byte   $04,$24,$05,$04,$44,$05,$06,$6C ; A928 04 24 05 04 44 05 06 6C  .$..D..l
        .byte   $05,$04,$8C,$05,$04,$30,$16,$04 ; A930 05 04 8C 05 04 30 16 04  .....0..
        .byte   $60,$16,$04,$04,$25,$09,$78,$25 ; A938 60 16 04 04 25 09 78 25  `...%.x%
        .byte   $09,$04,$35,$09,$40,$35,$08,$78 ; A940 09 04 35 09 40 35 08 78  ..5.@5.x
        .byte   $35,$09,$40,$45,$02,$58,$45,$02 ; A948 35 09 40 45 02 58 45 02  5.@E.XE.
        .byte   $04,$55,$05,$28,$55,$06,$4C,$55 ; A950 04 55 05 28 55 06 4C 55  .U.(U.LU
        .byte   $02,$60,$55,$06,$88,$55,$05,$FE ; A958 02 60 55 06 88 55 05 FE  .`U..U..
        .byte   $5F,$9C,$FD,$00,$04,$04,$01,$09 ; A960 5F 9C FD 00 04 04 01 09  _.......
        .byte   $94,$01,$09,$30,$19,$0F,$68,$19 ; A968 94 01 09 30 19 0F 68 19  ...0..h.
        .byte   $0F,$FE,$B3,$9C                 ; A970 0F FE B3 9C              ....
l06_map_bombs:
        .byte   $24,$02,$01,$44,$02,$01,$58,$02 ; A974 24 02 01 44 02 01 58 02  $..D..X.
        .byte   $01,$78,$02,$01,$44,$12,$01,$58 ; A97C 01 78 02 01 44 12 01 58  .x..D..X
        .byte   $12,$01,$24,$22,$01,$78,$22,$01 ; A984 12 01 24 22 01 78 22 01  ..$".x".
        .byte   $40,$32,$01,$5C,$32,$01,$40,$42 ; A98C 40 32 01 5C 32 01 40 42  @2.\2.@B
        .byte   $01,$5C,$42,$01,$04,$52,$01,$3C ; A994 01 5C 42 01 04 52 01 3C  .\B..R.<
        .byte   $52,$01,$60,$52,$01,$98,$52,$01 ; A99C 52 01 60 52 01 98 52 01  R.`R..R.
        .byte   $FF                             ; A9A4 FF                       .
l06_bombs:
        .byte   $42,$00,$62,$00,$82,$00,$A2,$00 ; A9A5 42 00 62 00 82 00 A2 00  B.b.....
        .byte   $64,$00,$84,$00,$46,$00,$A6,$00 ; A9AD 64 00 84 00 46 00 A6 00  d...F...
        .byte   $68,$00,$88,$00,$6A,$00,$8A,$00 ; A9B5 68 00 88 00 6A 00 8A 00  h...j...
        .byte   $2C,$00,$6C,$00,$8C,$00,$CC,$00 ; A9BD 2C 00 6C 00 8C 00 CC 00  ,.l.....
l06_bombs_term:
        .byte   $FF                             ; A9C5 FF                       .
; ----------------------------------------------------------------------------
walls_init:
        jsr     special_init_jv                 ; A9C6 20 36 80                  6.
        lda     #$02                            ; A9C9 A9 02                    ..
        sta     $0770                           ; A9CB 8D 70 07                 .p.
        sta     $0772                           ; A9CE 8D 72 07                 .r.
        lda     #$FE                            ; A9D1 A9 FE                    ..
        sta     $0771                           ; A9D3 8D 71 07                 .q.
        sta     $0773                           ; A9D6 8D 73 07                 .s.
        ldx     #$05                            ; A9D9 A2 05                    ..
        lda     #$00                            ; A9DB A9 00                    ..
LA9DD:  sta     HPOSP3,x                        ; A9DD 9D 03 D0                 ...
        dex                                     ; A9E0 CA                       .
        bne     LA9DD                           ; A9E1 D0 FA                    ..
        lda     #$C0                            ; A9E3 A9 C0                    ..
        jsr     LAA0C                           ; A9E5 20 0C AA                  ..
        lda     #$C0                            ; A9E8 A9 C0                    ..
        jsr     LAA0C                           ; A9EA 20 0C AA                  ..
        lda     #$30                            ; A9ED A9 30                    .0
        jsr     LAA0C                           ; A9EF 20 0C AA                  ..
        lda     #$30                            ; A9F2 A9 30                    .0
        jsr     LAA0C                           ; A9F4 20 0C AA                  ..
        lda     #$0C                            ; A9F7 A9 0C                    ..
        jsr     LAA0C                           ; A9F9 20 0C AA                  ..
        lda     #$0C                            ; A9FC A9 0C                    ..
        jsr     LAA0C                           ; A9FE 20 0C AA                  ..
        lda     #$03                            ; AA01 A9 03                    ..
        jsr     LAA0C                           ; AA03 20 0C AA                  ..
        lda     #$03                            ; AA06 A9 03                    ..
        jsr     LAA0C                           ; AA08 20 0C AA                  ..
        rts                                     ; AA0B 60                       `

; ----------------------------------------------------------------------------
LAA0C:  sta     dm_progctr                      ; AA0C 85 C0                    ..
LAA0E:  lda     RANDOM                          ; AA0E AD 0A D2                 ...
        cmp     #$AC                            ; AA11 C9 AC                    ..
        bcs     LAA0E                           ; AA13 B0 F9                    ..
        tay                                     ; AA15 A8                       .
        ldx     #$1E                            ; AA16 A2 1E                    ..
LAA18:  lda     $2B00,y                         ; AA18 B9 00 2B                 ..+
        ora     dm_progctr                      ; AA1B 05 C0                    ..
        sta     $2B00,y                         ; AA1D 99 00 2B                 ..+
        iny                                     ; AA20 C8                       .
        dex                                     ; AA21 CA                       .
        bne     LAA18                           ; AA22 D0 F4                    ..
        rts                                     ; AA24 60                       `

; ----------------------------------------------------------------------------
LAA25:  lda     $076F                           ; AA25 AD 6F 07                 .o.
        cmp     #$04                            ; AA28 C9 04                    ..
        bne     LAA2D                           ; AA2A D0 01                    ..
        rts                                     ; AA2C 60                       `

; ----------------------------------------------------------------------------
LAA2D:  tax                                     ; AA2D AA                       .
        inc     $0774,x                         ; AA2E FE 74 07                 .t.
        inc     $076F                           ; AA31 EE 6F 07                 .o.
        rts                                     ; AA34 60                       `

; ----------------------------------------------------------------------------
walls_sub1:
        lda     $0622                           ; AA35 AD 22 06                 .".
        bne     LAA3B                           ; AA38 D0 01                    ..
walls_sub0:
        rts                                     ; AA3A 60                       `

; ----------------------------------------------------------------------------
LAA3B:  ldx     #$05                            ; AA3B A2 05                    ..
LAA3D:  dex                                     ; AA3D CA                       .
        beq     walls_sub0                      ; AA3E F0 FA                    ..
        lda     $0773,x                         ; AA40 BD 73 07                 .s.
        beq     LAA3D                           ; AA43 F0 F8                    ..
        lda     $0777,x                         ; AA45 BD 77 07                 .w.
        clc                                     ; AA48 18                       .
        adc     $076F,x                         ; AA49 7D 6F 07                 }o.
        sta     $0777,x                         ; AA4C 9D 77 07                 .w.
        sta     HPOSP3,x                        ; AA4F 9D 03 D0                 ...
        jmp     LAA3D                           ; AA52 4C 3D AA                 L=.

; ----------------------------------------------------------------------------
walls_sub2:
        lda     $0622                           ; AA55 AD 22 06                 .".
        beq     walls_sub0                      ; AA58 F0 E0                    ..
        ldx     #$05                            ; AA5A A2 05                    ..
LAA5C:  dex                                     ; AA5C CA                       .
        beq     walls_sub0                      ; AA5D F0 DB                    ..
        lda     sav_p3pf,x                      ; AA5F BD B7 06                 ...
        and     #$01                            ; AA62 29 01                    ).
        beq     LAA5C                           ; AA64 F0 F6                    ..
        lda     player_x_pos                    ; AA66 AD 7E 06                 .~.
        clc                                     ; AA69 18                       .
        adc     $076F,x                         ; AA6A 7D 6F 07                 }o.
        sta     player_x_pos                    ; AA6D 8D 7E 06                 .~.
        jmp     LAA5C                           ; AA70 4C 5C AA                 L\.

; ----------------------------------------------------------------------------
; toggles the center rope between up and down ropes
walls_bomb_sub:
        inc     $0764                           ; AA73 EE 64 07                 .d.
        lda     $0764                           ; AA76 AD 64 07                 .d.
        and     #$01                            ; AA79 29 01                    ).
        beq     LAA82                           ; AA7B F0 05                    ..
        lda     #$90                            ; AA7D A9 90                    ..
        jmp     LAA84                           ; AA7F 4C 84 AA                 L..

; ----------------------------------------------------------------------------
LAA82:  lda     #$A6                            ; AA82 A9 A6                    ..
LAA84:  sta     dm_progctr                      ; AA84 85 C0                    ..
        lda     #$AA                            ; AA86 A9 AA                    ..
        sta     dm_progctr+1                    ; AA88 85 C1                    ..
        jsr     draw_map_jv                     ; AA8A 20 00 80                  ..
        jmp     LAA25                           ; AA8D 4C 25 AA                 L%.

; ----------------------------------------------------------------------------
; map data for center down-rope, referenced by walls_bomb_sub
walls_down_rope:
        .byte   $FE,$EB,$9C,$FD,$00,$04,$50,$00 ; AA90 FE EB 9C FD 00 04 50 00  ......P.
        .byte   $0C,$FE,$33,$9C,$4E,$05,$01,$FE ; AA98 0C FE 33 9C 4E 05 01 FE  ..3.N...
        .byte   $DA,$9C,$50,$00,$0C,$FF         ; AAA0 DA 9C 50 00 0C FF        ..P...
; map data for center up-rope, referenced walls_bomb_sub
walls_up_rope:
        .byte   $FE,$EB,$9C,$FD,$00,$04,$50,$00 ; AAA6 FE EB 9C FD 00 04 50 00  ......P.
        .byte   $0C,$FE,$33,$9C,$4E,$05,$01,$FE ; AAAE 0C FE 33 9C 4E 05 01 FE  ..3.N...
        .byte   $C9,$9C,$50,$08,$0A,$FF         ; AAB6 C9 9C 50 08 0A FF        ..P...
; ----------------------------------------------------------------------------
walls_sub3:
        lda     $062A                           ; AABC AD 2A 06                 .*.
        sta     COLOR3                          ; AABF 8D C7 02                 ...
        rts                                     ; AAC2 60                       `

; ----------------------------------------------------------------------------
        brk                                     ; AAC3 00                       .
        sta     COLOR3                          ; AAC4 8D C7 02                 ...
        rts                                     ; AAC7 60                       `

; ----------------------------------------------------------------------------
; non-map data, dunno what for. grouped with the level 5 stuff, but doesn't seem to be used by level 5 (as in, playing thru level 5 in the emu with breakpoint 'read>=aac8 read<=aacf' never causes a break!)
data_aac8:
        .byte   $00,$09,$40,$45,$02,$58,$45,$02 ; AAC8 00 09 40 45 02 58 45 02  ..@E.XE.
; level map data starts here
l05_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; AAD0 FE 33 9C FD 04 00 04 05  .3......
        .byte   $02,$1A,$05,$0B,$50,$05,$07,$04 ; AAD8 02 1A 05 0B 50 05 07 04  ....P...
        .byte   $25,$26,$7C,$33,$08,$20,$3B,$03 ; AAE0 25 26 7C 33 08 20 3B 03  %&|3. ;.
        .byte   $40,$3B,$03,$60,$3B,$06,$04,$47 ; AAE8 40 3B 03 60 3B 06 04 47  @;.`;..G
        .byte   $04,$20,$4B,$03,$40,$4B,$03,$60 ; AAF0 04 20 4B 03 40 4B 03 60  . K.@K.`
        .byte   $4B,$03,$80,$4A,$03,$04,$55,$26 ; AAF8 4B 03 80 4A 03 04 55 26  K..J..U&
        .byte   $FD,$04,$FF,$2C,$4A,$03,$4C,$4A ; AB00 FD 04 FF 2C 4A 03 4C 4A  ...,J.LJ
        .byte   $03,$6C,$4A,$03,$FD,$04,$01,$14 ; AB08 03 6C 4A 03 FD 04 01 14  .lJ.....
        .byte   $48,$03,$38,$49,$02,$58,$49,$02 ; AB10 48 03 38 49 02 58 49 02  H.8I.XI.
        .byte   $78,$49,$02,$FE,$5F,$9C,$FD,$00 ; AB18 78 49 02 FE 5F 9C FD 00  xI.._...
        .byte   $04,$0C,$21,$0D,$84,$01,$09,$84 ; AB20 04 0C 21 0D 84 01 09 84  ..!.....
        .byte   $2F,$06,$22,$01,$05,$FE,$C9,$9C ; AB28 2F 06 22 01 05 FE C9 9C  /.".....
        .byte   $3C,$08,$06,$35,$28,$04,$55,$28 ; AB30 3C 08 06 35 28 04 55 28  <..5(.U(
        .byte   $04,$FE,$DA,$9C,$9A,$30,$08,$FE ; AB38 04 FE DA 9C 9A 30 08 FE  .....0..
        .byte   $B3,$9C                         ; AB40 B3 9C                    ..
l05_map_bombs:
        .byte   $04,$02,$01,$44,$02,$01,$24,$16 ; AB42 04 02 01 44 02 01 24 16  ...D..$.
        .byte   $01,$44,$22,$01,$64,$22,$01,$98 ; AB4A 01 44 22 01 64 22 01 98  .D".d"..
        .byte   $22,$01,$24,$32,$01,$44,$32,$01 ; AB52 22 01 24 32 01 44 32 01  ".$2.D2.
        .byte   $64,$32,$01,$24,$52,$01,$44,$52 ; AB5A 64 32 01 24 52 01 44 52  d2.$R.DR
        .byte   $01,$64,$52,$01,$84,$52,$01,$98 ; AB62 01 64 52 01 84 52 01 98  .dR..R..
        .byte   $52,$01,$FF                     ; AB6A 52 01 FF                 R..
l05_bombs:
        .byte   $22,$10,$62,$20,$44,$30,$66,$40 ; AB6D 22 10 62 20 44 30 66 40  ".b D0f@
        .byte   $86,$50,$C6,$60,$48,$70,$68,$80 ; AB75 86 50 C6 60 48 70 68 80  .P.`Hph.
        .byte   $88,$90,$4C,$A0,$6C,$B0,$8C,$C0 ; AB7D 88 90 4C A0 6C B0 8C C0  ..L.l...
        .byte   $AC,$00,$CC,$D0                 ; AB85 AC 00 CC D0              ....
l05_bombs_term:
        .byte   $FF                             ; AB89 FF                       .
l05_map_changes:
        .byte   $00,$00,$A6,$AB,$B6,$AB,$C0,$AB ; AB8A 00 00 A6 AB B6 AB C0 AB  ........
        .byte   $D3,$AB,$DD,$AB,$F0,$AB,$FA,$AB ; AB92 D3 AB DD AB F0 AB FA AB  ........
        .byte   $04,$AC,$0E,$AC,$18,$AC,$22,$AC ; AB9A 04 AC 0E AC 18 AC 22 AC  ......".
        .byte   $2C,$AC,$36,$AC,$FE,$49,$9C,$FD ; ABA2 2C AC 36 AC FE 49 9C FD  ,.6..I..
        .byte   $04,$00,$04,$05,$02,$FE,$33,$9C ; ABAA 04 00 04 05 02 FE 33 9C  ......3.
        .byte   $20,$22,$03,$FF,$FE,$49,$9C,$FD ; ABB2 20 22 03 FF FE 49 9C FD   "...I..
        .byte   $04,$00,$3E,$05,$02,$FF,$FE,$89 ; ABBA 04 00 3E 05 02 FF FE 89  ..>.....
        .byte   $9C,$FD,$00,$04,$22,$11,$01,$FE ; ABC2 9C FD 00 04 22 11 01 FE  ...."...
        .byte   $49,$9C,$FD,$04,$FF,$2C,$4A,$03 ; ABCA 49 9C FD 04 FF 2C 4A 03  I....,J.
        .byte   $FF,$FE,$49,$9C,$FD,$04,$00,$44 ; ABD2 FF FE 49 9C FD 04 00 44  ..I....D
        .byte   $25,$03,$FF,$FE,$33,$9C,$FD,$04 ; ABDA 25 03 FF FE 33 9C FD 04  %...3...
        .byte   $00,$6C,$05,$04,$FE,$89,$9C,$FD ; ABE2 00 6C 05 04 FE 89 9C FD  .l......
        .byte   $00,$04,$84,$11,$02,$FF,$FE,$49 ; ABEA 00 04 84 11 02 FF FE 49  .......I
        .byte   $9C,$FD,$04,$00,$6C,$05,$04,$FF ; ABF2 9C FD 04 00 6C 05 04 FF  ....l...
        .byte   $FE,$49,$9C,$FD,$04,$00,$60,$4B ; ABFA FE 49 9C FD 04 00 60 4B  .I....`K
        .byte   $03,$FF,$FE,$49,$9C,$FD,$04,$00 ; AC02 03 FF FE 49 9C FD 04 00  ...I....
        .byte   $40,$4B,$03,$FF,$FE,$49,$9C,$FD ; AC0A 40 4B 03 FF FE 49 9C FD  @K...I..
        .byte   $04,$00,$20,$4B,$03,$FF,$FE,$33 ; AC12 04 00 20 4B 03 FF FE 33  .. K...3
        .byte   $9C,$FD,$04,$00,$28,$52,$01,$FF ; AC1A 9C FD 04 00 28 52 01 FF  ....(R..
        .byte   $FE,$33,$9C,$FD,$04,$00,$48,$52 ; AC22 FE 33 9C FD 04 00 48 52  .3....HR
        .byte   $01,$FF,$FE,$49,$9C,$FD,$04,$00 ; AC2A 01 FF FE 49 9C FD 04 00  ...I....
        .byte   $54,$55,$09,$FF,$FE,$33,$9C,$FD ; AC32 54 55 09 FF FE 33 9C FD  TU...3..
        .byte   $04,$00,$04,$08,$02,$FE,$5F,$9C ; AC3A 04 00 04 08 02 FE 5F 9C  ......_.
        .byte   $FD,$00,$04,$8E,$01,$09,$FF,$00 ; AC42 FD 00 04 8E 01 09 FF 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AC4A 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AC52 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00         ; AC5A 00 00 00 00 00 00        ......
l07_map:.byte   $FE,$33,$9C,$FD,$04,$00,$3C,$05 ; AC60 FE 33 9C FD 04 00 3C 05  .3....<.
        .byte   $0A,$04,$0C,$08,$7C,$0C,$08,$04 ; AC68 0A 04 0C 08 7C 0C 08 04  ....|...
        .byte   $15,$08,$7C,$15,$08,$38,$16,$01 ; AC70 15 08 7C 15 08 38 16 01  ..|..8..
        .byte   $64,$16,$01,$2C,$2C,$04,$64,$2C ; AC78 64 16 01 2C 2C 04 64 2C  d..,,.d,
        .byte   $04,$2C,$3C,$04,$64,$3C,$04,$04 ; AC80 04 2C 3C 04 64 3C 04 04  .,<.d<..
        .byte   $55,$26,$FD,$04,$FF,$24,$0B,$06 ; AC88 55 26 FD 04 FF 24 0B 06  U&...$..
        .byte   $FD,$04,$01,$64,$06,$06,$FE,$5F ; AC90 FD 04 01 64 06 06 FE 5F  ...d..._
        .byte   $9C,$FD,$00,$04,$0C,$01,$15,$4C ; AC98 9C FD 00 04 0C 01 15 4C  .......L
        .byte   $01,$15,$8C,$01,$15,$FE,$C9,$9C ; ACA0 01 15 8C 01 15 FE C9 9C  ........
        .byte   $39,$19,$03,$65,$19,$03,$FE,$DA ; ACA8 39 19 03 65 19 03 FE DA  9..e....
        .byte   $9C,$1F,$12,$0F,$80,$12,$0F,$FE ; ACB0 9C 1F 12 0F 80 12 0F FE  ........
        .byte   $B3,$9C                         ; ACB8 B3 9C                    ..
l07_map_bombs:
        .byte   $04,$02,$01,$3C,$02,$01,$60,$02 ; ACBA 04 02 01 3C 02 01 60 02  ...<..`.
        .byte   $01,$98,$02,$01,$24,$22,$01,$78 ; ACC2 01 98 02 01 24 22 01 78  ....$".x
        .byte   $22,$01,$24,$32,$01,$78,$32,$01 ; ACCA 22 01 24 32 01 78 32 01  ".$2.x2.
        .byte   $24,$42,$01,$78,$42,$01,$04,$52 ; ACD2 24 42 01 78 42 01 04 52  $B.xB..R
        .byte   $01,$3C,$52,$01,$60,$52,$01,$98 ; ACDA 01 3C 52 01 60 52 01 98  .<R.`R..
        .byte   $52,$01,$FF                     ; ACE2 52 01 FF                 R..
l07_bombs:
        .byte   $22,$10,$62,$20,$82,$30,$C2,$40 ; ACE5 22 10 62 20 82 30 C2 40  ".b .0.@
        .byte   $46,$50,$A6,$50,$48,$60,$A8,$60 ; ACED 46 50 A6 50 48 60 A8 60  FP.PH`.`
        .byte   $4A,$70,$AA,$70,$2C,$80,$6C,$00 ; ACF5 4A 70 AA 70 2C 80 6C 00  Jp.p,.l.
        .byte   $8C,$00,$CC,$90                 ; ACFD 8C 00 CC 90              ....
l07_bombs_term:
        .byte   $FF                             ; AD01 FF                       .
l07_map_changes:
        .byte   $00,$00,$16,$AD,$16,$AD,$20,$AD ; AD02 00 00 16 AD 16 AD 20 AD  ...... .
        .byte   $20,$AD,$2A,$AD,$34,$AD,$3E,$AD ; AD0A 20 AD 2A AD 34 AD 3E AD   .*.4.>.
        .byte   $48,$AD,$58,$AD,$FE,$49,$9C,$FD ; AD12 48 AD 58 AD FE 49 9C FD  H.X..I..
        .byte   $04,$FF,$24,$0B,$06,$FF,$FE,$49 ; AD1A 04 FF 24 0B 06 FF FE 49  ..$....I
        .byte   $9C,$FD,$04,$01,$64,$06,$06,$FF ; AD22 9C FD 04 01 64 06 06 FF  ....d...
        .byte   $FE,$89,$9C,$FD,$00,$04,$4C,$21 ; AD2A FE 89 9C FD 00 04 4C 21  ......L!
        .byte   $02,$FF,$FE,$89,$9C,$FD,$00,$04 ; AD32 02 FF FE 89 9C FD 00 04  ........
        .byte   $4C,$29,$02,$FF,$FE,$89,$9C,$FD ; AD3A 4C 29 02 FF FE 89 9C FD  L)......
        .byte   $00,$04,$4C,$31,$02,$FF,$FE,$C9 ; AD42 00 04 4C 31 02 FF FE C9  ..L1....
        .byte   $9C,$FD,$00,$04,$9A,$18,$0E,$FE ; AD4A 9C FD 00 04 9A 18 0E FE  ........
        .byte   $89,$9C,$0C,$31,$02,$FF,$FE,$C9 ; AD52 89 9C 0C 31 02 FF FE C9  ...1....
        .byte   $9C,$FD,$00,$04,$04,$18,$0E,$FE ; AD5A 9C FD 00 04 04 18 0E FE  ........
        .byte   $89,$9C,$8C,$31,$02,$FF         ; AD62 89 9C 8C 31 02 FF        ...1..
; ----------------------------------------------------------------------------
; move bullets in ways that defy the laws of physics and common sense
zigzag_sub0:
        lda     $0622                           ; AD68 AD 22 06                 .".
        bne     LAD6E                           ; AD6B D0 01                    ..
LAD6D:  rts                                     ; AD6D 60                       `

; ----------------------------------------------------------------------------
LAD6E:  ldx     #$FF                            ; AD6E A2 FF                    ..
LAD70:  inx                                     ; AD70 E8                       .
        cpx     work_level_bullet_max           ; AD71 EC 8B 07                 ...
        beq     LAD6D                           ; AD74 F0 F7                    ..
        lda     bullet_flags,x                  ; AD76 BD 56 07                 .V.
        cmp     #$02                            ; AD79 C9 02                    ..
        beq     LAD8B                           ; AD7B F0 0E                    ..
        sta     $076C,x                         ; AD7D 9D 6C 07                 .l.
        lda     #$00                            ; AD80 A9 00                    ..
        sta     $0764,x                         ; AD82 9D 64 07                 .d.
        sta     $0768,x                         ; AD85 9D 68 07                 .h.
        jmp     LAD70                           ; AD88 4C 70 AD                 Lp.

; ----------------------------------------------------------------------------
LAD8B:  cmp     $076C,x                         ; AD8B DD 6C 07                 .l.
        beq     LADA1                           ; AD8E F0 11                    ..
        sta     $076C,x                         ; AD90 9D 6C 07                 .l.
        lda     bullet_x_delta,x                ; AD93 BD 5A 07                 .Z.
        beq     LAD9E                           ; AD96 F0 06                    ..
        inc     $0768,x                         ; AD98 FE 68 07                 .h.
        jmp     LADA1                           ; AD9B 4C A1 AD                 L..

; ----------------------------------------------------------------------------
LAD9E:  inc     $0764,x                         ; AD9E FE 64 07                 .d.
LADA1:  lda     $0764,x                         ; ADA1 BD 64 07                 .d.
        beq     code_adb5                       ; ADA4 F0 0F                    ..
        and     #$0F                            ; ADA6 29 0F                    ).
        tay                                     ; ADA8 A8                       .
        lda     zigzag_deltas,y                 ; ADA9 B9 C7 AD                 ...
        sta     bullet_x_delta,x                ; ADAC 9D 5A 07                 .Z.
        inc     $0764,x                         ; ADAF FE 64 07                 .d.
        jmp     LAD70                           ; ADB2 4C 70 AD                 Lp.

; ----------------------------------------------------------------------------
code_adb5:
        lda     $0768,x                         ; ADB5 BD 68 07                 .h.
        and     #$0F                            ; ADB8 29 0F                    ).
        tay                                     ; ADBA A8                       .
        lda     zigzag_deltas,y                 ; ADBB B9 C7 AD                 ...
        sta     bullet_y_delta,x                ; ADBE 9D 5E 07                 .^.
code_adc1:
        inc     $0768,x                         ; ADC1 FE 68 07                 .h.
        jmp     LAD70                           ; ADC4 4C 70 AD                 Lp.

; ----------------------------------------------------------------------------
; kind of a sine wave shape. used for either X or Y delta, depending on the direction the bullet is moving
zigzag_deltas:
        .byte   $00,$01,$02,$03,$04,$03,$02,$01 ; ADC7 00 01 02 03 04 03 02 01  ........
        .byte   $00,$FF,$FE,$FD,$FC,$FD,$FE,$FF ; ADCF 00 FF FE FD FC FD FE FF  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; ADD7 00 00 00 00 00 00 00 00  ........
        .byte   $00                             ; ADDF 00                       .
l08_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; ADE0 FE 33 9C FD 04 00 04 05  .3......
        .byte   $02,$44,$05,$06,$94,$05,$02,$30 ; ADE8 02 44 05 06 94 05 02 30  .D.....0
        .byte   $0A,$02,$68,$0A,$02,$28,$21,$04 ; ADF0 0A 02 68 0A 02 28 21 04  ..h..(!.
        .byte   $68,$21,$04,$04,$25,$06,$84,$25 ; ADF8 68 21 04 04 25 06 84 25  h!..%..%
        .byte   $06,$04,$45,$10,$5C,$45,$10,$04 ; AE00 06 04 45 10 5C 45 10 04  ..E.\E..
        .byte   $55,$06,$2C,$55,$04,$64,$55,$04 ; AE08 55 06 2C 55 04 64 55 04  U.,U.dU.
        .byte   $84,$55,$06,$FD,$04,$FF,$84,$09 ; AE10 84 55 06 FD 04 FF 84 09  .U......
        .byte   $04,$1C,$24,$03,$FD,$04,$01,$0C ; AE18 04 1C 24 03 FD 04 01 0C  ..$.....
        .byte   $06,$04,$78,$22,$03,$FE,$5F,$9C ; AE20 06 04 78 22 03 FE 5F 9C  ..x".._.
        .byte   $FD,$00,$04,$0C,$21,$09,$8C,$21 ; AE28 FD 00 04 0C 21 09 8C 21  ....!..!
        .byte   $09,$30,$41,$05,$68,$41,$05,$FE ; AE30 09 30 41 05 68 41 05 FE  .0A.hA..
        .byte   $C9,$9C,$34,$0C,$04,$6B,$0C,$04 ; AE38 C9 9C 34 0C 04 6B 0C 04  ..4..k..
        .byte   $FE,$DA,$9C,$44,$02,$10,$5A,$02 ; AE40 FE DA 9C 44 02 10 5A 02  ...D..Z.
        .byte   $10,$FE,$B3,$9C                 ; AE48 10 FE B3 9C              ....
l08_map_bombs:
        .byte   $04,$02,$01,$98,$02,$01,$04,$22 ; AE4C 04 02 01 98 02 01 04 22  ......."
        .byte   $01,$98,$22,$01,$18,$34,$01,$84 ; AE54 01 98 22 01 18 34 01 84  .."..4..
        .byte   $34,$01,$04,$42,$01,$98,$42,$01 ; AE5C 34 01 04 42 01 98 42 01  4..B..B.
        .byte   $04,$52,$01,$38,$52,$01,$64,$52 ; AE64 04 52 01 38 52 01 64 52  .R.8R.dR
        .byte   $01,$98,$52,$01,$FF             ; AE6C 01 98 52 01 FF           ..R..
l08_bombs:
        .byte   $22,$00,$C2,$00,$26,$00,$C6,$00 ; AE71 22 00 C2 00 26 00 C6 00  "...&...
        .byte   $48,$00,$A8,$00,$2A,$00,$CA,$00 ; AE79 48 00 A8 00 2A 00 CA 00  H...*...
        .byte   $2C,$00,$6C,$00,$8C,$00,$CC,$00 ; AE81 2C 00 6C 00 8C 00 CC 00  ,.l.....
l08_bombs_term:
        .byte   $FF                             ; AE89 FF                       .
l08_unkn0:
        .byte   $03,$00,$00,$01,$7C,$01,$01,$00 ; AE8A 03 00 00 01 7C 01 01 00  ....|...
        .byte   $04,$0C,$AF,$10,$86,$00,$01,$0F ; AE92 04 0C AF 10 86 00 01 0F  ........
        .byte   $FF                             ; AE9A FF                       .
; ----------------------------------------------------------------------------
spellbound_init:
        jsr     special_init_jv                 ; AE9B 20 36 80                  6.
        lda     #$C0                            ; AE9E A9 C0                    ..
        sta     $0770                           ; AEA0 8D 70 07                 .p.
        rts                                     ; AEA3 60                       `

; ----------------------------------------------------------------------------
; used by spellbound, dunno exactly how yet
spellbound_table:
        .byte   $18,$08,$38,$20,$00,$48,$30,$18 ; AEA4 18 08 38 20 00 48 30 18  ..8 .H0.
        .byte   $28,$10,$10                     ; AEAC 28 10 10                 (..
; letters for level08, spellbound (not ASCII or screencodes though)
epyx_jumpman:
        .byte   $40,$29,$21,$11,$19,$11,$09,$01 ; AEAF 40 29 21 11 19 11 09 01  @)!.....
        .byte   $49,$41,$39,$19,$31             ; AEB7 49 41 39 19 31           IA9.1
LAEBC:  .byte   $03,$03,$03,$03,$03,$C3,$C3,$7E ; AEBC 03 03 03 03 03 C3 C3 7E  .......~
        .byte   $C3,$C3,$C3,$C3,$C3,$C3,$C3,$7E ; AEC4 C3 C3 C3 C3 C3 C3 C3 7E  .......~
        .byte   $C3,$C3,$E7,$FF,$DB,$C3,$C3,$C3 ; AECC C3 C3 E7 FF DB C3 C3 C3  ........
        .byte   $FE,$C3,$C3,$C3,$FE,$C0,$C0,$C0 ; AED4 FE C3 C3 C3 FE C0 C0 C0  ........
        .byte   $18,$3C,$66,$C3,$FF,$C3,$C3,$C3 ; AEDC 18 3C 66 C3 FF C3 C3 C3  .<f.....
        .byte   $C3,$C3,$E3,$F3,$DB,$CF,$C7,$C3 ; AEE4 C3 C3 E3 F3 DB CF C7 C3  ........
        .byte   $FF,$C0,$C0,$C0,$F8,$C0,$C0,$FF ; AEEC FF C0 C0 C0 F8 C0 C0 FF  ........
        .byte   $C3,$66,$3C,$18,$18,$18,$18,$18 ; AEF4 C3 66 3C 18 18 18 18 18  .f<.....
        .byte   $C3,$C3,$66,$3C,$3C,$66,$C3,$C3 ; AEFC C3 C3 66 3C 3C 66 C3 C3  ..f<<f..
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AF04 00 00 00 00 00 00 00 00  ........
        .byte   $40,$A0,$20,$40                 ; AF0C 40 A0 20 40              @. @
; looks almost like code but it's bogus
data_af10:
        .byte   $E0,$00,$38,$20,$30,$08,$30,$04 ; AF10 E0 00 38 20 30 08 30 04  ..8 0.0.
        .byte   $0A,$0A,$0A,$04                 ; AF18 0A 0A 0A 04              ....
; ----------------------------------------------------------------------------
LAF1C:  lda     $062A                           ; AF1C AD 2A 06                 .*.
        sta     PCOLR2                          ; AF1F 8D C2 02                 ...
        rts                                     ; AF22 60                       `

; ----------------------------------------------------------------------------
spellbound_bomb_sub:
        lda     bomb_idx                        ; AF23 A5 B2                    ..
        lsr     a                               ; AF25 4A                       J
        tax                                     ; AF26 AA                       .
        ldy     spellbound_table,x              ; AF27 BC A4 AE                 ...
        iny                                     ; AF2A C8                       .
        ldx     $0771                           ; AF2B AE 71 07                 .q.
        tya                                     ; AF2E 98                       .
        sta     $0773,x                         ; AF2F 9D 73 07                 .s.
        dey                                     ; AF32 88                       .
        ldx     $0770                           ; AF33 AE 70 07                 .p.
        lda     #$08                            ; AF36 A9 08                    ..
        sta     $0772                           ; AF38 8D 72 07                 .r.
LAF3B:  lda     LAEBC,y                         ; AF3B B9 BC AE                 ...
        sta     $2E00,x                         ; AF3E 9D 00 2E                 ...
        inx                                     ; AF41 E8                       .
        iny                                     ; AF42 C8                       .
        dec     $0772                           ; AF43 CE 72 07                 .r.
        bne     LAF3B                           ; AF46 D0 F3                    ..
        inc     $0771                           ; AF48 EE 71 07                 .q.
        sec                                     ; AF4B 38                       8
        lda     $0770                           ; AF4C AD 70 07                 .p.
        sbc     #$0A                            ; AF4F E9 0A                    ..
        sta     $0770                           ; AF51 8D 70 07                 .p.
        inc     $066C                           ; AF54 EE 6C 06                 .l.
        rts                                     ; AF57 60                       `

; ----------------------------------------------------------------------------
; called at end of Spellbound, adds up letter bonus
spellbound_letters:
        lda     work_level_num_bombs            ; AF58 AD 8A 07                 ...
        beq     spellbound_got_all              ; AF5B F0 01                    ..
        rts                                     ; AF5D 60                       `

; ----------------------------------------------------------------------------
; got all the bombs
spellbound_got_all:
        lda     #$09                            ; AF5E A9 09                    ..
        sta     current_speed                   ; AF60 8D 24 06                 .$.
        lda     #$00                            ; AF63 A9 00                    ..
        sta     playing_level                   ; AF65 8D 27 06                 .'.
        ldx     #$0C                            ; AF68 A2 0C                    ..
        stx     $066D                           ; AF6A 8E 6D 06                 .m.
ltr_loop:
        lda     $0770                           ; AF6D AD 70 07                 .p.
        clc                                     ; AF70 18                       .
        adc     #$0A                            ; AF71 69 0A                    i.
        sta     $0770                           ; AF73 8D 70 07                 .p.
        lda     $0772,x                         ; AF76 BD 72 07                 .r.
        cmp     epyx_jumpman,x                  ; AF79 DD AF AE                 ...
        beq     bonus_250_pts                   ; AF7C F0 18                    ..
        lda     #$00                            ; AF7E A9 00                    ..
        sta     $0681                           ; AF80 8D 81 06                 ...
        jmp     ltr_skip                        ; AF83 4C 92 AF                 L..

; ----------------------------------------------------------------------------
; wait approx 1/3 second so user can see what happened
ltr_delay:
        lda     #$00                            ; AF86 A9 00                    ..
        sta     jiffy_timer_1                   ; AF88 8D 1A 06                 ...
ltr_wait:
        lda     jiffy_timer_1                   ; AF8B AD 1A 06                 ...
        cmp     #$20                            ; AF8E C9 20                    . 
        bne     ltr_wait                        ; AF90 D0 F9                    ..
ltr_skip:
        dex                                     ; AF92 CA                       .
        bne     ltr_loop                        ; AF93 D0 D8                    ..
        rts                                     ; AF95 60                       `

; ----------------------------------------------------------------------------
; per letter
bonus_250_pts:
        lda     $0770                           ; AF96 AD 70 07                 .p.
        sta     $0686                           ; AF99 8D 86 06                 ...
        lda     #$86                            ; AF9C A9 86                    ..
        sta     $0681                           ; AF9E 8D 81 06                 ...
        clc                                     ; AFA1 18                       .
        lda     score                           ; AFA2 AD 00 07                 ...
        adc     #$FA                            ; AFA5 69 FA                    i.
        sta     score                           ; AFA7 8D 00 07                 ...
        bcc     b250_hi_ok                      ; AFAA 90 08                    ..
        inc     score+1                         ; AFAC EE 01 07                 ...
        bne     b250_hi_ok                      ; AFAF D0 03                    ..
        inc     score+2                         ; AFB1 EE 02 07                 ...
b250_hi_ok:
        txa                                     ; AFB4 8A                       .
        pha                                     ; AFB5 48                       H
        jsr     check_extra_life_jv             ; AFB6 20 0C 80                  ..
; play sfx_letter_bonus
cue_letter_sfx:
        lda     #$CB                            ; AFB9 A9 CB                    ..
        sta     sfx_ptr                         ; AFBB 8D 3C 06                 .<.
        lda     #$AF                            ; AFBE A9 AF                    ..
        sta     sfx_ptr+1                       ; AFC0 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; AFC3 20 06 80                  ..
        pla                                     ; AFC6 68                       h
        tax                                     ; AFC7 AA                       .
        jmp     ltr_delay                       ; AFC8 4C 86 AF                 L..

; ----------------------------------------------------------------------------
; played once per correct letter at end of level08 (spellbound). trailing 00's are filler.
sfx_letter_bonus:
        .byte   $01,$A5,$00,$18,$04,$F3,$04,$00 ; AFCB 01 A5 00 18 04 F3 04 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AFD3 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AFDB 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AFE3 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AFEB 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; AFF3 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00             ; AFFB 00 00 00 00 00           .....
; blackout doesn't draw the map initially
l09_real_map:
        .byte   $FE,$33,$9C,$FD,$04,$00,$04,$07 ; B000 FE 33 9C FD 04 00 04 07  .3......
        .byte   $06,$24,$07,$02,$6C,$05,$04,$8C ; B008 06 24 07 02 6C 05 04 8C  .$..l...
        .byte   $05,$04,$28,$18,$04,$48,$15,$06 ; B010 05 04 28 18 04 48 15 06  ..(..H..
        .byte   $7C,$15,$04,$20,$25,$07,$68,$25 ; B018 7C 15 04 20 25 07 68 25  |.. %.h%
        .byte   $04,$04,$3B,$05,$28,$3B,$01,$34 ; B020 04 04 3B 05 28 3B 01 34  ..;.(;.4
        .byte   $3B,$04,$5C,$45,$08,$8C,$4B,$02 ; B028 3B 04 5C 45 08 8C 4B 02  ;.\E..K.
        .byte   $04,$55,$06,$38,$4D,$04,$04,$55 ; B030 04 55 06 38 4D 04 04 55  .U.8M..U
        .byte   $06,$54,$55,$12,$FD,$04,$FF,$58 ; B038 06 54 55 12 FD 04 FF 58  .TU....X
        .byte   $0A,$05,$1C,$54,$07,$FD,$04,$01 ; B040 0A 05 1C 54 07 FD 04 01  ...T....
        .byte   $2C,$08,$06,$3C,$26,$04,$FE,$5F ; B048 2C 08 06 3C 26 04 FE 5F  ,..<&.._
        .byte   $9C,$FD,$00,$04,$0C,$03,$0E,$3C ; B050 9C FD 00 04 0C 03 0E 3C  .......<
        .byte   $37,$05,$8C,$35,$05,$FE,$C9,$9C ; B058 37 05 8C 35 05 FE C9 9C  7..5....
        .byte   $1A,$0A,$06,$5E,$18,$09,$9A,$08 ; B060 1A 0A 06 5E 18 09 9A 08  ...^....
        .byte   $0B,$FE,$DA,$9C,$83,$04,$13,$FE ; B068 0B FE DA 9C 83 04 13 FE  ........
        .byte   $49,$9C                         ; B070 49 9C                    I.
l09_map_bombs:
        .byte   $04,$02,$01,$24,$02,$01,$44,$02 ; B072 04 02 01 24 02 01 44 02  ...$..D.
        .byte   $01,$78,$02,$01,$98,$02,$01,$3C ; B07A 01 78 02 01 98 02 01 3C  .x.....<
        .byte   $12,$01,$5C,$12,$01,$7C,$12,$01 ; B082 12 01 5C 12 01 7C 12 01  ..\..|..
        .byte   $24,$22,$01,$78,$22,$01,$04,$38 ; B08A 24 22 01 78 22 01 04 38  $".x"..8
        .byte   $01,$1C,$46,$01,$78,$42,$01,$04 ; B092 01 1C 46 01 78 42 01 04  ..F.xB..
        .byte   $52,$01,$58,$52,$01,$98,$52,$01 ; B09A 52 01 58 52 01 98 52 01  R.XR..R.
; blackout doesn't draw the map initially
l09_map:.byte   $FF                             ; B0A2 FF                       .
l09_bombs:
        .byte   $22,$00,$42,$00,$62,$00,$A2,$00 ; B0A3 22 00 42 00 62 00 A2 00  ".B.b...
        .byte   $C2,$00,$64,$00,$84,$00,$A4,$00 ; B0AB C2 00 64 00 84 00 A4 00  ..d.....
        .byte   $46,$00,$A6,$00,$28,$00,$4A,$00 ; B0B3 46 00 A6 00 28 00 4A 00  F...(.J.
        .byte   $AA,$00,$2C,$00,$8C,$00,$CC,$00 ; B0BB AA 00 2C 00 8C 00 CC 00  ..,.....
l09_bombs_term:
        .byte   $FF                             ; B0C3 FF                       .
; ----------------------------------------------------------------------------
; sets screen memory to $1000 and draws l09_real_map there. bombs are handled specially as they're blanks in the map.
blackout_init:
        jsr     special_init_jv                 ; B0C4 20 36 80                  6.
        lda     #$10                            ; B0C7 A9 10                    ..
        sta     SAVMSC+1                        ; B0C9 85 59                    .Y
        jsr     clear_screen_mem_jv             ; B0CB 20 1E 80                  ..
        lda     #$00                            ; B0CE A9 00                    ..
        sta     dm_progctr                      ; B0D0 85 C0                    ..
        lda     #$B0                            ; B0D2 A9 B0                    ..
        sta     dm_progctr+1                    ; B0D4 85 C1                    ..
        jsr     draw_map_jv                     ; B0D6 20 00 80                  ..
        ldx     #$07                            ; B0D9 A2 07                    ..
LB0DB:  lda     map_one_bomb_minus_one,x        ; B0DB BD 19 B1                 ...
        sta     $08FF,x                         ; B0DE 9D FF 08                 ...
        dex                                     ; B0E1 CA                       .
        bne     LB0DB                           ; B0E2 D0 F7                    ..
        lda     #$08                            ; B0E4 A9 08                    ..
        sta     $AA                             ; B0E6 85 AA                    ..
LB0E8:  lda     RANDOM                          ; B0E8 AD 0A D2                 ...
        and     #$0F                            ; B0EB 29 0F                    ).
        sta     $AB                             ; B0ED 85 AB                    ..
        tax                                     ; B0EF AA                       .
        lda     $0770,x                         ; B0F0 BD 70 07                 .p.
        bne     LB0E8                           ; B0F3 D0 F3                    ..
        inc     $0770,x                         ; B0F5 FE 70 07                 .p.
        txa                                     ; B0F8 8A                       .
        asl     a                               ; B0F9 0A                       .
        clc                                     ; B0FA 18                       .
        adc     $AB                             ; B0FB 65 AB                    e.
        tay                                     ; B0FD A8                       .
        lda     l09_map_bombs,y                 ; B0FE B9 72 B0                 .r.
        sta     $0903                           ; B101 8D 03 09                 ...
        lda     l09_map_bombs+1,y               ; B104 B9 73 B0                 .s.
        sta     $0904                           ; B107 8D 04 09                 ...
        lda     #$00                            ; B10A A9 00                    ..
        sta     dm_progctr                      ; B10C 85 C0                    ..
        lda     #$09                            ; B10E A9 09                    ..
        sta     dm_progctr+1                    ; B110 85 C1                    ..
        jsr     draw_map_jv                     ; B112 20 00 80                  ..
        dec     $AA                             ; B115 C6 AA                    ..
        bne     LB0E8                           ; B117 D0 CF                    ..
; 1-indexed
map_one_bomb_minus_one:
        rts                                     ; B119 60                       `

; ----------------------------------------------------------------------------
; used by blackout, copied to RAM and modified ($00's replaced with actual X and Y coords of bomb)
map_one_bomb:
        .byte   $FE,$B3,$9C,$00,$00,$01,$FF     ; B11A FE B3 9C 00 00 01 FF     .......
; ----------------------------------------------------------------------------
; make sure the user sees the bomb he's just picked up (?). at least 1 pixel of it already has to be visible, for collision detection to work.
blackout_bomb_sub:
        lda     #$10                            ; B121 A9 10                    ..
        sta     SAVMSC+1                        ; B123 85 59                    .Y
        lda     #$D9                            ; B125 A9 D9                    ..
        sta     dm_progctr                      ; B127 85 C0                    ..
        lda     #$06                            ; B129 A9 06                    ..
        sta     dm_progctr+1                    ; B12B 85 C1                    ..
        jsr     draw_map_jv                     ; B12D 20 00 80                  ..
        lda     #$30                            ; B130 A9 30                    .0
        sta     SAVMSC+1                        ; B132 85 59                    .Y
        lda     #$D9                            ; B134 A9 D9                    ..
        sta     dm_progctr                      ; B136 85 C0                    ..
        jsr     draw_map_jv                     ; B138 20 00 80                  ..
        lda     #$D9                            ; B13B A9 D9                    ..
        sta     dm_progctr                      ; B13D 85 C0                    ..
        rts                                     ; B13F 60                       `

; ----------------------------------------------------------------------------
; copies pixels from rendered real map at $1000 to visible screen memory at $3000, centered around jumpman's location
blackout_sub0:
        lda     falling_flag                    ; B140 AD 21 06                 .!.
        bne     LB146                           ; B143 D0 01                    ..
LB145:  rts                                     ; B145 60                       `

; ----------------------------------------------------------------------------
LB146:  lda     player_x_pos                    ; B146 AD 7E 06                 .~.
        cmp     #$34                            ; B149 C9 34                    .4
        bcc     LB145                           ; B14B 90 F8                    ..
        cmp     #$C9                            ; B14D C9 C9                    ..
        bcs     LB145                           ; B14F B0 F4                    ..
        lda     #$0B                            ; B151 A9 0B                    ..
        sta     $97                             ; B153 85 97                    ..
        lda     player_x_pos                    ; B155 AD 7E 06                 .~.
        sec                                     ; B158 38                       8
        sbc     #$33                            ; B159 E9 33                    .3
        lsr     a                               ; B15B 4A                       J
        lsr     a                               ; B15C 4A                       J
        sta     $91                             ; B15D 85 91                    ..
        lda     player_y_pos                    ; B15F AD 83 06                 ...
        cmp     #$C3                            ; B162 C9 C3                    ..
        bcs     LB145                           ; B164 B0 DF                    ..
        jsr     LB1D2                           ; B166 20 D2 B1                  ..
        sec                                     ; B169 38                       8
        sbc     #$26                            ; B16A E9 26                    .&
        lsr     a                               ; B16C 4A                       J
        sta     $92                             ; B16D 85 92                    ..
        lda     #$28                            ; B16F A9 28                    .(
        sta     $90                             ; B171 85 90                    ..
        lda     #$00                            ; B173 A9 00                    ..
        sta     $93                             ; B175 85 93                    ..
        ldx     #$08                            ; B177 A2 08                    ..
LB179:  lsr     $90                             ; B179 46 90                    F.
        bcc     LB180                           ; B17B 90 03                    ..
        clc                                     ; B17D 18                       .
        adc     $92                             ; B17E 65 92                    e.
LB180:  ror     a                               ; B180 6A                       j
        ror     $93                             ; B181 66 93                    f.
        dex                                     ; B183 CA                       .
        bne     LB179                           ; B184 D0 F3                    ..
        sta     $94                             ; B186 85 94                    ..
        clc                                     ; B188 18                       .
        lda     $93                             ; B189 A5 93                    ..
        adc     $91                             ; B18B 65 91                    e.
        sta     $93                             ; B18D 85 93                    ..
        sta     $95                             ; B18F 85 95                    ..
        lda     $94                             ; B191 A5 94                    ..
        adc     #$10                            ; B193 69 10                    i.
        sta     $94                             ; B195 85 94                    ..
        clc                                     ; B197 18                       .
        lda     $94                             ; B198 A5 94                    ..
        adc     #$20                            ; B19A 69 20                    i 
        sta     $96                             ; B19C 85 96                    ..
LB19E:  ldx     #$04                            ; B19E A2 04                    ..
        ldy     #$00                            ; B1A0 A0 00                    ..
LB1A2:  lda     ($93),y                         ; B1A2 B1 93                    ..
        sta     ($95),y                         ; B1A4 91 95                    ..
        iny                                     ; B1A6 C8                       .
        dex                                     ; B1A7 CA                       .
        bne     LB1A2                           ; B1A8 D0 F8                    ..
        clc                                     ; B1AA 18                       .
        lda     $93                             ; B1AB A5 93                    ..
        adc     #$28                            ; B1AD 69 28                    i(
        sta     $93                             ; B1AF 85 93                    ..
        bcc     LB1B5                           ; B1B1 90 02                    ..
        inc     $94                             ; B1B3 E6 94                    ..
LB1B5:  clc                                     ; B1B5 18                       .
        lda     $95                             ; B1B6 A5 95                    ..
        adc     #$28                            ; B1B8 69 28                    i(
        sta     $95                             ; B1BA 85 95                    ..
        bcc     LB1C0                           ; B1BC 90 02                    ..
        inc     $96                             ; B1BE E6 96                    ..
LB1C0:  lda     $93                             ; B1C0 A5 93                    ..
        cmp     #$C0                            ; B1C2 C9 C0                    ..
        bne     LB1CD                           ; B1C4 D0 07                    ..
        lda     $94                             ; B1C6 A5 94                    ..
        cmp     #$1D                            ; B1C8 C9 1D                    ..
        bne     LB1CD                           ; B1CA D0 01                    ..
        rts                                     ; B1CC 60                       `

; ----------------------------------------------------------------------------
LB1CD:  dec     $97                             ; B1CD C6 97                    ..
        bne     LB19E                           ; B1CF D0 CD                    ..
        rts                                     ; B1D1 60                       `

; ----------------------------------------------------------------------------
LB1D2:  cmp     #$26                            ; B1D2 C9 26                    .&
        bcs     LB1DE                           ; B1D4 B0 08                    ..
        clc                                     ; B1D6 18                       .
        adc     #$02                            ; B1D7 69 02                    i.
        dec     $97                             ; B1D9 C6 97                    ..
        jmp     LB1D2                           ; B1DB 4C D2 B1                 L..

; ----------------------------------------------------------------------------
LB1DE:  rts                                     ; B1DE 60                       `

; ----------------------------------------------------------------------------
zero_filler_b1df:
        .byte   $00                             ; B1DF 00                       .
l10_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; B1E0 FE 33 9C FD 04 00 04 05  .3......
        .byte   $06,$38,$05,$08,$7C,$05,$06,$24 ; B1E8 06 38 05 08 7C 05 06 24  .8..|..$
        .byte   $15,$06,$64,$15,$0E,$04,$2D,$06 ; B1F0 15 06 64 15 0E 04 2D 06  ..d...-.
        .byte   $38,$35,$0C,$04,$45,$06,$30,$45 ; B1F8 38 35 0C 04 45 06 30 45  85..E.0E
        .byte   $08,$88,$3C,$05,$04,$55,$08,$38 ; B200 08 88 3C 05 04 55 08 38  ..<..U.8
        .byte   $55,$06,$68,$55,$0D,$FD,$04,$01 ; B208 55 06 68 55 0D FD 04 01  U.hU....
        .byte   $1C,$2E,$07,$FD,$04,$FF,$64,$45 ; B210 1C 2E 07 FD 04 FF 64 45  ......dE
        .byte   $09,$FE,$5F,$9C,$FD,$00,$04,$0C ; B218 09 FE 5F 9C FD 00 04 0C  .._.....
        .byte   $01,$0B,$0C,$41,$05,$40,$01,$05 ; B220 01 0B 0C 41 05 40 01 05  ...A.@..
        .byte   $40,$31,$05,$8C,$01,$15,$FE,$DA ; B228 40 31 05 8C 01 15 FE DA  @1......
        .byte   $9C,$66,$30,$04,$FE,$B3,$9C     ; B230 9C 66 30 04 FE B3 9C     .f0....
l10_map_bombs:
        .byte   $04,$02,$01,$38,$02,$01,$7C,$02 ; B237 04 02 01 38 02 01 7C 02  ...8..|.
        .byte   $01,$38,$12,$01,$64,$12,$01,$98 ; B23F 01 38 12 01 64 12 01 98  .8..d...
        .byte   $12,$01,$04,$22,$01,$98,$39,$01 ; B247 12 01 04 22 01 98 39 01  ..."..9.
        .byte   $58,$47,$01,$04,$52,$01,$38,$52 ; B24F 58 47 01 04 52 01 38 52  XG..R.8R
        .byte   $01,$98,$52,$01,$FF             ; B257 01 98 52 01 FF           ..R..
l10_bombs:
        .byte   $22,$00,$62,$00,$A2,$00,$64,$00 ; B25C 22 00 62 00 A2 00 64 00  ".b...d.
        .byte   $84,$00,$C4,$00,$26,$00,$C8,$00 ; B264 84 00 C4 00 26 00 C8 00  ....&...
        .byte   $8A,$00,$2C,$00,$6C,$00,$CC,$00 ; B26C 8A 00 2C 00 6C 00 CC 00  ..,.l...
l10_bombs_term:
        .byte   $FF                             ; B274 FF                       .
l10_unkn0:
        .byte   $03,$A8,$B2,$0A,$A4,$20,$01,$56 ; B275 03 A8 B2 0A A4 20 01 56  ..... .V
        .byte   $FF                             ; B27D FF                       .
; ----------------------------------------------------------------------------
herethere_sub0:
        lda     $06F5                           ; B27E AD F5 06                 ...
        sta     $066C                           ; B281 8D 6C 06                 .l.
        bne     LB287                           ; B284 D0 01                    ..
        rts                                     ; B286 60                       `

; ----------------------------------------------------------------------------
LB287:  inc     bullet_y_delta+2                ; B287 EE 60 07                 .`.
        lda     bullet_y_delta+2                ; B28A AD 60 07                 .`.
        and     #$7F                            ; B28D 29 7F                    ).
        beq     LB292                           ; B28F F0 01                    ..
        rts                                     ; B291 60                       `

; ----------------------------------------------------------------------------
LB292:  inc     bullet_y_delta+3                ; B292 EE 61 07                 .a.
        lda     bullet_y_delta+3                ; B295 AD 61 07                 .a.
        and     #$07                            ; B298 29 07                    ).
        tax                                     ; B29A AA                       .
        lda     portal_x,x                      ; B29B BD D0 B2                 ...
        sta     $0680                           ; B29E 8D 80 06                 ...
        lda     portal_y,x                      ; B2A1 BD D8 B2                 ...
        sta     $0685                           ; B2A4 8D 85 06                 ...
        rts                                     ; B2A7 60                       `

; ----------------------------------------------------------------------------
; portal animation frames
herethere_sprite0:
        .byte   $00,$00,$00,$18,$18,$18,$18,$00 ; B2A8 00 00 00 18 18 18 18 00  ........
        .byte   $00,$00                         ; B2B0 00 00                    ..
herethere_sprite1:
        .byte   $00,$00,$3C,$24,$24,$24,$24,$3C ; B2B2 00 00 3C 24 24 24 24 3C  ..<$$$$<
        .byte   $00,$00                         ; B2BA 00 00                    ..
herethere_sprite2:
        .byte   $00,$7E,$42,$42,$42,$42,$42,$42 ; B2BC 00 7E 42 42 42 42 42 42  .~BBBBBB
        .byte   $7E,$00                         ; B2C4 7E 00                    ~.
herethere_sprite3:
        .byte   $FF,$81,$81,$81,$81,$81,$81,$81 ; B2C6 FF 81 81 81 81 81 81 81  ........
        .byte   $81,$FF                         ; B2CE 81 FF                    ..
; herethere portal X positions
portal_x:
        .byte   $A4,$4C,$52,$70,$86,$86,$A4,$82 ; B2D0 A4 4C 52 70 86 86 A4 82  .LRp....
; herethere portal Y positions
portal_y:
        .byte   $20,$20,$98,$C0,$B4,$80,$68,$40 ; B2D8 20 20 98 C0 B4 80 68 40    ....h@
; ----------------------------------------------------------------------------
herethere_sub3:
        lda     jiffy_timer_3_lo                ; B2E0 AD 19 06                 ...
        and     #$0F                            ; B2E3 29 0F                    ).
        bne     LB2F2                           ; B2E5 D0 0B                    ..
        lda     $068A                           ; B2E7 AD 8A 06                 ...
        and     #$03                            ; B2EA 29 03                    ).
        sta     $068A                           ; B2EC 8D 8A 06                 ...
        inc     $068A                           ; B2EF EE 8A 06                 ...
LB2F2:  lda     $062A                           ; B2F2 AD 2A 06                 .*.
        sta     PCOLR2                          ; B2F5 8D C2 02                 ...
        lda     #$00                            ; B2F8 A9 00                    ..
        jmp     check_pl_coll_no_pl             ; B2FA 4C 79 8F                 Ly.

; ----------------------------------------------------------------------------
herethere_bomb_sub:
        lda     $0680                           ; B2FD AD 80 06                 ...
        sta     player_x_pos                    ; B300 8D 7E 06                 .~.
        lda     $0685                           ; B303 AD 85 06                 ...
        sta     player_y_pos                    ; B306 8D 83 06                 ...
        lda     #$19                            ; B309 A9 19                    ..
        sta     sfx_ptr                         ; B30B 8D 3C 06                 .<.
        lda     #$B3                            ; B30E A9 B3                    ..
        sta     sfx_ptr+1                       ; B310 8D 3D 06                 .=.
        lda     #$07                            ; B313 A9 07                    ..
        jsr     cue_sfx_jv                      ; B315 20 06 80                  ..
        rts                                     ; B318 60                       `

; ----------------------------------------------------------------------------
; referenced by herethere_bomb_sub
sxf_teleport:
        .byte   $01,$86,$00,$0A,$20,$00,$00     ; B319 01 86 00 0A 20 00 00     .... ..
l11_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; B320 FE 33 9C FD 04 00 04 05  .3......
        .byte   $08,$2C,$07,$15,$84,$05,$06,$1C ; B328 08 2C 07 15 84 05 06 1C  .,......
        .byte   $15,$03,$48,$15,$0D,$04,$25,$07 ; B330 15 03 48 15 0D 04 25 07  ..H...%.
        .byte   $30,$2F,$0D,$04,$35,$06,$74,$35 ; B338 30 2F 0D 04 35 06 74 35  0/..5.t5
        .byte   $0A,$04,$45,$06,$04,$55,$06,$28 ; B340 0A 04 45 06 04 55 06 28  ..E..U.(
        .byte   $55,$06,$4C,$55,$06,$84,$50,$06 ; B348 55 06 4C 55 06 84 50 06  U.LU..P.
        .byte   $FD,$04,$FF,$1C,$34,$05,$70,$55 ; B350 FD 04 FF 1C 34 05 70 55  ....4.pU
        .byte   $05,$80,$06,$02,$FD,$04,$01,$24 ; B358 05 80 06 02 FD 04 01 24  .......$
        .byte   $06,$02,$FE,$5F,$9C,$FD,$00,$04 ; B360 06 02 FE 5F 9C FD 00 04  ..._....
        .byte   $0C,$01,$09,$0C,$41,$05,$30,$03 ; B368 0C 01 09 0C 41 05 30 03  ....A.0.
        .byte   $0B,$54,$2B,$0A,$8C,$01,$0D,$FE ; B370 0B 54 2B 0A 8C 01 0D FE  .T+.....
        .byte   $C9,$9C,$04,$38,$02,$1A,$38,$02 ; B378 C9 9C 04 38 02 1A 38 02  ...8..8.
        .byte   $33,$32,$07,$74,$38,$05,$FE,$DA ; B380 33 32 07 74 38 05 FE DA  32.t8...
        .byte   $9C,$6A,$12,$0F,$FE,$B3,$9C     ; B388 9C 6A 12 0F FE B3 9C     .j.....
l11_map_bombs:
        .byte   $04,$02,$01,$3A,$02,$01,$5A,$02 ; B38F 04 02 01 3A 02 01 5A 02  ...:..Z.
        .byte   $01,$7A,$02,$01,$98,$02,$01,$20 ; B397 01 7A 02 01 98 02 01 20  .z..... 
        .byte   $12,$01,$5A,$12,$01,$04,$22,$01 ; B39F 12 01 5A 12 01 04 22 01  ..Z...".
        .byte   $3A,$22,$01,$04,$32,$01,$78,$32 ; B3A7 3A 22 01 04 32 01 78 32  :"..2.x2
        .byte   $01,$98,$32,$01,$04,$52,$01,$38 ; B3AF 01 98 32 01 04 52 01 38  ..2..R.8
        .byte   $52,$01,$60,$52,$01,$FF         ; B3B7 52 01 60 52 01 FF        R.`R..
l11_bombs:
        .byte   $22,$10,$62,$20,$82,$30,$A2,$40 ; B3BD 22 10 62 20 82 30 A2 40  ".b .0.@
        .byte   $C2,$50,$44,$60,$84,$70,$26,$80 ; B3C5 C2 50 44 60 84 70 26 80  .PD`.p&.
        .byte   $66,$90,$28,$A0,$A8,$B0,$C8,$C0 ; B3CD 66 90 28 A0 A8 B0 C8 C0  f.(.....
        .byte   $2C,$D0,$6C,$E0,$8C,$F0         ; B3D5 2C D0 6C E0 8C F0        ,.l...
l11_bombs_term:
        .byte   $FF                             ; B3DB FF                       .
l11_map_changes:
        .byte   $00,$00,$FC,$B3,$06,$B4,$10,$B4 ; B3DC 00 00 FC B3 06 B4 10 B4  ........
        .byte   $06,$B4,$10,$B4,$1A,$B4,$24,$B4 ; B3E4 06 B4 10 B4 1A B4 24 B4  ......$.
        .byte   $2E,$B4,$38,$B4,$2E,$B4,$38,$B4 ; B3EC 2E B4 38 B4 2E B4 38 B4  ..8...8.
        .byte   $FC,$B3,$24,$B4,$1A,$B4,$42,$B4 ; B3F4 FC B3 24 B4 1A B4 42 B4  ..$...B.
        .byte   $FE,$49,$9C,$FD,$04,$00,$48,$15 ; B3FC FE 49 9C FD 04 00 48 15  .I....H.
        .byte   $03,$FF,$FE,$49,$9C,$FD,$04,$00 ; B404 03 FF FE 49 9C FD 04 00  ...I....
        .byte   $46,$07,$03,$FF,$FE,$49,$9C,$FD ; B40C 46 07 03 FF FE 49 9C FD  F....I..
        .byte   $04,$00,$6A,$07,$03,$FF,$FE,$49 ; B414 04 00 6A 07 03 FF FE 49  ..j....I
        .byte   $9C,$FD,$04,$00,$0A,$35,$03,$FF ; B41C 9C FD 04 00 0A 35 03 FF  .....5..
        .byte   $FE,$49,$9C,$FD,$04,$00,$3E,$2F ; B424 FE 49 9C FD 04 00 3E 2F  .I....>/
        .byte   $04,$FF,$FE,$49,$9C,$FD,$04,$00 ; B42C 04 FF FE 49 9C FD 04 00  ...I....
        .byte   $7C,$35,$04,$FF,$FE,$89,$9C,$FD ; B434 7C 35 04 FF FE 89 9C FD  |5......
        .byte   $00,$04,$54,$3F,$04,$FF,$FE,$89 ; B43C 00 04 54 3F 04 FF FE 89  ..T?....
        .byte   $9C,$FD,$00,$04,$8C,$1D,$04,$FF ; B444 9C FD 00 04 8C 1D 04 FF  ........
; ----------------------------------------------------------------------------
hatch_bomb_sub:
        lda     #$01                            ; B44C A9 01                    ..
        sta     $0770                           ; B44E 8D 70 07                 .p.
        lda     #$00                            ; B451 A9 00                    ..
        sta     $0771                           ; B453 8D 71 07                 .q.
        rts                                     ; B456 60                       `

; ----------------------------------------------------------------------------
hatch_sub0:
        lda     $0623                           ; B457 AD 23 06                 .#.
        cmp     #$02                            ; B45A C9 02                    ..
        bne     LB46A                           ; B45C D0 0C                    ..
        lda     #$00                            ; B45E A9 00                    ..
        sta     $0770                           ; B460 8D 70 07                 .p.
        sta     $0771                           ; B463 8D 71 07                 .q.
        sta     $0681                           ; B466 8D 81 06                 ...
        rts                                     ; B469 60                       `

; ----------------------------------------------------------------------------
LB46A:  lda     $0622                           ; B46A AD 22 06                 .".
        bne     LB470                           ; B46D D0 01                    ..
LB46F:  rts                                     ; B46F 60                       `

; ----------------------------------------------------------------------------
LB470:  lda     $0770                           ; B470 AD 70 07                 .p.
        beq     LB46F                           ; B473 F0 FA                    ..
        cmp     #$09                            ; B475 C9 09                    ..
        beq     LB49F                           ; B477 F0 26                    .&
        sta     $066C                           ; B479 8D 6C 06                 .l.
        sta     $068A                           ; B47C 8D 8A 06                 ...
        inc     $0770                           ; B47F EE 70 07                 .p.
        lda     $06DC                           ; B482 AD DC 06                 ...
        clc                                     ; B485 18                       .
        adc     #$30                            ; B486 69 30                    i0
        sta     $0680                           ; B488 8D 80 06                 ...
        lda     $06DD                           ; B48B AD DD 06                 ...
        asl     a                               ; B48E 0A                       .
        clc                                     ; B48F 18                       .
        adc     #$20                            ; B490 69 20                    i 
        sta     $0685                           ; B492 8D 85 06                 ...
        lda     $0770                           ; B495 AD 70 07                 .p.
        cmp     #$09                            ; B498 C9 09                    ..
        bcc     LB46F                           ; B49A 90 D3                    ..
        inc     $0771                           ; B49C EE 71 07                 .q.
LB49F:  lda     $0771                           ; B49F AD 71 07                 .q.
        beq     LB46F                           ; B4A2 F0 CB                    ..
        cmp     #$05                            ; B4A4 C9 05                    ..
        beq     LB4C1                           ; B4A6 F0 19                    ..
        clc                                     ; B4A8 18                       .
        adc     #$04                            ; B4A9 69 04                    i.
        sta     $068B                           ; B4AB 8D 8B 06                 ...
        inc     $0771                           ; B4AE EE 71 07                 .q.
        lda     $0680                           ; B4B1 AD 80 06                 ...
        sta     $0681                           ; B4B4 8D 81 06                 ...
        lda     $0685                           ; B4B7 AD 85 06                 ...
        sta     $0686                           ; B4BA 8D 86 06                 ...
        sta     $066D                           ; B4BD 8D 6D 06                 .m.
        rts                                     ; B4C0 60                       `

; ----------------------------------------------------------------------------
LB4C1:  lda     $068B                           ; B4C1 AD 8B 06                 ...
        and     #$03                            ; B4C4 29 03                    ).
        clc                                     ; B4C6 18                       .
        adc     #$04                            ; B4C7 69 04                    i.
        sta     $068B                           ; B4C9 8D 8B 06                 ...
        inc     $068B                           ; B4CC EE 8B 06                 ...
        cmp     #$07                            ; B4CF C9 07                    ..
        bne     LB4E2                           ; B4D1 D0 0F                    ..
cue_woop_sound:
        lda     #$64                            ; B4D3 A9 64                    .d
        sta     sfx_slot_priority               ; B4D5 8D 3E 06                 .>.
        lda     #$B5                            ; B4D8 A9 B5                    ..
        sta     sfx_slot_timer                  ; B4DA 8D 3F 06                 .?.
        lda     #$03                            ; B4DD A9 03                    ..
        jsr     cue_sfx_lowprior_jv             ; B4DF 20 03 80                  ..
LB4E2:  ldy     #$01                            ; B4E2 A0 01                    ..
        lda     $0681                           ; B4E4 AD 81 06                 ...
        cmp     player_x_pos                    ; B4E7 CD 7E 06                 .~.
        bcc     LB4EE                           ; B4EA 90 02                    ..
        ldy     #$FF                            ; B4EC A0 FF                    ..
LB4EE:  sty     $A0                             ; B4EE 84 A0                    ..
        clc                                     ; B4F0 18                       .
        adc     $A0                             ; B4F1 65 A0                    e.
        sta     $0681                           ; B4F3 8D 81 06                 ...
        ldy     #$01                            ; B4F6 A0 01                    ..
        lda     $0686                           ; B4F8 AD 86 06                 ...
        cmp     player_y_pos                    ; B4FB CD 83 06                 ...
        bcc     LB502                           ; B4FE 90 02                    ..
        ldy     #$FF                            ; B500 A0 FF                    ..
LB502:  sty     $A0                             ; B502 84 A0                    ..
        clc                                     ; B504 18                       .
        adc     $A0                             ; B505 65 A0                    e.
        sta     $0686                           ; B507 8D 86 06                 ...
        rts                                     ; B50A 60                       `

; ----------------------------------------------------------------------------
; dunno what this is for yet
hatch_table_b50b:
        .byte   $03,$1C,$B5,$08,$00,$00,$01,$56 ; B50B 03 1C B5 08 00 00 01 56  .......V
        .byte   $04,$1C,$B5,$08,$00,$00,$05,$1A ; B513 04 1C B5 08 00 00 05 1A  ........
        .byte   $FF,$00,$00,$18,$18,$24,$24,$18 ; B51B FF 00 00 18 18 24 24 18  .....$$.
        .byte   $18,$00,$00,$42,$42,$42,$24,$18 ; B523 18 00 00 42 42 42 24 18  ...BBB$.
        .byte   $18,$00,$00,$00,$00,$66,$A5,$18 ; B52B 18 00 00 00 00 66 A5 18  .....f..
        .byte   $18,$00,$00,$00,$00,$00,$00,$3C ; B533 18 00 00 00 00 00 00 3C  .......<
        .byte   $DB,$00,$00,$24,$18,$18,$24,$00 ; B53B DB 00 00 24 18 18 24 00  ...$..$.
        .byte   $00,$00,$08,$24,$58,$1A,$24,$10 ; B543 00 00 08 24 58 1A 24 10  ...$X.$.
        .byte   $00,$81,$42,$24,$18,$18,$24,$42 ; B54B 00 81 42 24 18 18 24 42  ..B$..$B
        .byte   $81,$04,$42,$A4,$18,$18,$25,$42 ; B553 81 04 42 A4 18 18 25 42  ..B...%B
        .byte   $20,$00,$00,$18,$18,$24,$24,$18 ; B55B 20 00 00 18 18 24 24 18   ....$$.
        .byte   $18                             ; B563 18                       .
sfx_woop:
        .byte   $01,$A2,$00,$F0,$01,$01,$A4,$00 ; B564 01 A2 00 F0 01 01 A4 00  ........
        .byte   $DC,$01,$01,$A6,$00,$C8,$02,$01 ; B56C DC 01 01 A6 00 C8 02 01  ........
        .byte   $A4,$DC,$01,$01,$A2,$F0,$01,$00 ; B574 A4 DC 01 01 A2 F0 01 00  ........
; ----------------------------------------------------------------------------
hatch_sub3:
        lda     #$00                            ; B57C A9 00                    ..
        jmp     check_pl_coll_no_p2             ; B57E 4C 76 8F                 Lv.

; ----------------------------------------------------------------------------
hatch_sub1:
        lda     $062A                           ; B581 AD 2A 06                 .*.
        sta     PCOLR3                          ; B584 8D C3 02                 ...
        rts                                     ; B587 60                       `

; ----------------------------------------------------------------------------
zero_filler_8588:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B588 00 00 00 00 00 00 00 00  ........
l12_map:.byte   $FE,$33,$9C,$FD,$04,$00,$04,$05 ; B590 FE 33 9C FD 04 00 04 05  .3......
        .byte   $08,$3C,$05,$0A,$7C,$05,$08,$04 ; B598 08 3C 05 0A 7C 05 08 04  .<..|...
        .byte   $25,$26,$04,$43,$26,$04,$55,$06 ; B5A0 25 26 04 43 26 04 55 06  %&.C&.U.
        .byte   $3C,$55,$0A,$84,$55,$06,$04,$43 ; B5A8 3C 55 0A 84 55 06 04 43  <U..U..C
        .byte   $06,$FE,$5F,$9C,$FD,$00,$04,$0C ; B5B0 06 FE 5F 9C FD 00 04 0C  .._.....
        .byte   $01,$09,$4C,$01,$09,$8C,$01,$09 ; B5B8 01 09 4C 01 09 8C 01 09  ..L.....
        .byte   $2A,$1F,$09,$6A,$1F,$09,$0C,$3F ; B5C0 2A 1F 09 6A 1F 09 0C 3F  *..j...?
        .byte   $05,$4C,$3F,$05,$8C,$3F,$05,$FE ; B5C8 05 4C 3F 05 8C 3F 05 FE  .L?..?..
        .byte   $B3,$9C                         ; B5D0 B3 9C                    ..
l12_map_bombs:
        .byte   $04,$02,$01,$20,$02,$01,$3C,$02 ; B5D2 04 02 01 20 02 01 3C 02  ... ..<.
        .byte   $01,$60,$02,$01,$7C,$02,$01,$98 ; B5DA 01 60 02 01 7C 02 01 98  .`..|...
        .byte   $02,$01,$04,$22,$01,$98,$22,$01 ; B5E2 02 01 04 22 01 98 22 01  ..."..".
        .byte   $3C,$36,$01,$60,$36,$01,$04,$52 ; B5EA 3C 36 01 60 36 01 04 52  <6.`6..R
        .byte   $01,$3C,$52,$01,$60,$52,$01,$98 ; B5F2 01 3C 52 01 60 52 01 98  .<R.`R..
        .byte   $52,$01,$FF                     ; B5FA 52 01 FF                 R..
l12_bombs:
        .byte   $22,$10,$42,$20,$62,$00,$82,$00 ; B5FD 22 10 42 20 62 00 82 00  ".B b...
        .byte   $A2,$30,$C2,$40,$26,$00,$C6,$00 ; B605 A2 30 C2 40 26 00 C6 00  .0.@&...
        .byte   $68,$00,$88,$00,$2C,$00,$6C,$00 ; B60D 68 00 88 00 2C 00 6C 00  h...,.l.
        .byte   $8C,$00,$CC,$00                 ; B615 8C 00 CC 00              ....
l12_bombs_term:
        .byte   $FF                             ; B619 FF                       .
l12_map_changes:
        .byte   $00,$00,$24,$B6,$2E,$B6,$3E,$B6 ; B61A 00 00 24 B6 2E B6 3E B6  ..$...>.
        .byte   $4E,$B6,$FE,$49,$9C,$FD,$04,$00 ; B622 4E B6 FE 49 9C FD 04 00  N..I....
        .byte   $78,$43,$02,$FF,$FE,$49,$9C,$FD ; B62A 78 43 02 FF FE 49 9C FD  xC...I..
        .byte   $04,$00,$3C,$25,$02,$FD,$04,$00 ; B632 04 00 3C 25 02 FD 04 00  ..<%....
        .byte   $1C,$25,$02,$FF,$FE,$49,$9C,$FD ; B63A 1C 25 02 FF FE 49 9C FD  .%...I..
        .byte   $04,$00,$7C,$25,$02,$FD,$04,$00 ; B642 04 00 7C 25 02 FD 04 00  ..|%....
        .byte   $5C,$25,$02,$FF,$FE,$49,$9C,$FD ; B64A 5C 25 02 FF FE 49 9C FD  \%...I..
        .byte   $04,$00,$5C,$43,$02,$FF         ; B652 04 00 5C 43 02 FF        ..\C..
l12_unkn0:
        .byte   $00,$71,$B6,$08,$40,$02,$01,$08 ; B658 00 71 B6 08 40 02 01 08  .q..@...
        .byte   $03,$71,$B6,$08,$14,$40,$02,$08 ; B660 03 71 B6 08 14 40 02 08  .q...@..
        .byte   $04,$71,$B6,$08,$00,$80,$03,$08 ; B668 04 71 B6 08 00 80 03 08  .q......
        .byte   $FF,$47,$EF,$3E,$1E,$1E,$0E,$02 ; B670 FF 47 EF 3E 1E 1E 0E 02  .G.>....
        .byte   $05,$40,$EE,$3F,$1E,$1C,$0C,$02 ; B678 05 40 EE 3F 1E 1C 0C 02  .@.?....
        .byte   $05,$40,$E0,$38,$1C,$1E,$0D,$02 ; B680 05 40 E0 38 1C 1E 0D 02  .@.8....
        .byte   $05,$40,$EE,$3F,$1E,$1C,$0C,$02 ; B688 05 40 EE 3F 1E 1C 0C 02  .@.?....
        .byte   $05                             ; B690 05                       .
; ----------------------------------------------------------------------------
hurr_sub0:
        lda     falling_flag                    ; B691 AD 21 06                 .!.
        bne     falling_wind                    ; B694 D0 01                    ..
        rts                                     ; B696 60                       `

; ----------------------------------------------------------------------------
; wind blows jumpman to the right when he's dying
falling_wind:
        inc     player_x_pos                    ; B697 EE 7E 06                 .~.
hurr_done:
        rts                                     ; B69A 60                       `

; ----------------------------------------------------------------------------
hurr_sub1:
        lda     current_speed                   ; B69B AD 24 06                 .$.
        cmp     #$09                            ; B69E C9 09                    ..
        bcs     LB6A9                           ; B6A0 B0 07                    ..
        lda     $0623                           ; B6A2 AD 23 06                 .#.
        cmp     #$02                            ; B6A5 C9 02                    ..
        bne     LB6BA                           ; B6A7 D0 11                    ..
LB6A9:  lda     $0768                           ; B6A9 AD 68 07                 .h.
        bne     hurr_done                       ; B6AC D0 EC                    ..
        inc     $0768                           ; B6AE EE 68 07                 .h.
        lda     #$00                            ; B6B1 A9 00                    ..
        sta     AUDC1                           ; B6B3 8D 01 D2                 ...
        sta     AUDF1                           ; B6B6 8D 00 D2                 ...
        rts                                     ; B6B9 60                       `

; ----------------------------------------------------------------------------
LB6BA:  lda     $076F                           ; B6BA AD 6F 07                 .o.
        bne     LB6DC                           ; B6BD D0 1D                    ..
        lda     #$81                            ; B6BF A9 81                    ..
        sta     AUDC1                           ; B6C1 8D 01 D2                 ...
        sta     $076C                           ; B6C4 8D 6C 07                 .l.
        lda     #$00                            ; B6C7 A9 00                    ..
        sta     jiffy_timer_2                   ; B6C9 8D 1B 06                 ...
        lda     #$04                            ; B6CC A9 04                    ..
        sta     $076E                           ; B6CE 8D 6E 07                 .n.
        sta     $076F                           ; B6D1 8D 6F 07                 .o.
        lda     RANDOM                          ; B6D4 AD 0A D2                 ...
        and     #$3F                            ; B6D7 29 3F                    )?
        sta     $076D                           ; B6D9 8D 6D 07                 .m.
LB6DC:  lda     #$10                            ; B6DC A9 10                    ..
        sta     AUDF1                           ; B6DE 8D 00 D2                 ...
        lda     jiffy_timer_2                   ; B6E1 AD 1B 06                 ...
        cmp     $076D                           ; B6E4 CD 6D 07                 .m.
        bne     LB702                           ; B6E7 D0 19                    ..
        lda     $076E                           ; B6E9 AD 6E 07                 .n.
        beq     LB6F7                           ; B6EC F0 09                    ..
        inc     $076C                           ; B6EE EE 6C 07                 .l.
        dec     $076E                           ; B6F1 CE 6E 07                 .n.
        jmp     LB6FD                           ; B6F4 4C FD B6                 L..

; ----------------------------------------------------------------------------
LB6F7:  dec     $076C                           ; B6F7 CE 6C 07                 .l.
        dec     $076F                           ; B6FA CE 6F 07                 .o.
LB6FD:  lda     #$00                            ; B6FD A9 00                    ..
        sta     jiffy_timer_2                   ; B6FF 8D 1B 06                 ...
LB702:  lda     $076C                           ; B702 AD 6C 07                 .l.
        sta     AUDC1                           ; B705 8D 01 D2                 ...
        rts                                     ; B708 60                       `

; ----------------------------------------------------------------------------
hurr_sub2:
        lda     $06F5                           ; B709 AD F5 06                 ...
        cmp     #$01                            ; B70C C9 01                    ..
        bne     LB71C                           ; B70E D0 0C                    ..
        inc     $0669                           ; B710 EE 69 06                 .i.
        inc     $066C                           ; B713 EE 6C 06                 .l.
        inc     $066D                           ; B716 EE 6D 06                 .m.
        inc     $06F5                           ; B719 EE F5 06                 ...
LB71C:  lda     $0622                           ; B71C AD 22 06                 .".
        bne     LB722                           ; B71F D0 01                    ..
LB721:  rts                                     ; B721 60                       `

; ----------------------------------------------------------------------------
LB722:  ldx     #$FF                            ; B722 A2 FF                    ..
LB724:  inx                                     ; B724 E8                       .
        cpx     #$01                            ; B725 E0 01                    ..
        beq     LB724                           ; B727 F0 FB                    ..
        cpx     #$02                            ; B729 E0 02                    ..
        beq     LB724                           ; B72B F0 F7                    ..
        cpx     #$05                            ; B72D E0 05                    ..
        beq     LB721                           ; B72F F0 F0                    ..
        lda     $076C                           ; B731 AD 6C 07                 .l.
        and     #$0F                            ; B734 29 0F                    ).
        tay                                     ; B736 A8                       .
        clc                                     ; B737 18                       .
        lda     $067D,x                         ; B738 BD 7D 06                 .}.
        adc     wind_table_1,y                  ; B73B 79 6B B7                 yk.
        sta     $067D,x                         ; B73E 9D 7D 06                 .}.
        clc                                     ; B741 18                       .
        lda     $0682,x                         ; B742 BD 82 06                 ...
        adc     wind_table_2,y                  ; B745 79 71 B7                 yq.
        cmp     #$C6                            ; B748 C9 C6                    ..
        bcs     LB75D                           ; B74A B0 11                    ..
        sta     $0682,x                         ; B74C 9D 82 06                 ...
        lda     $0687,x                         ; B74F BD 87 06                 ...
        and     #$03                            ; B752 29 03                    ).
        sta     $0687,x                         ; B754 9D 87 06                 ...
        inc     $0687,x                         ; B757 FE 87 06                 ...
        jmp     LB724                           ; B75A 4C 24 B7                 L$.

; ----------------------------------------------------------------------------
LB75D:  lda     #$02                            ; B75D A9 02                    ..
        sta     $067D,x                         ; B75F 9D 7D 06                 .}.
        lda     RANDOM                          ; B762 AD 0A D2                 ...
        sta     $0682,x                         ; B765 9D 82 06                 ...
        jmp     LB724                           ; B768 4C 24 B7                 L$.

; ----------------------------------------------------------------------------
; used in level12
wind_table_1:
        .byte   $01,$02,$03,$03,$03,$03         ; B76B 01 02 03 03 03 03        ......
wind_table_2:
        .byte   $02,$01,$00,$00,$00,$00,$00,$00 ; B771 02 01 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B779 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B781 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B789 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B791 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B799 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B7A1 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B7A9 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B7B1 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00     ; B7B9 00 00 00 00 00 00 00     .......
; ----------------------------------------------------------------------------
; roll over the score if it's >= 1 million
score_mod_1m:
        lda     score+2                         ; B7C0 AD 02 07                 ...
        cmp     #$0F                            ; B7C3 C9 0F                    ..
        bcc     score_below_1m                  ; B7C5 90 27                    .'
        lda     score+1                         ; B7C7 AD 01 07                 ...
        cmp     #$42                            ; B7CA C9 42                    .B
        bcc     score_below_1m                  ; B7CC 90 20                    . 
        lda     score                           ; B7CE AD 00 07                 ...
        cmp     #$40                            ; B7D1 C9 40                    .@
        bcc     score_below_1m                  ; B7D3 90 19                    ..
        sec                                     ; B7D5 38                       8
        lda     score                           ; B7D6 AD 00 07                 ...
        sbc     #$40                            ; B7D9 E9 40                    .@
        sta     score                           ; B7DB 8D 00 07                 ...
        lda     score+1                         ; B7DE AD 01 07                 ...
        sbc     #$42                            ; B7E1 E9 42                    .B
        sta     score+1                         ; B7E3 8D 01 07                 ...
        lda     score+2                         ; B7E6 AD 02 07                 ...
        sbc     #$0F                            ; B7E9 E9 0F                    ..
        sta     score+2                         ; B7EB 8D 02 07                 ...
score_below_1m:
        jmp     print_score                     ; B7EE 4C 68 86                 Lh.

; ----------------------------------------------------------------------------
zero_filler_b7f1:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B7F1 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00     ; B7F9 00 00 00 00 00 00 00     .......
; ----------------------------------------------------------------------------
end_of_level_bonus:
        lda     level                           ; B800 AD F6 06                 ...
        asl     a                               ; B803 0A                       .
        tay                                     ; B804 A8                       .
        lda     mul_25_table,y                  ; B805 B9 A7 B8                 ...
        sta     $A4                             ; B808 85 A4                    ..
        lda     mul_25_table+1,y                ; B80A B9 A8 B8                 ...
        sta     $A5                             ; B80D 85 A5                    ..
        lda     lives                           ; B80F AD 0A 07                 ...
        sta     $A6                             ; B812 85 A6                    ..
        inc     $A6                             ; B814 E6 A6                    ..
        lda     $A4                             ; B816 A5 A4                    ..
        sta     num_in                          ; B818 85 D0                    ..
        lda     $A5                             ; B81A A5 A5                    ..
        sta     num_in+1                        ; B81C 85 D1                    ..
        lda     #$00                            ; B81E A9 00                    ..
        sta     work_level_time_bonus           ; B820 8D 91 07                 ...
        sta     num_in+2                        ; B823 85 D2                    ..
        sta     work_level_time_bonus+1         ; B825 8D 92 07                 ...
        lda     #$E9                            ; B828 A9 E9                    ..
        sta     num_out                         ; B82A 85 D3                    ..
        lda     #$3D                            ; B82C A9 3D                    .=
        sta     num_out+1                       ; B82E 85 D4                    ..
        jsr     print_number_jv                 ; B830 20 09 80                  ..
        lda     #$78                            ; B833 A9 78                    .x
        sta     $3DE9                           ; B835 8D E9 3D                 ..=
        jsr     print_bonus_jv                  ; B838 20 0F 80                  ..
add_life_bonus:
        clc                                     ; B83B 18                       .
        lda     score                           ; B83C AD 00 07                 ...
        adc     $A4                             ; B83F 65 A4                    e.
        sta     score                           ; B841 8D 00 07                 ...
        lda     score+1                         ; B844 AD 01 07                 ...
        adc     $A5                             ; B847 65 A5                    e.
        sta     score+1                         ; B849 8D 01 07                 ...
        bcc     el_hi_ok                        ; B84C 90 03                    ..
        inc     score+2                         ; B84E EE 02 07                 ...
el_hi_ok:
        clc                                     ; B851 18                       .
        lda     work_level_time_bonus           ; B852 AD 91 07                 ...
        adc     $A4                             ; B855 65 A4                    e.
        sta     work_level_time_bonus           ; B857 8D 91 07                 ...
        lda     work_level_time_bonus+1         ; B85A AD 92 07                 ...
        adc     $A5                             ; B85D 65 A5                    e.
        sta     work_level_time_bonus+1         ; B85F 8D 92 07                 ...
        jsr     check_extra_life_jv             ; B862 20 0C 80                  ..
        jsr     print_bonus_jv                  ; B865 20 0F 80                  ..
; play once per life
play_life_bonus_sfx:
        lda     #$96                            ; B868 A9 96                    ..
        sta     sfx_ptr                         ; B86A 8D 3C 06                 .<.
        lda     #$B8                            ; B86D A9 B8                    ..
        sta     sfx_ptr+1                       ; B86F 8D 3D 06                 .=.
        jsr     cue_sfx_jv                      ; B872 20 06 80                  ..
; wait for sfx to finish
el_wait_sfx:
        lda     sfx_slot_duration               ; B875 AD 46 06                 .F.
        ora     $0644                           ; B878 0D 44 06                 .D.
        bne     el_wait_sfx                     ; B87B D0 F8                    ..
        dec     $A6                             ; B87D C6 A6                    ..
        bne     add_life_bonus                  ; B87F D0 BA                    ..
        sta     jiffy_timer_1                   ; B881 8D 1A 06                 ...
; wait approx 1/2 sec
el_delay:
        lda     jiffy_timer_1                   ; B884 AD 1A 06                 ...
        cmp     #$20                            ; B887 C9 20                    . 
        bne     el_delay                        ; B889 D0 F9                    ..
        lda     randomizer_mode                 ; B88B AD F3 06                 ...
        bne     el_done                         ; B88E D0 03                    ..
        jmp     L8DA0                           ; B890 4C A0 8D                 L..

; ----------------------------------------------------------------------------
el_done:jmp     afterlife                       ; B893 4C 00 96                 L..

; ----------------------------------------------------------------------------
; played when adding bonus per life at end of level
sfx_add_life_bonus:
        .byte   $01,$E4,$00,$18,$02,$3C,$02,$79 ; B896 01 E4 00 18 02 3C 02 79  .....<.y
        .byte   $02,$F3,$02,$01,$A0,$00,$0A,$14 ; B89E 02 F3 02 01 A0 00 0A 14  ........
        .byte   $00                             ; B8A6 00                       .
; ----------------------------------------------------------------------------
; multiply by 25
mul_25_table:
        .word   $0019,$0032,$004B,$0064         ; B8A7 19 00 32 00 4B 00 64 00  ..2.K.d.
        .word   $007D,$0096,$00AF,$00C8         ; B8AF 7D 00 96 00 AF 00 C8 00  }.......
        .word   $00E1,$00FA,$0113,$012C         ; B8B7 E1 00 FA 00 13 01 2C 01  ......,.
; ----------------------------------------------------------------------------
zero_filler_b8bf:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8BF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8C7 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8CF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8D7 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8DF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8E7 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8EF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8F7 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B8FF 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B907 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B90F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B917 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B91F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B927 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B92F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B937 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B93F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B947 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B94F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B957 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; B95F 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00                 ; B967 00 00 00 00              ....
; ----------------------------------------------------------------------------
; display all the levels, happens if left idle at the title screen
demo_mode:
        lda     #$00                            ; B96B A9 00                    ..
        sta     jiffy_timer_1                   ; B96D 8D 1A 06                 ...
; 96 jiffies, 1.6s ntsc, 1.92s pal
demo_wait:
        lda     jiffy_timer_1                   ; B970 AD 1A 06                 ...
        cmp     #$60                            ; B973 C9 60                    .`
        bne     demo_wait                       ; B975 D0 F9                    ..
        lda     #$00                            ; B977 A9 00                    ..
        sta     demo_map_ptr                    ; B979 85 E0                    ..
        lda     #$00                            ; B97B A9 00                    ..
        sta     $06AB                           ; B97D 8D AB 06                 ...
        sta     $067D                           ; B980 8D 7D 06                 .}.
        sta     $0681                           ; B983 8D 81 06                 ...
        sta     player_x_pos                    ; B986 8D 7E 06                 .~.
        sta     $0680                           ; B989 8D 80 06                 ...
        lda     #$A0                            ; B98C A9 A0                    ..
        sta     demo_map_ptr+1                  ; B98E 85 E1                    ..
        lda     #$00                            ; B990 A9 00                    ..
        sta     demo_name_offset                ; B992 85 E2                    ..
        jsr     clear_screen_mem_jv             ; B994 20 1E 80                  ..
        jsr     setup_gameboard_dlist_jv        ; B997 20 15 80                  ..
        nop                                     ; B99A EA                       .
        nop                                     ; B99B EA                       .
        nop                                     ; B99C EA                       .
; initially, demo_map_ptr points to $A000 (start of level descriptions), Y is $16, or offset to _map0 within level desc.
demo_show_map:
        ldy     #$16                            ; B99D A0 16                    ..
        lda     (demo_map_ptr),y                ; B99F B1 E0                    ..
        sta     dm_progctr                      ; B9A1 85 C0                    ..
        iny                                     ; B9A3 C8                       .
        lda     (demo_map_ptr),y                ; B9A4 B1 E0                    ..
        sta     dm_progctr+1                    ; B9A6 85 C1                    ..
        ldy     demo_name_offset                ; B9A8 A4 E2                    ..
        ldx     #$00                            ; B9AA A2 00                    ..
demo_show_name:
        lda     level_names,y                   ; B9AC B9 00 BB                 ...
        sec                                     ; B9AF 38                       8
        sbc     #$20                            ; B9B0 E9 20                    . 
        sta     $3DE8,x                         ; B9B2 9D E8 3D                 ..=
        iny                                     ; B9B5 C8                       .
        inx                                     ; B9B6 E8                       .
        cpx     #$14                            ; B9B7 E0 14                    ..
        bne     demo_show_name                  ; B9B9 D0 F1                    ..
        jsr     demo_set_colors                 ; B9BB 20 EC B9                  ..
        lda     #$00                            ; B9BE A9 00                    ..
        sta     jiffy_timer_1                   ; B9C0 8D 1A 06                 ...
        jsr     draw_map_jv                     ; B9C3 20 00 80                  ..
; approx 2/3 sec
demo_wait_1:
        lda     jiffy_timer_1                   ; B9C6 AD 1A 06                 ...
        cmp     #$40                            ; B9C9 C9 40                    .@
        bne     demo_wait_1                     ; B9CB D0 F9                    ..
        jsr     clear_screen_mem_jv             ; B9CD 20 1E 80                  ..
        clc                                     ; B9D0 18                       .
        lda     demo_name_offset                ; B9D1 A5 E2                    ..
        adc     #$14                            ; B9D3 69 14                    i.
        sta     demo_name_offset                ; B9D5 85 E2                    ..
        cmp     #$F0                            ; B9D7 C9 F0                    ..
        bne     demo_next_map                   ; B9D9 D0 03                    ..
        jmp     reinit_game                     ; B9DB 4C 0C 90                 L..

; ----------------------------------------------------------------------------
demo_next_map:
        clc                                     ; B9DE 18                       .
        lda     demo_map_ptr                    ; B9DF A5 E0                    ..
        adc     #$40                            ; B9E1 69 40                    i@
        sta     demo_map_ptr                    ; B9E3 85 E0                    ..
        bcc     demo_show_map                   ; B9E5 90 B6                    ..
        inc     demo_map_ptr+1                  ; B9E7 E6 E1                    ..
        jmp     demo_show_map                   ; B9E9 4C 9D B9                 L..

; ----------------------------------------------------------------------------
; demo_map_ptr points to levelXX_desc
demo_set_colors:
        ldy     #$2F                            ; B9EC A0 2F                    ./
        lda     (demo_map_ptr),y                ; B9EE B1 E0                    ..
        sta     COLOR0                          ; B9F0 8D C4 02                 ...
        iny                                     ; B9F3 C8                       .
        lda     (demo_map_ptr),y                ; B9F4 B1 E0                    ..
        sta     COLOR1                          ; B9F6 8D C5 02                 ...
        iny                                     ; B9F9 C8                       .
        lda     (demo_map_ptr),y                ; B9FA B1 E0                    ..
        sta     COLOR2                          ; B9FC 8D C6 02                 ...
        rts                                     ; B9FF 60                       `

; ----------------------------------------------------------------------------
; calls draw_map, plays level intro music, shows level name
draw_level:
        lda     #$40                            ; BA00 A9 40                    .@
        sta     NMIEN                           ; BA02 8D 0E D4                 ...
        lda     #$00                            ; BA05 A9 00                    ..
        sta     COLOR3                          ; BA07 8D C7 02                 ...
        sta     COLOR0                          ; BA0A 8D C4 02                 ...
        sta     COLOR1                          ; BA0D 8D C5 02                 ...
        sta     COLOR2                          ; BA10 8D C6 02                 ...
        lda     #$30                            ; BA13 A9 30                    .0
        sta     SAVMSC+1                        ; BA15 85 59                    .Y
        jsr     clear_screen_mem_jv             ; BA17 20 1E 80                  ..
        lda     cur_level_map                   ; BA1A AD D6 07                 ...
        sta     dm_progctr                      ; BA1D 85 C0                    ..
        lda     cur_level_map+1                 ; BA1F AD D7 07                 ...
        sta     dm_progctr+1                    ; BA22 85 C1                    ..
        jsr     draw_map_jv                     ; BA24 20 00 80                  ..
        lda     #$30                            ; BA27 A9 30                    .0
        sta     SAVMSC+1                        ; BA29 85 59                    .Y
        lda     #$00                            ; BA2B A9 00                    ..
        sta     $AA                             ; BA2D 85 AA                    ..
        sta     $06AB                           ; BA2F 8D AB 06                 ...
        sta     COLOR4                          ; BA32 8D C8 02                 ...
        jsr     setup_gameboard_dlist_jv        ; BA35 20 15 80                  ..
        lda     level                           ; BA38 AD F6 06                 ...
        tay                                     ; BA3B A8                       .
        lda     level_name_hscrol_table,y       ; BA3C B9 F0 BB                 ...
        sta     HSCROL                          ; BA3F 8D 04 D4                 ...
        lda     #$16                            ; BA42 A9 16                    ..
        sta     $085E                           ; BA44 8D 5E 08                 .^.
        sta     $08DF                           ; BA47 8D DF 08                 ...
        lda     level                           ; BA4A AD F6 06                 ...
        pha                                     ; BA4D 48                       H
        asl     a                               ; BA4E 0A                       .
        asl     a                               ; BA4F 0A                       .
        asl     a                               ; BA50 0A                       .
        asl     a                               ; BA51 0A                       .
        sta     dm_progctr                      ; BA52 85 C0                    ..
        pla                                     ; BA54 68                       h
        asl     a                               ; BA55 0A                       .
        asl     a                               ; BA56 0A                       .
        clc                                     ; BA57 18                       .
        adc     dm_progctr                      ; BA58 65 C0                    e.
        tay                                     ; BA5A A8                       .
        ldx     #$00                            ; BA5B A2 00                    ..
; copy level name into screen RAM
show_level_name:
        lda     level_names,y                   ; BA5D B9 00 BB                 ...
        sec                                     ; BA60 38                       8
        sbc     #$20                            ; BA61 E9 20                    . 
        sta     $3DEA,x                         ; BA63 9D EA 3D                 ..=
        inx                                     ; BA66 E8                       .
        iny                                     ; BA67 C8                       .
        cpx     #$14                            ; BA68 E0 14                    ..
        bne     show_level_name                 ; BA6A D0 F1                    ..
        lda     #$08                            ; BA6C A9 08                    ..
        jsr     cue_music_jv                    ; BA6E 20 18 80                  ..
; level is already drawn with all color regs set to black. for each color reg, wait 1 sec before turning it visible. this syncs up with the music because the music was written to sync with this actually
sync_to_music:
        jsr     wait_1_sec                      ; BA71 20 9E BA                  ..
        lda     cur_level_colpf2                ; BA74 AD F1 07                 ...
        sta     COLOR2                          ; BA77 8D C6 02                 ...
        jsr     wait_1_sec                      ; BA7A 20 9E BA                  ..
        lda     cur_level_colpf1                ; BA7D AD F0 07                 ...
        sta     COLOR1                          ; BA80 8D C5 02                 ...
        jsr     wait_1_sec                      ; BA83 20 9E BA                  ..
        lda     cur_level_colpf0                ; BA86 AD EF 07                 ...
        sta     COLOR0                          ; BA89 8D C4 02                 ...
        jsr     wait_1_sec                      ; BA8C 20 9E BA                  ..
        lda     #$00                            ; BA8F A9 00                    ..
        jsr     wait_1_sec                      ; BA91 20 9E BA                  ..
        jsr     enable_joystick_jv              ; BA94 20 1B 80                  ..
        lda     #$00                            ; BA97 A9 00                    ..
        tay                                     ; BA99 A8                       .
        jsr     wait_1_sec                      ; BA9A 20 9E BA                  ..
        rts                                     ; BA9D 60                       `

; ----------------------------------------------------------------------------
; actually 64 jiffies, 1.067S ntsc, 1.28s pal
wait_1_sec:
        lda     #$00                            ; BA9E A9 00                    ..
        sta     jiffy_timer_1                   ; BAA0 8D 1A 06                 ...
keep_waiting:
        lda     jiffy_timer_1                   ; BAA3 AD 1A 06                 ...
        cmp     #$40                            ; BAA6 C9 40                    .@
        bne     keep_waiting                    ; BAA8 D0 F9                    ..
        rts                                     ; BAAA 60                       `

; ----------------------------------------------------------------------------
zero_filler_baab:
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; BAAB 00 00 00 00 00 00 00 00  ........
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; BAB3 00 00 00 00 00 00 00 00  ........
        .byte   $00                             ; BABB 00                       .
; level intro music, melody
sfx15:  .byte   $01,$A5,$02,$3C,$10,$2F,$10,$35 ; BABC 01 A5 02 3C 10 2F 10 35  ...<./.5
        .byte   $10,$2D,$10,$2F,$08,$2D,$08,$28 ; BAC4 10 2D 10 2F 08 2D 08 28  .-./.-.(
        .byte   $08,$2F,$08,$35,$08,$2F,$08,$2D ; BACC 08 2F 08 35 08 2F 08 2D  ./.5./.-
        .byte   $08,$35,$08,$3C,$10,$2F,$10,$35 ; BAD4 08 35 08 3C 10 2F 10 35  .5.<./.5
        .byte   $10,$2D,$10,$28,$08,$2D,$08,$2F ; BADC 10 2D 10 28 08 2D 08 2F  .-.(.-./
        .byte   $08,$35,$08,$3C,$10,$00         ; BAE4 08 35 08 3C 10 00        .5.<..
; level intro music, bass
sfx16:  .byte   $01,$A7,$02,$F3,$20,$A2,$20,$F3 ; BAEA 01 A7 02 F3 20 A2 20 F3  .... . .
        .byte   $20,$A2,$20,$F3,$20,$A2,$20,$79 ; BAF2 20 A2 20 F3 20 A2 20 79   . . . y
        .byte   $10,$A2,$10,$F3,$10,$00         ; BAFA 10 A2 10 F3 10 00        ......
level_names:
        .byte   $20,$20,$20,$4E,$4F,$54,$48,$49 ; BB00 20 20 20 4E 4F 54 48 49     NOTHI
        .byte   $4E,$47,$20,$54,$4F,$20,$49,$54 ; BB08 4E 47 20 54 4F 20 49 54  NG TO IT
        .byte   $20,$20,$20,$20,$20,$20,$20,$45 ; BB10 20 20 20 20 20 20 20 45         E
        .byte   $4C,$45,$43,$54,$52,$4F,$43,$55 ; BB18 4C 45 43 54 52 4F 43 55  LECTROCU
        .byte   $54,$49,$4F,$4E,$20,$20,$20,$20 ; BB20 54 49 4F 4E 20 20 20 20  TION    
        .byte   $20,$20,$20,$20,$20,$44,$55,$4D ; BB28 20 20 20 20 20 44 55 4D       DUM
        .byte   $42,$57,$41,$49,$54,$45,$52,$20 ; BB30 42 57 41 49 54 45 52 20  BWAITER 
        .byte   $20,$20,$20,$20,$20,$20,$20,$20 ; BB38 20 20 20 20 20 20 20 20          
        .byte   $20,$48,$45,$4C,$4C,$53,$54,$4F ; BB40 20 48 45 4C 4C 53 54 4F   HELLSTO
        .byte   $4E,$45,$53,$20,$20,$20,$20,$20 ; BB48 4E 45 53 20 20 20 20 20  NES     
        .byte   $20,$20,$46,$49,$47,$55,$52,$49 ; BB50 20 20 46 49 47 55 52 49    FIGURI
        .byte   $54,$53,$20,$52,$45,$56,$45,$4E ; BB58 54 53 20 52 45 56 45 4E  TS REVEN
        .byte   $47,$45,$20,$20,$20,$20,$20,$20 ; BB60 47 45 20 20 20 20 20 20  GE      
        .byte   $20,$20,$20,$57,$41,$4C,$4C,$53 ; BB68 20 20 20 57 41 4C 4C 53     WALLS
        .byte   $20,$20,$20,$20,$20,$20,$20,$20 ; BB70 20 20 20 20 20 20 20 20          
        .byte   $20,$20,$20,$20,$20,$20,$5A,$49 ; BB78 20 20 20 20 20 20 5A 49        ZI
        .byte   $47,$2D,$5A,$41,$47,$20,$20,$20 ; BB80 47 2D 5A 41 47 20 20 20  G-ZAG   
        .byte   $20,$20,$20,$20,$20,$20,$20,$20 ; BB88 20 20 20 20 20 20 20 20          
        .byte   $20,$53,$50,$45,$4C,$4C,$42,$4F ; BB90 20 53 50 45 4C 4C 42 4F   SPELLBO
        .byte   $55,$4E,$44,$20,$20,$20,$20,$20 ; BB98 55 4E 44 20 20 20 20 20  UND     
        .byte   $20,$20,$20,$20,$20,$20,$42,$4C ; BBA0 20 20 20 20 20 20 42 4C        BL
        .byte   $41,$43,$4B,$4F,$55,$54,$20,$20 ; BBA8 41 43 4B 4F 55 54 20 20  ACKOUT  
        .byte   $20,$20,$20,$20,$48,$45,$52,$45 ; BBB0 20 20 20 20 48 45 52 45      HERE
        .byte   $54,$48,$45,$52,$45,$45,$56,$45 ; BBB8 54 48 45 52 45 45 56 45  THEREEVE
        .byte   $52,$59,$57,$48,$45,$52,$45,$20 ; BBC0 52 59 57 48 45 52 45 20  RYWHERE 
        .byte   $20,$20,$20,$20,$20,$48,$41,$54 ; BBC8 20 20 20 20 20 48 41 54       HAT
        .byte   $43,$48,$4C,$49,$4E,$47,$53,$20 ; BBD0 43 48 4C 49 4E 47 53 20  CHLINGS 
        .byte   $20,$20,$20,$20,$20,$20,$20,$20 ; BBD8 20 20 20 20 20 20 20 20          
        .byte   $20,$48,$55,$52,$52,$49,$43,$41 ; BBE0 20 48 55 52 52 49 43 41   HURRICA
        .byte   $4E,$45,$20,$20,$20,$20,$20,$20 ; BBE8 4E 45 20 20 20 20 20 20  NE      
; used for centering level name on gameboard
level_name_hscrol_table:
        .byte   $04,$04,$00,$00,$00,$04,$04,$00 ; BBF0 04 04 00 00 00 04 04 00  ........
        .byte   $00,$04,$00,$04,$00,$00,$00,$00 ; BBF8 00 04 00 04 00 00 00 00  ........
; ----------------------------------------------------------------------------
; the WELL DONE screen, when you beat all the levels. after this, the game plays random levels.
well_done_screen:
        jsr     setup_blank_dlist_jv            ; BC00 20 3C 80                  <.
        jsr     enable_joystick_jv              ; BC03 20 1B 80                  ..
        jsr     clear_screen_mem_jv             ; BC06 20 1E 80                  ..
        lda     #$00                            ; BC09 A9 00                    ..
        sta     $06AB                           ; BC0B 8D AB 06                 ...
        jsr     setup_gameboard_dlist_jv        ; BC0E 20 15 80                  ..
        ldy     dlist_shadow_lo                 ; BC11 AC AC 06                 ...
        lda     #$41                            ; BC14 A9 41                    .A
        sta     $080A,y                         ; BC16 99 0A 08                 ...
        tya                                     ; BC19 98                       .
        sta     $080B,y                         ; BC1A 99 0B 08                 ...
        lda     #$08                            ; BC1D A9 08                    ..
        sta     $080C,y                         ; BC1F 99 0C 08                 ...
        lda     #$D9                            ; BC22 A9 D9                    ..
        sta     dm_progctr                      ; BC24 85 C0                    ..
        lda     #$BC                            ; BC26 A9 BC                    ..
        sta     dm_progctr+1                    ; BC28 85 C1                    ..
        jsr     draw_map_jv                     ; BC2A 20 00 80                  ..
        lda     #$04                            ; BC2D A9 04                    ..
        sta     $0688                           ; BC2F 8D 88 06                 ...
        sta     $066A                           ; BC32 8D 6A 06                 .j.
        lda     #$7C                            ; BC35 A9 7C                    .|
        sta     player_x_pos                    ; BC37 8D 7E 06                 .~.
        lda     #$20                            ; BC3A A9 20                    . 
        sta     player_y_pos                    ; BC3C 8D 83 06                 ...
; load dli_service_2 address into dli shadow
setup_dli_2:
        lda     #$C7                            ; BC3F A9 C7                    ..
        sta     dli_vec_shadow_lo               ; BC41 8D AE 06                 ...
        lda     #$BD                            ; BC44 A9 BD                    ..
        sta     dli_vec_shadow_hi               ; BC46 8D AF 06                 ...
        lda     #$8D                            ; BC49 A9 8D                    ..
        sta     $0809                           ; BC4B 8D 09 08                 ...
        sta     $088A                           ; BC4E 8D 8A 08                 ...
; wait until the dli has been set up (by vblank)
wd_wait_dli:
        lda     dli_vec_shadow_hi               ; BC51 AD AF 06                 ...
        bne     wd_wait_dli                     ; BC54 D0 FB                    ..
        lda     #$96                            ; BC56 A9 96                    ..
        sta     COLOR0                          ; BC58 8D C4 02                 ...
        sta     jiffy_timer_1                   ; BC5B 8D 1A 06                 ...
; wait 32 jiffies (approx 1/2 sec)
wd_wait_32j:
        lda     jiffy_timer_1                   ; BC5E AD 1A 06                 ...
        cmp     #$20                            ; BC61 C9 20                    . 
        bne     wd_wait_32j                     ; BC63 D0 F9                    ..
        lda     #$03                            ; BC65 A9 03                    ..
        jsr     cue_music_jv                    ; BC67 20 18 80                  ..
        lda     #$CD                            ; BC6A A9 CD                    ..
        sta     work_level_sub0                 ; BC6C 8D 82 07                 ...
        lda     #$BC                            ; BC6F A9 BC                    ..
        sta     work_level_sub0+1               ; BC71 8D 83 07                 ...
        lda     #$05                            ; BC74 A9 05                    ..
        sta     current_speed                   ; BC76 8D 24 06                 .$.
        lda     #$0D                            ; BC79 A9 0D                    ..
        sta     joystick_disabled               ; BC7B 8D 32 06                 .2.
        lda     #$00                            ; BC7E A9 00                    ..
        sta     $0623                           ; BC80 8D 23 06                 .#.
        lda     #$52                            ; BC83 A9 52                    .R
        sta     work_level_sub1                 ; BC85 8D 84 07                 ...
        lda     #$BD                            ; BC88 A9 BD                    ..
        sta     work_level_sub1+1               ; BC8A 8D 85 07                 ...
        lda     #$4C                            ; BC8D A9 4C                    .L
        sta     work_level_offs_50+3            ; BC8F 8D B5 07                 ...
; wait for score screen to finish (I think, anyway)
wd_wait_scores:
        lda     work_level_sub1                 ; BC92 AD 84 07                 ...
        cmp     #$E6                            ; BC95 C9 E6                    ..
        bne     wd_wait_scores                  ; BC97 D0 F9                    ..
        lda     #$00                            ; BC99 A9 00                    ..
        sta     $06AB                           ; BC9B 8D AB 06                 ...
        jsr     setup_gameboard_dlist_jv        ; BC9E 20 15 80                  ..
        ldx     #$0B                            ; BCA1 A2 0B                    ..
; wait 32 jiffies (approx 1/2 sec)
print_total_score_msg:
        lda     total_score_msg_minus_one,x     ; BCA3 BD D1 BD                 ...
        sta     $3DE8,x                         ; BCA6 9D E8 3D                 ..=
        dex                                     ; BCA9 CA                       .
        bne     print_total_score_msg           ; BCAA D0 F7                    ..
        lda     #$3D                            ; BCAC A9 3D                    .=
        sta     num_out+1                       ; BCAE 85 D4                    ..
        lda     #$F5                            ; BCB0 A9 F5                    ..
        sta     num_out                         ; BCB2 85 D3                    ..
        ldx     #$03                            ; BCB4 A2 03                    ..
; display current user's score, number_of_users should be score-1 here.
wd_xxx: lda     number_of_users,x               ; BCB6 BD FF 06                 ...
        sta     $CF,x                           ; BCB9 95 CF                    ..
        dex                                     ; BCBB CA                       .
        bne     wd_xxx                          ; BCBC D0 F8                    ..
        jsr     print_number_jv                 ; BCBE 20 09 80                  ..
; wait until music is done playing (not 100% sure though)
wd_wait_music:
        lda     $0663                           ; BCC1 AD 63 06                 .c.
        bne     wd_wait_music                   ; BCC4 D0 FB                    ..
        lda     level                           ; BCC6 AD F6 06                 ...
        inc     randomizer_mode                 ; BCC9 EE F3 06                 ...
        rts                                     ; BCCC 60                       `

; ----------------------------------------------------------------------------
; used in work_level_sub0 slot during well_doneused in work_level_sub1 slot during well_done
well_done_sub0:
        lda     $062A                           ; BCCD AD 2A 06                 .*.
        sta     COLOR2                          ; BCD0 8D C6 02                 ...
        lda     #$02                            ; BCD3 A9 02                    ..
        sta     sav_p0pf                        ; BCD5 8D B4 06                 ...
        rts                                     ; BCD8 60                       `

; ----------------------------------------------------------------------------
; level map used for the WELL DONE screen, when you beat level 12
well_done_map:
        .byte   $FE,$A0,$BD,$FD,$00,$04,$0C,$06 ; BCD9 FE A0 BD FD 00 04 0C 06  ........
        .byte   $07,$30,$06,$09,$54,$06,$09,$78 ; BCE1 07 30 06 09 54 06 09 78  .0..T..x
        .byte   $06,$09,$0C,$30,$09,$30,$38,$05 ; BCE9 06 09 0C 30 09 30 38 05  ...0.08.
        .byte   $54,$30,$09,$78,$30,$09,$FD,$04 ; BCF1 54 30 09 78 30 09 FD 04  T0.x0...
        .byte   $04,$10,$22,$02,$20,$34,$01,$34 ; BCF9 04 10 22 02 20 34 01 34  ..". 4.4
        .byte   $4C,$01,$44,$34,$01,$58,$38,$05 ; BD01 4C 01 44 34 01 58 38 05  L.D4.X8.
        .byte   $FD,$04,$FC,$1C,$26,$02,$20,$4C ; BD09 FD 04 FC 1C 26 02 20 4C  ....&. L
        .byte   $01,$34,$34,$01,$44,$4C,$01,$FD ; BD11 01 34 34 01 44 4C 01 FD  .44.DL..
        .byte   $04,$00,$34,$06,$06,$34,$16,$06 ; BD19 04 00 34 06 06 34 16 06  ..4..4..
        .byte   $34,$26,$06,$54,$26,$07,$78,$26 ; BD21 34 26 06 54 26 07 78 26  4&.T&.x&
        .byte   $07,$10,$30,$04,$0C,$50,$05,$38 ; BD29 07 10 30 04 0C 50 05 38  ..0..P.8
        .byte   $30,$03,$38,$50,$03,$7C,$30,$06 ; BD31 30 03 38 50 03 7C 30 06  0.8P.|0.
        .byte   $7C,$40,$06,$7C,$50,$06,$FD,$00 ; BD39 7C 40 06 7C 50 06 FD 00  |@.|P...
        .byte   $04,$24,$06,$07,$24,$38,$05,$48 ; BD41 04 24 06 07 24 38 05 48  .$..$8.H
        .byte   $38,$05,$6C,$30,$09,$18,$1A,$03 ; BD49 38 05 6C 30 09 18 1A 03  8.l0....
        .byte   $FF                             ; BD51 FF                       .
; ----------------------------------------------------------------------------
; used in work_level_sub1 slot during well_doneused in work_level_sub1 slot during well_done
well_done_sub1:
        lda     falling_flag                    ; BD52 AD 21 06                 .!.
        bne     wds1_cont                       ; BD55 D0 01                    ..
        rts                                     ; BD57 60                       `

; ----------------------------------------------------------------------------
; we seem to be setting/clearing bit 7 in the display list, moving the line(s) where DLI(s) occur.
wds1_cont:
        ldy     dlist_shadow_lo                 ; BD58 AC AC 06                 ...
        lda     #$0D                            ; BD5B A9 0D                    ..
        sta     $0809,y                         ; BD5D 99 09 08                 ...
        lda     #$8D                            ; BD60 A9 8D                    ..
        sta     $080A,y                         ; BD62 99 0A 08                 ...
        lda     $080B,y                         ; BD65 B9 0B 08                 ...
        sta     $080C,y                         ; BD68 99 0C 08                 ...
        lda     #$41                            ; BD6B A9 41                    .A
        sta     $080B,y                         ; BD6D 99 0B 08                 ...
        lda     #$08                            ; BD70 A9 08                    ..
        sta     $080D,y                         ; BD72 99 0D 08                 ...
        inc     dlist_shadow_lo                 ; BD75 EE AC 06                 ...
        cpy     #$4E                            ; BD78 C0 4E                    .N
        beq     wds1_finish                     ; BD7A F0 05                    ..
        cpy     #$CE                            ; BD7C C0 CE                    ..
        beq     wds1_finish                     ; BD7E F0 01                    ..
        rts                                     ; BD80 60                       `

; ----------------------------------------------------------------------------
; set things up for the next level?
wds1_finish:
        lda     #$E6                            ; BD81 A9 E6                    ..
        sta     work_level_sub1                 ; BD83 8D 84 07                 ...
        lda     #$06                            ; BD86 A9 06                    ..
        sta     work_level_sub1+1               ; BD88 8D 85 07                 ...
        lda     #$09                            ; BD8B A9 09                    ..
        sta     current_speed                   ; BD8D 8D 24 06                 .$.
        lda     #$C6                            ; BD90 A9 C6                    ..
        sta     player_y_pos                    ; BD92 8D 83 06                 ...
        lda     #$00                            ; BD95 A9 00                    ..
        sta     falling_flag                    ; BD97 8D 21 06                 .!.
        lda     #$01                            ; BD9A A9 01                    ..
        sta     $0688                           ; BD9C 8D 88 06                 ...
        rts                                     ; BD9F 60                       `

; ----------------------------------------------------------------------------
; used to draw the large WELL DONE banner
well_done_shape:
        .byte   $04,$00,$00,$01,$01,$01,$01,$05 ; BDA0 04 00 00 01 01 01 01 05  ........
        .byte   $00,$01,$01,$01,$01,$01,$03,$05 ; BDA8 00 01 01 01 01 01 03 05  ........
        .byte   $00,$02,$01,$01,$01,$01,$03,$05 ; BDB0 00 02 01 01 01 01 03 05  ........
        .byte   $00,$03,$01,$01,$01,$01,$03,$04 ; BDB8 00 03 01 01 01 01 03 04  ........
        .byte   $01,$04,$03,$03,$03,$03,$FF     ; BDC0 01 04 03 03 03 03 FF     .......
; ----------------------------------------------------------------------------
; DLI service routine, changes COLBK, address gets stored in $6ae/$6af by code at $bc3c
dli_service_2:
        pha                                     ; BDC7 48                       H
        lda     #$C4                            ; BDC8 A9 C4                    ..
        sta     WSYNC                           ; BDCA 8D 0A D4                 ...
        sta     COLBK                           ; BDCD 8D 1A D0                 ...
        pla                                     ; BDD0 68                       h
; 1-indexed
total_score_msg_minus_one:
        rti                                     ; BDD1 40                       @

; ----------------------------------------------------------------------------
; screen codes, displayed by well_done_screen
total_score_msg:
        .byte   $74,$6F,$74,$61,$6C,$00,$73,$63 ; BDD2 74 6F 74 61 6C 00 73 63  total.sc
        .byte   $6F,$72,$65,$33,$00,$26,$29,$2C ; BDDA 6F 72 65 33 00 26 29 2C  ore3.&),
        .byte   $25,$33,$00,$00,$00,$00,$00,$00 ; BDE2 25 33 00 00 00 00 00 00  %3......
        .byte   $00,$00,$00,$00,$00,$00,$00,$00 ; BDEA 00 00 00 00 00 00 00 00  ........
sfx00:  .byte   $01,$A5,$02,$79,$08,$A2,$08,$79 ; BDF2 01 A5 02 79 08 A2 08 79  ...y...y
        .byte   $08,$A2,$08,$C1,$10,$C1,$10,$F3 ; BDFA 08 A2 08 C1 10 C1 10 F3  ........
        .byte   $20,$F3,$20,$02,$F5,$BD,$02,$79 ; BE02 20 F3 20 02 F5 BD 02 79   . ....y
        .byte   $08,$6C,$08,$60,$08,$5B,$08,$51 ; BE0A 08 6C 08 60 08 5B 08 51  .l.`.[.Q
        .byte   $08,$5B,$08,$60,$08,$6C,$08,$79 ; BE12 08 5B 08 60 08 6C 08 79  .[.`.l.y
        .byte   $10,$A2,$10,$F3,$20,$01,$A0,$00 ; BE1A 10 A2 10 F3 20 01 A0 00  .... ...
        .byte   $0A,$80,$00                     ; BE22 0A 80 00                 ...
sfx01:  .byte   $01,$A6,$02,$3C,$20,$51,$20,$48 ; BE25 01 A6 02 3C 20 51 20 48  ...< Q H
        .byte   $08,$51,$08,$48,$08,$40,$08,$3C ; BE2D 08 51 08 48 08 40 08 3C  .Q.H.@.<
        .byte   $10,$3C,$20,$3C,$10,$51,$10,$51 ; BE35 10 3C 20 3C 10 51 10 51  .< <.Q.Q
        .byte   $10,$48,$08,$51,$08,$48,$08,$40 ; BE3D 10 48 08 51 08 48 08 40  .H.Q.H.@
        .byte   $08,$3C,$20,$3C,$20,$51,$20,$48 ; BE45 08 3C 20 3C 20 51 20 48  .< < Q H
        .byte   $08,$51,$08,$48,$08,$40,$08,$3C ; BE4D 08 51 08 48 08 40 08 3C  .Q.H.@.<
        .byte   $10,$3C,$10,$3C,$08,$35,$08,$2F ; BE55 10 3C 10 3C 08 35 08 2F  .<.<.5./
        .byte   $08,$2D,$08,$28,$08,$2D,$08,$2F ; BE5D 08 2D 08 28 08 2D 08 2F  .-.(.-./
        .byte   $08,$35,$08,$3C,$08,$51,$08,$60 ; BE65 08 35 08 3C 08 51 08 60  .5.<.Q.`
        .byte   $08,$51,$08,$79,$20,$00         ; BE6D 08 51 08 79 20 00        .Q.y .
; horizontal movement
sfx_walk:
        .byte   $01,$81,$00,$32,$01,$00         ; BE73 01 81 00 32 01 00        ...2..
sfx_extra_life:
        .byte   $01,$A8,$00,$05,$02,$0F,$02,$0A ; BE79 01 A8 00 05 02 0F 02 0A  ........
        .byte   $02,$14,$02,$0F,$02,$19,$02,$14 ; BE81 02 14 02 0F 02 19 02 14  ........
        .byte   $02,$1E,$02,$00                 ; BE89 02 1E 02 00              ....
; end of game tune, melody
sfx02:  .byte   $01,$A5,$02,$3C,$10,$51,$10,$3C ; BE8D 01 A5 02 3C 10 51 10 3C  ...<.Q.<
        .byte   $10,$51,$10,$44,$08,$44,$08,$44 ; BE95 10 51 10 44 08 44 08 44  .Q.D.D.D
        .byte   $08,$44,$08,$44,$10,$5B,$10,$4C ; BE9D 08 44 08 44 10 5B 10 4C  .D.D.[.L
        .byte   $10,$66,$10,$4C,$10,$66,$10,$51 ; BEA5 10 66 10 4C 10 66 10 51  .f.L.f.Q
        .byte   $40,$00                         ; BEAD 40 00                    @.
; end of game tune, bass
sfx03:  .byte   $01,$A4,$02,$79,$10,$A2,$10,$F3 ; BEAF 01 A4 02 79 10 A2 10 F3  ...y....
        .byte   $10,$79,$10,$88,$10,$B6,$10,$D9 ; BEB7 10 79 10 88 10 B6 10 D9  .y......
        .byte   $10,$88,$10,$99,$10,$CC,$10,$CC ; BEBF 10 88 10 99 10 CC 10 CC  ........
        .byte   $10,$99,$10,$A2,$08,$99,$08,$A2 ; BEC7 10 99 10 A2 08 99 08 A2  ........
        .byte   $08,$99,$08,$A2,$20,$00         ; BECF 08 99 08 A2 20 00        .... .
; end level tune #1, bass
sfx04:  .byte   $01,$A5,$02,$79,$14,$A2,$14,$79 ; BED5 01 A5 02 79 14 A2 14 79  ...y...y
        .byte   $14,$A2,$14,$79,$14,$A2,$14,$F3 ; BEDD 14 A2 14 79 14 A2 14 F3  ...y....
        .byte   $14,$A2,$14,$02,$D8,$BE,$01,$00 ; BEE5 14 A2 14 02 D8 BE 01 00  ........
; end level tune #1, melody
sfx05:  .byte   $01,$A0,$00,$0A,$A0,$01,$A6,$02 ; BEED 01 A0 00 0A A0 01 A6 02  ........
        .byte   $51,$0A,$55,$0A,$51,$0A,$4C,$0A ; BEF5 51 0A 55 0A 51 0A 4C 0A  Q.U.Q.L.
        .byte   $51,$0A,$4C,$0A,$48,$0A,$4C,$0A ; BEFD 51 0A 4C 0A 48 0A 4C 0A  Q.L.H.L.
        .byte   $48,$0A,$44,$0A,$48,$0A,$44,$0A ; BF05 48 0A 44 0A 48 0A 44 0A  H.D.H.D.
        .byte   $3C,$0A,$51,$0A,$3C,$14,$00     ; BF0D 3C 0A 51 0A 3C 14 00     <.Q.<..
; end level tune #2, melody
sfx06:  .byte   $01,$A6,$02,$79,$20,$60,$14,$51 ; BF14 01 A6 02 79 20 60 14 51  ...y `.Q
        .byte   $3C,$60,$0A,$5B,$14,$60,$08,$5B ; BF1C 3C 60 0A 5B 14 60 08 5B  <`.[.`.[
        .byte   $14,$60,$08,$5B,$14,$51,$08,$60 ; BF24 14 60 08 5B 14 51 08 60  .`.[.Q.`
        .byte   $14,$79,$20,$00                 ; BF2C 14 79 20 00              .y .
; end level tune #2, bass
sfx07:  .byte   $01,$A6,$02,$F3,$0A,$D9,$0A,$C1 ; BF30 01 A6 02 F3 0A D9 0A C1  ........
        .byte   $0A,$A2,$14,$79,$1E,$A2,$1E,$C1 ; BF38 0A A2 14 79 1E A2 1E C1  ...y....
        .byte   $0A,$B6,$50,$C1,$08,$A2,$14,$F3 ; BF40 0A B6 50 C1 08 A2 14 F3  ..P.....
        .byte   $20,$00                         ; BF48 20 00                     .
; end level tune #3, bass
sfx08:  .byte   $01,$A8,$02,$79,$30,$A2,$20,$79 ; BF4A 01 A8 02 79 30 A2 20 79  ...y0. y
        .byte   $20,$51,$10,$A2,$30,$6C,$20,$A3 ; BF52 20 51 10 A2 30 6C 20 A3   Q..0l .
        .byte   $20,$6C,$10,$79,$70,$00         ; BF5A 20 6C 10 79 70 00         l.yp.
; end level tune #3, melody
sfx09:  .byte   $01,$A5,$02,$79,$10,$60,$10,$51 ; BF60 01 A5 02 79 10 60 10 51  ...y.`.Q
        .byte   $10,$3C,$20,$35,$10,$3C,$10,$44 ; BF68 10 3C 20 35 10 3C 10 44  .< 5.<.D
        .byte   $10,$40,$10,$51,$20,$5B,$20,$6C ; BF70 10 40 10 51 20 5B 20 6C  .@.Q [ l
        .byte   $20,$80,$10,$79,$10,$60,$10,$51 ; BF78 20 80 10 79 10 60 10 51   ..y.`.Q
        .byte   $10,$3C,$40,$00                 ; BF80 10 3C 40 00              .<@.
; end level tune #4, melody
sfx10:  .byte   $01,$A5,$02,$3C,$20,$2D,$12,$32 ; BF84 01 A5 02 3C 20 2D 12 32  ...< -.2
        .byte   $20,$3C,$20,$4C,$08,$44,$14,$4C ; BF8C 20 3C 20 4C 08 44 14 4C   < L.D.L
        .byte   $09,$40,$20,$32,$20,$40,$09,$44 ; BF94 09 40 20 32 20 40 09 44  .@ 2 @.D
        .byte   $09,$4C,$09,$5B,$09,$4C,$09,$5B ; BF9C 09 4C 09 5B 09 4C 09 5B  .L.[.L.[
        .byte   $48,$00                         ; BFA4 48 00                    H.
; end level tune #4, bass
sfx11:  .byte   $01,$A6,$02,$79,$20,$B6,$30,$99 ; BFA6 01 A6 02 79 20 B6 30 99  ...y .0.
        .byte   $20,$88,$09,$99,$20,$E6,$30,$99 ; BFAE 20 88 09 99 20 E6 30 99   ... .0.
        .byte   $20,$88,$09,$99,$20,$B6,$3A,$00 ; BFB6 20 88 09 99 20 B6 3A 00   ... .:.
; jumping sound
sfx_jump:
        .byte   $01,$A5,$00,$79,$04,$60,$04,$51 ; BFBE 01 A5 00 79 04 60 04 51  ...y.`.Q
        .byte   $04,$3C,$04,$51,$04,$60,$04,$79 ; BFC6 04 3C 04 51 04 60 04 79  .<.Q.`.y
        .byte   $04,$00                         ; BFCE 04 00                    ..
; funeral march melody
sfx13:  .byte   $01,$A5,$01,$3C,$20,$3C,$10,$3C ; BFD0 01 A5 01 3C 20 3C 10 3C  ...< <.<
        .byte   $10,$3C,$20,$32,$10,$35,$10,$35 ; BFD8 10 3C 20 32 10 35 10 35  .< 2.5.5
        .byte   $10,$3C,$10,$3C,$10,$40,$10,$3C ; BFE0 10 3C 10 3C 10 40 10 3C  .<.<.@.<
        .byte   $40,$00                         ; BFE8 40 00                    @.
; funeral march bass
sfx14:  .byte   $01,$A6,$00,$79,$10,$A2,$10,$02 ; BFEA 01 A6 00 79 10 A2 10 02  ...y....
        .byte   $ED,$BF,$06,$F3,$10,$A2,$10,$00 ; BFF2 ED BF 06 F3 10 A2 10 00  ........
; ----------------------------------------------------------------------------
; main entry point, note cartstart_left and cartstart_right point to the same address
cartstart_left:
        .addr   cart_entry_point                ; BFFA C0 8A                    ..
; ----------------------------------------------------------------------------
; 0 here means 'cartridge present'
cartpresent_left:
        .byte   $00                             ; BFFC 00                       .
; 4 here means init & start the cart, no disk boot, non-diagnostic
cartoptions_left:
        .byte   $04                             ; BFFD 04                       .
; ----------------------------------------------------------------------------
; points to a CLC/RTS do-nothing routine (same as cartinit_right)
cartinit_left:
        .addr   cart_start_stub                 ; BFFE FE 8A                    ..