Prev: 46274 Up: Map Next: 46484
46382: 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 46382 DI Disable interrupts.
46383 LD DE,47658 DE=Tune_Briefing.
46386 CALL QueueTune Call QueueTune.
46389 RST 56 Call the ROM interrupt routine at MASK-INT.
46390 LD A,(24862) Fetch the hit count from 24862.
46393 CALL Convert_Base10 Call Convert_Base10.
Here we alter "hits" to update with the number of hits.
46396 LD HL,46688 HL=46688.
Write the tens digit, or a space when it is zero.
46399 LD C,A Stash the converted count in C.
46400 RRCA Rotate the tens digit into the low nibble.
46401 RRCA
46402 RRCA
46403 RRCA
46404 AND %00001111 Keep only bits 0-3.
46406 JR NZ,ShowLaserEstimate_WriteDigit Jump to ShowLaserEstimate_WriteDigit if the tens digit is not zero.
46408 LD A,240 A=240 (becomes a space after +48).
ShowLaserEstimate_WriteDigit 46410 ADD A,48 Add 48 to make an ASCII digit.
46412 LD (HL),A Write the tens character.
46413 INC HL Advance to the units position.
Write the units digit.
46414 LD A,C Copy the converted count into A.
46415 AND %00001111 Keep only bits 0-3.
46417 ADD A,48 Add 48 to make an ASCII digit.
46419 LD (HL),A Write the units character.
Flash the warning twelve times, beeping each time.
46420 CALL BlankPlayArea Call BlankPlayArea.
46423 LD B,12 Set a flash counter in B for 12 loops.
ShowLaserEstimate_Loop 46425 PUSH BC Stash BC on the stack.
46426 CALL ControlsPause Call ControlsPause.
46429 CALL Message_MissileLaunch Call Message_MissileLaunch.
46432 LD C,128 C=128 (pitch).
46434 LD D,128 D=128 (duration).
ShowLaserEstimate_Beep 46436 CALL PlaySquareWave Call PlaySquareWave.
46439 DEC D Decrease the duration by one.
46440 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.
46442 LD A,66 A=INK:RED, PAPER:BLACK (BRIGHT).
46444 LD (46556),A Write it to String_Warning.
46447 CALL Message_MissileLaunch Call Message_MissileLaunch.
46450 LD A,86 A=INK:YELLOW, PAPER:RED (BRIGHT).
46452 LD (46556),A Write it to String_Warning.
Pause before the next flash.
46455 LD HL,32768 HL=32768.
ShowLaserEstimate_Delay 46458 DEC HL Decrease HL by one.
46459 LD A,L Jump back to ShowLaserEstimate_Delay if HL is not zero.
46460 OR H
46461 JR NZ,ShowLaserEstimate_Delay
46463 POP BC Restore BC from the stack.
46464 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.
46466 LD DE,47578 DE=Tune_Laser_Estimate.
46469 CALL QueueTune Call QueueTune.
46472 CALL BlankPlayArea Call BlankPlayArea.
46475 CALL Handler_ResetLaserBeamSlots Call Handler_ResetLaserBeamSlots.
46478 CALL ResetAlienStates Call ResetAlienStates.
46481 JP ClearSpriteCaches Jump to ClearSpriteCaches.
Prev: 46274 Up: Map Next: 46484