Skip to navigation

Aviator on the BBC Micro

Main loop: MainLoop (Part 14 of 15)

Name: MainLoop (Part 14 of 15) [Show more] Type: Subroutine Category: Main loop Summary: Handle the score display Deep dive: Program flow of the main game loop
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
LDA scoreDisplayTimer \ If scoreDisplayTimer = 0, jump to main22 to skip the BEQ main22 \ following three instructions, as we are not currently \ displaying the score CMP #220 \ If scoreDisplayTimer <> 220, jump down to main23 to BNE main23 \ decrement the timer and keep displaying the score BEQ main24 \ If scoreDisplayTimer = 220, it's time to remove the \ score from the screen, so jump down to main24 .main22 LDX #&C8 \ Scan the keyboard to see if "P" is being pressed JSR ScanKeyboard BNE main25 \ If "P" is not being pressed, jump to main25 to \ continue with the main loop .main23 \ If we get here then either we just pressed "P" or the \ score is already being displayed, so in either case we \ should update the timer and display the score DEC scoreDisplayTimer \ Decrement the score timer JSR DisplayScore \ Display the score, so we show it for the first time if \ we just pressed "P", or update it if it changes while \ being displayed JMP main25 \ Jump down to main25 to continue with the main loop .main24 JSR RemoveScore \ Remove the score from the screen LDA #0 \ Set scoreDisplayTimer = 0 as we are no longer showing STA scoreDisplayTimer \ the score on-screeen