Prev: 8008 Up: Map Next: 80B9
8014: Load a stage
Used by the routine at main_loop.
load_stage 8014 LD A,($8007) Load wanted_stage_number
8017 LD HL,$A13A Point HL at current_stage_number
801A CP (HL) Exit if they match
801B RET Z
801C LD (HL),A current_stage_number = wanted_stage_number
801D LD ($A220),A Set var_a220 to wanted level no.
8020 ADD A,$B0 Update the level number in "SEARCHING FOR <N>"
8022 LD ($81AE),A
load_stage_0 8025 CALL clear_screen_set_attrs Call clear_screen_set_attrs
8028 CALL clear_game_attrs Call clear_game_attrs
802B LD A,$F8 Transition type?
802D CALL setup_transition Call setup_transition
8030 LD B,$02
load_stage_1 8032 CALL sub_8088 Call TBD subroutine
load_stage_2 8035 LD IX,$A19C IX = &hazards[1]
8039 LD DE,$0002
803C CALL tape_load Call tape_load subroutine
803F JR NC,load_stage_2 loop while failed perhaps?
8041 LD HL,$A19C HL = &hazards[1]
8044 LD A,(HL) Load used flag [doesn't add up - this is a level number?]
This entry point is used by the routine at entrypt_48k.
load_stage_3 8045 INC HL
8046 CP (HL) equal to <distance related>?
8047 JR NZ,load_stage_2 jump if not
8049 ADD A,$B0 A += (48 + 128) (make it ASCII and terminate it)
804B LD ($81BA),A Set x in "FOUND x"
804E LD B,$03
8050 LD A,($8007) A = wanted_stage_number
8053 CP (HL) equal?
8054 JR NZ,load_stage_1 not the wanted stage
8056 CALL sub_8088 Call TBD subroutine
8059 CALL tape_load_5C00 Call tape_load_5C00
805C JR NC,load_stage_0
Success - must have loaded the correct level data.
805E XOR A Set border to black
805F OUT ($FE),A
8061 CALL clear_screen_set_attrs Call clear_screen_set_attrs
8064 CALL clear_game_attrs Call clear_game_attrs
8067 LD HL,$81BB HL -> "STOP THE TAPE" message structure
806A LD B,$02
806C CALL sub_8098 Call sub_8098
806F PUSH HL Preserve ?
Wait for a keypress - debounce.
load_stage_4 8070 CALL keyscan Call keyscan
8073 AND $10 Loop while key not pressed
8075 JR Z,load_stage_4
load_stage_5 8077 CALL keyscan Call keyscan
807A AND $10 Loop while key pressed
807C JR NZ,load_stage_5
807E LD A,$08
8080 CALL setup_transition Call setup_transition
8083 POP HL Restore ?
8084 LD B,$02 B = 2
8086 JR sub_8098 Exit via sub_8098
sub_8088 8088 LD HL,$818C Point HL at "START TAPE" message structure
808B LD A,($8007) A = wanted_stage_number - 1
808E DEC A
808F JR NZ,sub_8095 Jump if > 0
This entry point is used by the routine at entrypt_48k.
load_stage_6 8091 INC B
8092 LD HL,$8169 Point HL at tape_messsages
sub_8095 8095 CALL sub_8098 why call adjacent instr? to exec this func twice?
sub_8098 8098 PUSH BC preserve counter
8099 PUSH HL preserve message pointer
sub_809A 809A LD A,$05 flags byte for print_message
809C DEC HL why dec here?
This entry point is used by the routine at page_in_stage_128k.
sub_809D 809D CALL print_message Call print_message
80A0 DJNZ sub_809A printing a whole set by looping?
80A2 CALL transition Call transition
80A5 CALL draw_screen Call draw_screen
80A8 POP HL restore message pointer
80A9 POP BC restore counter
This entry point is used by the routine at page_in_stage_128k.
load_stage_7 80AA LD A,($A231) A = transition_control
80AD AND A Return if zero
80AE RET Z
80AF LD DE,$0A00 Delay loop
load_stage_8 80B2 DEC DE
80B3 LD A,D
80B4 OR E
80B5 JR NZ,load_stage_8
80B7 JR sub_8098 Loop
Prev: 8008 Up: Map Next: 80B9