Skip to navigation

Revs on the BBC Micro

Tactics: GetSteeringAssist

Name: GetSteeringAssist [Show more] Type: Subroutine Category: Tactics Summary: Fetch the current computer assisted steering (CAS) status and show or hide the CAS indicator Deep dive: Computer assisted steering (CAS)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * AssistSteering calls GetSteeringAssist

The computer assisted steering (CAS) indicator is in the centre-bottom of the rev counter, and is made up of four pixels in colour 2 (white) as follows: ...xx... ..x..x.. which would be encoded in mode 5 screen memory as follows: %00010000 %10000000 %00100000 %01000000 This routine shows or hides the indicator according to the current setting of configAssist, returning the value of configAssist in X. Returns: X The current value of configAssist: * %10000000 if computer assisted steering is enabled * 0 if computer assisted steering is not enabled A A is unchanged C flag Set to bit 7 of directionFacing (clear if our car is facing forwards, set if we are facing backwards)
IF _SUPERIOR OR _REVSPLUS .GetSteeringAssist PHA \ Store A on the stack so we can retrieve it below LDA configAssist \ Set A to configAssist, which has the following value: \ \ * %10000000 if computer assisted steering is enabled \ \ * 0 if computer assisted steering is not enabled \ \ The following updates screen memory to add a small \ "hat" marker to the centre-bottom of the rev counter \ when CAS is enabled (or to to remove the marker when \ it isn't enabled) STA assistRight1 \ Set assistRight1 = 0 or %10000000 LSR A \ Set assistRight2 = 0 or %01000000 STA assistRight2 LSR A \ Set assistLeft2 = 0 or %00100000 STA assistLeft2 LSR A \ Set assistLeft1 = 0 or %00010000 STA assistLeft1 LDA directionFacing \ Set the C flag to bit 7 of directionFacing, which we ROL A \ return from the subroutine PLA \ Restore the value of A that we put on the stack above LDX configAssist \ Set X to configAssist RTS \ Return from the subroutine ENDIF