.SetSectionPointers INX \ Set X = X + 1 \ \ So X points to the entry above the proposed pointer \ value in the list CPX sectionListValid \ If X >= sectionListValid, then this entry is valid, so BCS secp1 \ jump to secp1 to skip the following STX sectionListValid \ Set sectionListValid = X, so the value at the proposed \ pointer is flagged as not valid, but the value above \ it is valid .secp1 DEX \ Set X = X - 1 \ \ so X is back to its original value, the proposed value \ of sectionListPointer CPX sectionListStart \ If X >= sectionListStart, then the proposed pointer BCS secp2 \ value is not before the start of the list, so jump to \ secp2 to skip the following LDX #5 \ The proposed pointer is not within the list, so set \ X = 5, so we set sectionListPointer to 5 below .secp2 CPX #6 \ If X < 6, then the proposed pointer value is not past BCC secp3 \ the end of the list, so jump to secp3 to skip the \ following LDX #5 \ The proposed pointer is past the end of the list, so \ set X = 5, so we set sectionListPointer to 5 below .secp3 STX sectionListPointer \ Store the updated value of X in sectionListPointer RTS \ Return from the subroutineName: SetSectionPointers [Show more] Type: Subroutine Category: Track geometry Summary: Set the track section list pointer to a specific value and update the validity pointer accordinglyContext: See this subroutine in context in the source code References: This subroutine is called as follows: * GetSectionAngles (Part 3 of 3) calls SetSectionPointers
Arguments: X The new value for sectionListPointer
[X]
Label secp1 is local to this routine
[X]
Label secp2 is local to this routine
[X]
Label secp3 is local to this routine
[X]
Variable sectionListPointer in workspace Zero page
The index of the current entry in the track section list, as we only update one entry in the list on each iteration of the main driving loop
[X]
Variable sectionListStart in workspace Zero page
The start index of the track section list that's used when calculating the positions of the track verges
[X]
Variable sectionListValid in workspace Zero page
The index of the first valid entry in the track section list