Prev: 55442 Up: Map Next: 55678
55444: Level Complete
Used by the routine at Handler_IsLevelComplete.
LevelComplete 55444 LD HL,55354 HL=Time.
55447 RES 0,(HL) Reset bit 0 of *HL.
55449 LD HL,55353 HL=55353.
55452 SET 7,(HL) Set bit 7 of *HL.
55454 CALL Colourise_PreviewGrid Call Colourise_PreviewGrid.
55457 LD HL,22565 HL=22565 (attribute buffer location).
55460 LD B,4 B=4.
LevelComplete_0 55462 PUSH BC Stash BC on the stack.
55463 LD B,16 B=16.
LevelComplete_1 55465 LD (HL),0 Write 0 to *HL.
55467 INC HL Increment HL by one.
55468 DJNZ LevelComplete_1 Decrease counter by one and loop back to LevelComplete_1 until counter is zero.
55470 LD DE,16 HL+=0016.
55473 ADD HL,DE
55474 POP BC Restore BC from the stack.
55475 DJNZ LevelComplete_0 Decrease counter by one and loop back to LevelComplete_0 until counter is zero.
55477 LD BC,250 BC=0250.
55480 DI Disable interrupts.
LevelComplete_2 55481 LD D,14 D=14.
55483 LD A,5 A=5.
LevelComplete_3 55485 OUT (254),A Send to the speaker.
55487 XOR %00010000 Flip bit 4.
55489 LD E,C E=C.
LevelComplete_4 55490 DEC E Decrease E by one.
55491 JR NZ,LevelComplete_4 Jump to LevelComplete_4 if E is not zero.
55493 DEC D Decrease D by one.
55494 JR NZ,LevelComplete_3 Jump to LevelComplete_3 if D is not zero.
55496 DEC BC Decrease BC by one.
55497 LD A,B Jump to LevelComplete_2 if BC is not zero.
55498 OR C
55499 JR NZ,LevelComplete_2
55501 EI Enable interrupts.
55502 CALL ExtraLife Call ExtraLife.
55505 LD B,100 B=100.
LevelComplete_5 55507 HALT Halt operation (suspend CPU until the next interrupt).
55508 DJNZ LevelComplete_5 Decrease counter by one and loop back to LevelComplete_5 until counter is zero.
55510 DI Disable interrupts.
55511 LD HL,55354 HL=Time.
55514 LD (HL),128 Write 128 to *HL.
LevelComplete_6 55516 CALL 64621 Call 64621.
55519 LD A,(55390) A=*TimeBar_Length.
55522 INC A Increment A by one.
55523 LD D,A D=A.
55524 LD E,125 E=125.
55526 LD H,1 H=1.
LevelComplete_7 55528 LD A,(HL) A=*HL.
55529 AND %00011000 Keep only bits 3-4.
55531 OR %00000101 Set bits 0, 2.
55533 OUT (254),A Set border to the colour held by A.
55535 INC HL Increment HL by one.
55536 LD B,D B=D.
LevelComplete_8 55537 DJNZ LevelComplete_8 Decrease counter by one and loop back to LevelComplete_8 until counter is zero.
55539 DEC E Decrease E by one.
55540 JP NZ,LevelComplete_7 Jump to LevelComplete_7 if E is not zero.
55543 LD HL,55354 HL=Time.
55546 BIT 4,(HL) Test bit 4 of *HL.
55548 JR NZ,LevelComplete_10 Jump to LevelComplete_10 if E is not zero.
55550 LD A,(55360) A=*55360.
55553 AND A Set flags.
55554 INC A Increment A by one.
55555 DAA DAA.
55556 LD (55360),A Write A to *55360.
55559 JR NC,LevelComplete_9 Jump to LevelComplete_9 if A is higher.
55561 LD A,(55359) A=*55359.
55564 CCF Invert the carry flag.
55565 INC A Increment A by one.
55566 DAA DAA.
55567 LD (55359),A Write A to *55359.
LevelComplete_9 55570 CALL Print_Bonus Call Print_Bonus.
55573 JP LevelComplete_6 Jump to LevelComplete_6.
LevelComplete_10 55576 LD HL,55361 HL=55361.
55579 LD A,(55414) A=*Score_Digit_03.
55582 AND A Set flags.
55583 ADD A,(HL) A+=*HL.
55584 DAA DAA.
55585 LD (55414),A Write A to *Score_Digit_03.
55588 LD (HL),0 Write 0 to *HL.
55590 DEC HL Decrease HL by one.
55591 LD A,(55413) A=*Score_Digit_02.
55594 ADC A,(HL) A+=*HL.
55595 DAA DAA.
55596 LD (55413),A Write A to *Score_Digit_02.
55599 LD (HL),0 Write 0 to *HL.
55601 DEC HL Decrease HL by one.
55602 LD A,(55412) A=*Score_Digit_01.
55605 ADC A,(HL) A+=*HL.
55606 DAA DAA.
55607 LD (55412),A Write A to *Score_Digit_01.
55610 LD (HL),0 Write 0 to *HL.
55612 LD HL,61674 HL=61674.
55615 LD B,35 B=35.
55617 CALL 61258 Call 61258.
55620 CALL Print_Bonus Call Print_Bonus.
55623 CALL Print_Score Call Print_Score.
55626 LD A,(55405) Jump to LevelComplete_11 if *55405 is not equal to 0.
55629 CP 0
55631 JR NZ,LevelComplete_11
55633 LD A,(55412) A=*Score_Digit_01.
55636 AND %11110000 Keep only bits 4-7.
55638 RRCA RRCA.
55639 RRCA
55640 RRCA
55641 RRCA
55642 CP 1 Jump to LevelComplete_11 if A is lower than 1 (unsigned comparison).
55644 JP M,LevelComplete_11
55647 LD A,1 Write 1 to *55405.
55649 LD (55405),A
55652 CALL ExtraLife Call ExtraLife.
55655 CALL 59866 Call 59866.
LevelComplete_11 55658 LD A,128 Write 128 to *Bomb.
55660 LD (55352),A
LevelComplete_12 55663 CALL Handler_PlayerInput Call Handler_PlayerInput.
55666 CP 0 Jump back to LevelComplete_12 until there's any player input.
55668 JR Z,LevelComplete_12
55670 XOR A Write 0 to *Bomb.
55671 LD (55352),A
55674 CALL 61025 Call 61025.
55677 RET Return.
Prev: 55442 Up: Map Next: 55678