.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)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 loopContext: 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.
[X]
Subroutine HeadToTrack (category: Main Loop)
Get the wing settings and start a race, practice or qualifying lap
[X]
Subroutine InitialiseDrivers (category: Drivers)
Initialise all 20 drivers on the starting grid
[X]
Subroutine PrintHeader (category: Text)
Configure and print a double-height header in screen mode 7
[X]
Subroutine PrintHeaderChecks (category: Text)
Print chequered lines above and below the header
[X]
Subroutine PrintToken (category: Text)
Print a recursive token
[X]
Subroutine ResetBestLapTimes (category: Drivers)
Reset the best lap times to 10:00.0 for all drivers
[X]
Variable configStop in workspace Main variable workspace
A key has been pressed that stops the race
[X]
Variable currentPlayer in workspace Zero page
The number of the current player
[X]
Label game1 in subroutine MainLoop (Part 2 of 6)
[X]
Variable qualifyingTime (category: Drivers)
The number of minutes of qualifying lap time