.game1 LDA #0 \ Set competitionStarted = 0, to indicate that the STA competitionStarted \ competition hasn't started yet (so we still need to \ get the race class, the number of laps, and the \ players' names) LDX #21 \ Print token 21, which shows a menu with the following JSR PrintToken \ options: \ \ Prompt = SELECT THE CLASS OF RACE \ \ 1 = Novice \ \ 2 = Amateur \ \ 3 = Professional LDX #3 \ Fetch the menu choice into X (0 to 2) JSR GetMenuOption STX raceClass \ Set raceClass to the chosen race class (0 to 2) JSR GetSectionSteering \ Set up the optimum steering for each section for this \ race class, storing the results in sectionSteering .game2 LDX #22 \ Print token 22, which shows a menu with the following JSR PrintToken \ options: \ \ Prompt = SELECT DURATION OF QUALIFYING LAPS \ \ 1 = 5 mins \ \ 2 = 10 mins \ \ 3 = 20 mins LDX #3 \ Fetch the menu choice into X (0 to 2) JSR GetMenuOption LDA timeFromOption,X \ Set the value of qualifyingTime to 4, 9 or 25, which STA qualifyingTime \ should be the number of minutes of qualifying time \ minus one, but the latter seems to be a bugName: MainLoop (Part 2 of 6) [Show more] Type: Subroutine Category: Main loop Summary: The main game loop: competition setup Deep dive: Program flow of the main game loopContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
This part of the main loop gets all the general information required for the competition: the race class and the duration of qualifying laps.
[X]
Subroutine GetSectionSteering (category: Tactics)
Calculate the optimum steering for each track section
[X]
Subroutine PrintToken (category: Text)
Print a recursive token
[X]
Variable competitionStarted (category: Drivers)
A flag to indicate whether or not the competition has started
[X]
Variable qualifyingTime (category: Drivers)
The number of minutes of qualifying lap time
[X]
Variable raceClass (category: Drivers)
The class of the current race
[X]
Variable timeFromOption (category: Keyboard)
Table to convert from the option numbers in the qualifying lap duration menu to the actual number of minutes