Skip to navigation


Track geometry: GetVergeAndMarkers (Part 4 of 4)

Name: GetVergeAndMarkers (Part 4 of 4) [Show more] Type: Subroutine Category: Track geometry Summary: Store details of the segment's verge marks
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.gmar9 \ The verge marks are either black-white-black-white \ or red-white-red-white, so we now work out which of \ these colours applies to this segment TXA \ If bit 0 of X is clear, then this is a non-white verge AND #%00000001 \ mark, so jump to gmar10 to set A = V to use as the BEQ gmar10 \ vergeDataRight for this segment LDA #2 \ Otherwise this is a white verge mark, so set A = 2 \ to use as the vergeDataRight for this segment BNE gmar11 \ Jump to gmar11 (this BNE is effectively a JMP as A is \ never zero) .gmar10 LDA V \ Set A = V, which is 0 (black verge mark) or 1 (red \ verge mark) .gmar11 LDY segmentListPointer \ Set Y to the index of the current entry in the track \ segment list STA vergeDataRight,Y \ Store A in the segment's corresponding vergeDataRight, \ so that's 2 for a white verge mark, 1 for a red verge \ mark, and 0 for a black verge mark LDA LL \ Set A to the segment's pitch angle, from the point \ of view of the player STA yVergeRight,Y \ Store the result in the segment's entry in yVergeRight \ to set the segment's pitch angle CMP #80 \ If the pitch angle is 80 or more, jump to gmar12 BCS gmar12 \ to return from the subroutine CMP horizonLine \ If the pitch angle is less than horizonLine, jump BCC gmar12 \ to gmar12 to return from the subroutine \ If we get here then the pitch angle in A is less \ than 80 and is greater or equal to horizonLine STA horizonLine \ This track segment is higher than the current horizon \ pitch angle, so the track obscures the horizon and we \ need to update horizonLine to this new pitch angle STY horizonListIndex \ Set horizonListIndex to the track segment number in Y .gmar12 RTS \ Return from the subroutine