Skip to navigation

Revs on the BBC Micro

Main loop: MainLoop (Part 2 of 6)

Name: 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 loop
Context: 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.
.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 bug