Skip to navigation

Revs on the BBC Micro

Drivers: GetPositionAhead

Name: GetPositionAhead [Show more] Type: Subroutine Category: Drivers Summary: Decrement X to the previous position number (from 19 to 0 and round again), which gives the position ahead of X
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * MoveAndDrawCars calls GetPositionAhead * ProcessOvertaking (Part 1 of 3) calls GetPositionAhead * SetDriverSpeed calls GetPositionAhead * SetPlayerPositions calls GetPositionAhead
.GetPositionAhead DEX \ Decrement X BPL prev1 \ If X is >= 0, jump to prev1 to skip the following \ instruction LDX #19 \ Set X = 19, so repeated calls to this routine will \ decrement X down to 0, and then start again at 19 .prev1 RTS \ Return from the subroutine