Skip to navigation


Tactics: ProcessOvertaking (Part 3 of 3)

Name: ProcessOvertaking (Part 3 of 3) [Show more] Type: Subroutine Category: Tactics Summary: Update the car status (if configured) and loop back for the next car
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.tact18 LDA carStatus,X \ Set the C flag to bit 0 of the car status flags for LSR A \ this driver LDA N \ Set A = N, to use as the new car status flags for this \ driver, but only when bit 0 of the current flag byte \ is set BCS tact19 \ If the C flag is set, i.e. bit 0 of the car status \ flags for this driver is set, jump to tact19 to skip \ the following instruction STA carStatus,X \ Set the car status flags for this driver to A (i.e. to \ the flags in N) .tact19 LDX W \ Set X to the position that we just checked, which we \ stored in W at the start of the loop JSR GetPositionBehind \ Set X to the number of the position behind position X, \ so we work backwards through the field CPX currentPosition \ If X = the current player's position, jump to tact20 BEQ tact20 \ to return from the subroutine JMP tact1 \ Otherwise jump back to tact1 to process the next \ driver in X .tact20 RTS \ Return from the subroutine