.GetPlayerIndex LDA frontSegmentIndex \ Set A = the front track segment index * 3 - 96 SEC \ SBC #96 \ So this is 32 segments before the front track segment \ in the track segment buffer, as each buffer entry has \ three bytes BPL zsta1 \ If A < 0, set A = A + 120, so the index number wraps CLC \ around to the end of the stack ADC #120 .zsta1 STA playerSegmentIndex \ Set playerSegmentIndex to the updated index RTS \ Return from the subroutineName: GetPlayerIndex [Show more] Type: Subroutine Category: Track geometry Summary: Set the index for the player's segment in the track section buffer to be 32 segments behind the front segment Deep dive: Data structures for the track calculationsContext: See this subroutine in context in the source code References: This subroutine is called as follows: * GetTrackSegment (Part 3 of 3) calls GetPlayerIndex
[X]
Variable frontSegmentIndex in workspace Zero page
Used to store the index * 3 of the front track segment in the track segment buffer
[X]
Variable playerSegmentIndex in workspace Zero page
Used to store the index * 3 of the track segment containing the player's car in the track segment buffer
[X]
Label zsta1 is local to this routine