Prev: 6000 Up: Map Next: 6492
6380: Level Selection
Used by the routine at TitleScreen.
LevelSelect 6380 LD DE,$5B80 HL points to Print_TwoToneText_Alias on entry as DE is also Print_TwoToneText_Alias - this does nothing, it just creates a very short pause.
6383 LD BC,$0040
6386 LDIR
6388 LD HL,$4000 Writes 00 to all 1AFF bytes of the screen buffer (i.e. "blanks it").
638B LD DE,$4001
638E LD BC,$1AFF
6391 LD (HL),$00
6393 LDIR
6395 LD HL,$58A0 Writes 28 to 58A0 in the attribute buffer 0100 times.
Value Ink Paper Bright
28 00 05 00
6398 LD DE,$58A1
639B LD BC,$0100
639E LD (HL),$28
63A0 LDIR
63A2 LD (HL),$20 ...and 20 to the attribute buffer another 5F times (following on from the previous location).
Value Ink Paper Bright
20 00 04 00
63A4 LD BC,$005F
63A7 LDIR
Prints the labels to the screen.
63A9 LD HL,$64AC Pass LevelSelect_One to Print_LevelSelect (index "1").
63AC LD A,$01
63AE CALL Print_LevelSelect
63B1 LD HL,$64B3 Pass LevelSelect_Three to Print_LevelSelect (index "2").
63B4 LD A,$02
63B6 CALL Print_LevelSelect
63B9 LD HL,$64BA Pass LevelSelect_Six to Print_LevelSelect (index "3").
63BC LD A,$03
63BE CALL Print_LevelSelect
63C1 LD HL,$6492 Points to LevelSelect_Copy and sends it to Print_TwoToneText_Alias
Value Ink Paper Bright
07 07 00 00
06 06 00 00
63C4 LD DE,$4023
63C7 LD BC,$0706
63CA CALL Print_TwoToneText_Alias
Prints the images to the screen.
63CD LD A,$25 Calls LevelSelect_Graphics with (draw | 25) for index "1".
63CF LD B,$01
63D1 CALL LevelSelect_Graphics
63D4 LD A,$08 Calls LevelSelect_Graphics with (draw | 08) for index "2".
63D6 LD B,$02
63D8 CALL LevelSelect_Graphics
63DB LD A,$19 Calls LevelSelect_Graphics with (draw | 19) for index "3".
63DD LD B,$03
63DF CALL LevelSelect_Graphics
Loop for getting user keyboard input.
63E2 LD HL,$5CB1 Used later for setting the current level at Level.
LevelSelect_Input 63E5 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
63E7 IN A,($FE)
63E9 RRA If "1" is pressed, jump to LevelSelect_Level_01.
63EA JR NC,LevelSelect_Level_01
63EC RRA If "2" is pressed, jump to LevelSelect_Level_03.
63ED JR NC,LevelSelect_Level_03
63EF RRA If "3" is pressed, jump to LevelSelect_Level_06.
63F0 JR NC,LevelSelect_Level_06
63F2 JR LevelSelect_Input Cycle back to LevelSelect_Input.
Act on level being selected.
LevelSelect_Level_01 63F4 LD (HL),$01 Store $01 at Level and call LS_AnimateShot with (shot | 26) for index "1".
63F6 LD A,$26
63F8 LD B,$01
63FA CALL LS_AnimateShot
63FD LD A,$01 Jump to LevelSelect_Text_Flash with HL=LevelSelect_One and A=$01.
63FF LD HL,$64AC
6402 JP LevelSelect_Text_Flash
LevelSelect_Level_03 6405 LD (HL),$02 Store 02 at Level and call LS_AnimateShot with (shot | 09) for index "2".
6407 LD A,$09
6409 LD B,$02
640B CALL LS_AnimateShot
640E LD A,$02 Jump to LevelSelect_Text_Flash with HL=LevelSelect_Three and A=$02.
6410 LD HL,$64B3
6413 JP LevelSelect_Text_Flash
LevelSelect_Level_06 6416 LD (HL),$03 Store 03 at Level and call LS_AnimateShot with (shot | 1A) for index "3".
6418 LD A,$1A
641A LD B,$03
641C CALL LS_AnimateShot
641F LD A,$03 Jump to LevelSelect_Text_Flash with HL=LevelSelect_Six and A=03.
6421 LD HL,$64BA
6424 JP LevelSelect_Text_Flash
Animates the selected bandit being shot.
LS_AnimateShot 6427 PUSH BC
6428 CALL LevelSelect_Graphics Call LevelSelect_Graphics.
642B CALL Shot_Sound_01_Alias Call Shot_Sound_01_Alias.
642E LD B,$10 Short interrupt driven halt loop.
LS_AnimateShot_Halt_Loop 6430 HALT
6431 DJNZ LS_AnimateShot_Halt_Loop
6433 POP BC
6434 LD A,$27 Call LevelSelect_Graphics with (floor | 1B).
6436 CALL LevelSelect_Graphics
6439 RET Return.
Prints the images to the screen.
LevelSelect_Graphics 643A PUSH BC Stash the current counter and convert the accumulator which is holding a character ID into their memory location.
643B CALL Character_Address_Alias
643E EX DE,HL
643F POP AF
6440 LD HL,$40A2 Work out which screen position to use;
A Screen Address
01 40A2
02 40AD
03 40B8
6443 DEC A
6444 JR Z,LevelSelect_Graphics_Skip
6446 LD HL,$40AD
6449 DEC A
644A JR Z,LevelSelect_Graphics_Skip
644C LD HL,$40B8
LevelSelect_Graphics_Skip 644F LD B,$58 Set the dimensions and call Draw_Character.
6451 LD C,$06
6453 CALL Draw_Character
6456 RET Return.
Flashes the selected level text.
LevelSelect_Text_Flash 6457 LD B,$08 This prints LevelSelect_Whitespace and the passed level copy alternately with a delay caused by a HALT loop (which continues execution after an interrupt is fired), the sequence repeats 08 times.
6459 LD C,A
LevelSelect_Text_Flash_Loop 645A PUSH HL
645B PUSH BC
645C LD A,C
645D CALL Print_LevelSelect
6460 LD B,$10
LevelSelect_Flash_Halt_Loop_01 6462 HALT
6463 DJNZ LevelSelect_Flash_Halt_Loop_01
6465 LD HL,$64C1
6468 POP BC
6469 PUSH BC
646A LD A,C
646B CALL Print_LevelSelect
646E LD B,$10
LevelSelect_Flash_Halt_Loop_02 6470 HALT
6471 DJNZ LevelSelect_Flash_Halt_Loop_02
6473 POP BC
6474 POP HL
6475 DJNZ LevelSelect_Text_Flash_Loop
6477 LD A,C
6478 CALL Print_LevelSelect
647B RET Return.
Print level select copy to the screen.
Print_LevelSelect 647C LD DE,$5022 First, work out which screen position to use;
A Screen Address
01 5022
02 502D
03 5038
647F DEC A
6480 JR Z,LevelSelect_0
6482 LD DE,$502D
6485 DEC A
6486 JR Z,LevelSelect_0
6488 LD DE,$5038
LevelSelect_0 648B LD BC,$0702 Then call the print routine at Print_TwoToneText_Alias.
Value Ink Paper Bright
07 07 00 00
02 02 00 00
648E CALL Print_TwoToneText_Alias
6491 RET Return.
Prev: 6000 Up: Map Next: 6492