Prev: B4C2 Up: Map Next: B594
B52E: Show Laser Estimate
Used by the routine at Handler_Missile_CopyTemplate.
Queue the briefing tune, write the hit count into the banner, then flash the warning while beeping.
Queue the briefing tune and write the hit-count digit.
ShowLaserEstimate B52E DI Disable interrupts.
B52F LD DE,$BA2A DE=Tune_Briefing.
B532 CALL QueueTune Call QueueTune.
B535 RST $38 Call the ROM interrupt routine at MASK-INT.
B536 LD A,($611E) Fetch the hit count from 611E.
B539 CALL Convert_Base10 Call Convert_Base10.
Here we alter "hits" to update with the number of hits.
B53C LD HL,$B660 HL=B660.
Write the tens digit, or a space when it is zero.
B53F LD C,A Stash the converted count in C.
B540 RRCA Rotate the tens digit into the low nibble.
B541 RRCA
B542 RRCA
B543 RRCA
B544 AND %00001111 Keep only bits 0-3.
B546 JR NZ,ShowLaserEstimate_WriteDigit Jump to ShowLaserEstimate_WriteDigit if the tens digit is not zero.
B548 LD A,$F0 A=F0 (becomes a space after +30).
ShowLaserEstimate_WriteDigit B54A ADD A,$30 Add 30 to make an ASCII digit.
B54C LD (HL),A Write the tens character.
B54D INC HL Advance to the units position.
Write the units digit.
B54E LD A,C Copy the converted count into A.
B54F AND %00001111 Keep only bits 0-3.
B551 ADD A,$30 Add 30 to make an ASCII digit.
B553 LD (HL),A Write the units character.
Flash the warning twelve times, beeping each time.
B554 CALL BlankPlayArea Call BlankPlayArea.
B557 LD B,$0C Set a flash counter in B for 0C loops.
ShowLaserEstimate_Loop B559 PUSH BC Stash BC on the stack.
B55A CALL ControlsPause Call ControlsPause.
B55D CALL Message_MissileLaunch Call Message_MissileLaunch.
B560 LD C,$80 C=80 (pitch).
B562 LD D,$80 D=80 (duration).
ShowLaserEstimate_Beep B564 CALL PlaySquareWave Call PlaySquareWave.
B567 DEC D Decrease the duration by one.
B568 JR NZ,ShowLaserEstimate_Beep Jump back to ShowLaserEstimate_Beep until it is zero.
Show the warning in the alternate colour, restore the original colour and pause.
B56A LD A,$42 A=INK:RED, PAPER:BLACK (BRIGHT).
B56C LD ($B5DC),A Write it to String_Warning.
B56F CALL Message_MissileLaunch Call Message_MissileLaunch.
B572 LD A,$56 A=INK:YELLOW, PAPER:RED (BRIGHT).
B574 LD ($B5DC),A Write it to String_Warning.
Pause before the next flash.
B577 LD HL,$8000 HL=8000.
ShowLaserEstimate_Delay B57A DEC HL Decrease HL by one.
B57B LD A,L Jump back to ShowLaserEstimate_Delay if HL is not zero.
B57C OR H
B57D JR NZ,ShowLaserEstimate_Delay
B57F POP BC Restore BC from the stack.
B580 DJNZ ShowLaserEstimate_Loop Decrease the flash count by one and jump back to ShowLaserEstimate_Loop until it is zero.
Queue a jingle, blank the play area and reset the laser beam slots and alien states before clearing the sprite caches.
B582 LD DE,$B9DA DE=Tune_Laser_Estimate.
B585 CALL QueueTune Call QueueTune.
B588 CALL BlankPlayArea Call BlankPlayArea.
B58B CALL Handler_ResetLaserBeamSlots Call Handler_ResetLaserBeamSlots.
B58E CALL ResetAlienStates Call ResetAlienStates.
B591 JP ClearSpriteCaches Jump to ClearSpriteCaches.
Prev: B4C2 Up: Map Next: B594