Skip to navigation

Revs on the BBC Micro

Car geometry: MovePlayerBack

Name: MovePlayerBack [Show more] Type: Subroutine Category: Car geometry Summary: Move the player's car backwards by one track segment and update the track segment buffer
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MovePlayerSegment calls MovePlayerBack

This routine reverses the player, updating the track segment buffer in both directions.
.MovePlayerBack SEC \ Set the C flag so the call to MovePlayer moves the \ player's car in the opposite direction to which it is \ pointing JSR MovePlayer \ Drive the player's car backwards by one track segment LDX #40 \ Set X = 40, so the call to TurnPlayerAround \ initialises 64 track segments in the new direction STX resetSectionList \ Set resetSectionList to a non-zero value, so if the \ calls to TurnPlayerAround need to fetch load a new \ track section, then we reset the track section list JSR TurnPlayerAround \ Turn the player around and initialise 40 track \ segments in the new direction LDX #39 \ Set X = 39, so the call to TurnPlayerAround \ initialises 64 track segments in the new direction JSR TurnPlayerAround \ Turn the player back around and initialise 39 track \ segments in the new direction LDA #0 \ Set resetSectionList = 0, so future calls to the STA resetSectionList \ TurnPlayerAround routine will update the track section \ list as normal RTS \ Return from the subroutine