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 dont_draw_screen_attrs to a non-zero value
8020 ADD A,$B0 Update the level number in "SEARCHING FOR <N>"
8022 LD ($81AE),A
ls_8025 8025 CALL clear_screen_set_attrs Call clear_screen_set_attrs
8028 CALL clear_game_attrs Call clear_game_attrs
802B LD A,$F8 Reverse transition
802D CALL setup_transition Call setup_transition
8030 LD B,$02
ls_8032 8032 CALL ls_8088 Call ls_8088
ls_load_header 8035 LD IX,$A19C Load to address &hazards[1] as a temporary scratch area
8039 LD DE,$0002 Load 2 bytes
803C CALL tape_load_at_ix Call tape_load_at_ix subroutine
803F JR NC,ls_load_header Loop to ls_load_header while failed
8041 LD HL,$A19C HL = &hazards[1]
8044 LD A,(HL) Are the two loaded bytes equal? [seems odd]
8045 INC HL
8046 CP (HL)
8047 JR NZ,ls_load_header Loop to ls_load_header if not
8049 ADD A,$B0 Make it ASCII and terminate it by adding 48+128
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,ls_8032 not the wanted stage
8056 CALL ls_8088 Call ls_8088
8059 CALL tape_load_to_5c00 Call tape_load_to_5c00
805C JR NC,ls_8025 Jump to ls_8025 if no carry
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 ls_8098 Call ls_8098
806F PUSH HL Preserve ?
Wait for a keypress - debounce.
load_stage_0 8070 CALL keyscan Call keyscan
8073 AND $10 Loop while key not pressed
8075 JR Z,load_stage_0
load_stage_1 8077 CALL keyscan Call keyscan
807A AND $10 Loop while key pressed
807C JR NZ,load_stage_1
807E LD A,$08 Forward transition
8080 CALL setup_transition Call setup_transition
8083 POP HL Restore ?
8084 LD B,$02 B = 2
8086 JR ls_8098 Exit via ls_8098
B is passed in.
ls_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,ls_8095 Jump if > 0
This entry point is used by the routine at speech_samples_table.
load_stage_2 8091 INC B
8092 LD HL,$8169 Point HL at tape_messsages
ls_8095 8095 CALL ls_8098 why call adjacent instr? to exec this func twice?
ls_8098 8098 PUSH BC preserve counter
8099 PUSH HL preserve message pointer
ls_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.
ls_809D 809D CALL print_message Call print_message
80A0 DJNZ ls_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_3 80AA LD A,($A231) Load transition_control
80AD AND A Return if zero
80AE RET Z
80AF LD DE,$0A00 Delay loop
load_stage_4 80B2 DEC DE
80B3 LD A,D
80B4 OR E
80B5 JR NZ,load_stage_4
80B7 JR ls_8098 Loop
Prev: 8008 Up: Map Next: 80B9