.DrawGrassLeft CPX #128 \ If X <> 128 then the pixel byte has already been drawn BNE gral2 \ in the calling routine (i.e. DrawShallowToLeft or \ DrawShallowToRight), so jump to gral2 to return from \ the subroutine CPY #44 \ If Y >= 44, jump to gral1 to skip the following check, BCS gral1 \ as offsets of 44 and above are always within a dash \ data block JSR CheckDashData \ Check whether offset Y points to dash data within \ block UU, clearing the C flag if it does BCC gral2 \ If offset Y does not point to dash data, jump to gral2 \ to return from the subroutine .gral1 TAX \ Y points into dash data, so set the Y-th byte of (S R) LDA #%11111111 \ to four pixels of colour 3 (green) STA (R),Y TXA .gral2 LDX #128 \ Set X = 128 to reset the draw detection logic for the \ next byte to draw CLC \ Clear the C flag RTS \ Return from the subroutineName: DrawGrassLeft [Show more] Type: Subroutine Category: Drawing the track Summary: Draw a green byte into the screen buffer in the first dash data block for the edge Deep dive: Drawing the track vergesContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawSegmentEdge (Part 6 of 7) calls DrawGrassLeft * DrawShallowToLeft calls DrawGrassLeft * DrawShallowToRight calls DrawGrassLeft
Arguments: X The value of X from the current drawing routine: * 0 to 3 if a pixel byte has already been drawn * 128 is no pixel byte has been drawn so far Y The track line to draw on (0 to 79) (S R) Address of the first dash data block in the memory page containing the pixels at the start of the previous edge
Returns: X 128 A A is unchanged C flag Clear
[X]
Subroutine CheckDashData (category: Screen buffer)
Check whether a dash data block index is pointing to dash data
[X]
Label gral1 is local to this routine
[X]
Label gral2 is local to this routine