Skip to navigation

Aviator on the BBC Micro

Flight model: Crash

Name: Crash [Show more] Type: Subroutine Category: Flight model Summary: Make a crashing sound, flash the canopy and start a new game
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * CheckFlyingSkills (Part 2 of 2) calls Crash * ProcessLanding (Part 6 of 7) calls Crash
.Crash LDA #0 \ Turn off the engine sound JSR ToggleEngineSound LDA #5 \ Make sound #5, the sound of a crash JSR MakeSound LDX #%11111111 \ Fill the canopy with white, leaving the canopy edges JSR FillCanopy \ alone, to give a flash effect LDA #10 \ Delay for 10^3 loop iterations JSR Delay JSR ClearCanopy \ Clear the canopy to black, leaving the canopy edges \ alone JSR DrawCanopyCorners \ Redraw the diagonal canopy corners, which were cleared \ by the flashing canopy effect LDA #90 \ Delay for 90^3 loop iterations JSR Delay JSR TerminateGame \ Terminate the game TSX \ Remove six bytes from the top of the stack, which TXA \ removes the top three return addresses that were put CLC \ there by JSR instructions. This enables us to jump ADC #6 \ straight back to NewGame without leaving any remnants TAX \ of the call stack behind TXS JMP NewGame \ Jump to NewGame to start a new game