.ClearTotalRaceTime LDA numberOfLaps \ Compare numberOfLaps with the driver X's lap number CMP driverLapNumber,X LDA #%11000000 \ Set bits 6 and 7 of the status byte for driver X's car STA objectStatus,X \ object, so it's hidden (bit 7) and is no longer racing \ (bit 6) BCC clap1 \ If numberOfLaps < driver X's lap number, then the \ driver has finished the race, so skip the following \ instruction STA totalRaceMinutes,X \ The player didn't finish the race, so set the player's \ total race time to &C0 minutes, or 120 minutes .clap1 RTS \ Return from the subroutineName: ClearTotalRaceTime [Show more] Type: Subroutine Category: Drivers Summary: Clear a specified driver's total race time following the end of an incomplete raceContext: See this subroutine in context in the source code References: This subroutine is called as follows: * FinishRace calls ClearTotalRaceTime
Arguments: X The driver number
[X]
Label clap1 is local to this routine
[X]
Variable driverLapNumber in workspace Main variable workspace
The current lap number for each driver
[X]
Variable numberOfLaps in workspace Zero page
The number of laps in the race (5, 10 or 20)
[X]
Variable objectStatus in workspace Stack variables
Various status flags for each object
[X]
Variable totalRaceMinutes in workspace Main variable workspace
Minutes of each driver's total race time, stored in BCD