Skip to navigation

Main loop: MainLoop (Part 1 of 6)

Name: MainLoop (Part 1 of 6) [Show more] Type: Subroutine Category: Main loop Summary: The main game loop: practice laps Deep dive: Program flow of the main game loop
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * CheckRestartKeys calls MainLoop * SetupGame calls MainLoop

This part of the main loop implements practice laps.
.MainLoop LDX #0 \ Set configStop = 0 so we clear out any existing STX configStop \ stop-related key presses JSR InitialiseDrivers \ Initialise all 20 drivers LDX #4 \ Print "REVS REVS REVS" as a double-height header JSR PrintHeader \ at column 0, row 4, with the colours of each letter in \ REVS set to magenta/yellow/cyan/green JSR PrintHeaderChecks \ Print chequered lines above and below the header LDX #39 \ Print token 39, which shows a menu with the following JSR PrintToken \ options: \ \ 1 = PRACTICE \ \ 2 = COMPETITION LDX #2 \ Fetch the menu choice into X (0 to 1) JSR GetMenuOption CPX #1 \ If X >= 1, then the choice was competition, so jump to BCS game1 \ game1 to start setting up the competition races STX currentPlayer \ Otherwise X = 0 and the choice was practice, so set \ currentPlayer = 0 DEX \ Set qualifyingTime = 255, so that the time we spend STX qualifyingTime \ practicing is as long as we want JSR ResetBestLapTimes \ Reset the best lap times to 10:00.0 for all drivers JSR HeadToTrack \ Head to the track to choose the wing settings and \ start the practice laps, which the player exits by \ pressing SHIFT and right arrow to restart the game \ (so we don't return from this call)