.IncSectionPointers LDX sectionListValid \ Set X = sectionListValid + 1 INX \ \ If the whole section list is valid, then this marks \ the first entry in the list as invalid, which we want \ to do as we just shuffled the list and inserted a \ dummy entry into the start of the list \ \ If the whole section is not valid, then this moves \ the valid pointer along with the shuffled entries CPX #6 \ If X < 6, then the new value of sectionListValid is BCC incp1 \ within the list, so jump to incp1 to skip the \ following LDX #6 \ Set X = 6, so the maximum value of sectionListValid \ is 6 .incp1 CPX sectionListStart \ If X >= sectionListStart, then the new value of BCS incp2 \ sectionListValid is within the list, so jump to incp2 \ to skip the following LDX sectionListStart \ Set X = sectionListStart, so the minimum value of \ sectionListValid is sectionListStart, at the start of \ the list .incp2 STX sectionListValid \ Store the updated value of X in sectionListValid, so \ we mark the new entry that we shuffled in as invalid LDX sectionListPointer \ Set X = sectionListPointer + 1 INX \ Fall through into SetSectionPointers to set the track \ section list pointer to the new value, i.e. increment \ the pointer so it moves along with the shuffled valuesName: IncSectionPointers [Show more] Type: Subroutine Category: Track geometry Summary: Increment the track section list pointers following a shuffle Deep dive: Data structures for the track calculationsContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ShuffleSectionList calls IncSectionPointers
This routine increments sectionListValid and sectionListPointer so they move along with the newly shuffled track section list.
[X]
Label incp1 is local to this routine
[X]
Label incp2 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