IF _SUPERIOR OR _REVSPLUS .GetColourSup CPY horizonLine \ If Y <= horizonLine then the byte we want to check is BCC scol1 \ below the horizon, so jump to scol1 to work out the BEQ scol1 \ byte's colour LDA colourPalette+1 \ Otherwise the byte is in the sky, so set A to logical \ colour 1 (blue) from the colour palette RTS \ Return from the subroutine .scol1 LDA blockNumber \ Set A to the block number containing the pixel byte \ that we want to check CMP rightGrassStart,Y \ If A >= rightGrassStart for this track line, then the BCS scol3 \ pixel byte is in the grass to the right of the track, \ so jump to scol3 to return colour 3 (green) CMP rightVergeStart,Y \ If A >= rightVergeStart for this track line, then the BCS scol5 \ pixel byte is on the right track verge, so jump to \ scol5 to work out its colour CMP leftTrackStart,Y \ If A >= leftTrackStart for this track line, then the BCS scol2 \ pixel byte is on the track, so jump to scol2 to return \ colour 0 (black) CMP leftVergeStart,Y \ If A >= leftVergeStart for this track line, then the BCS scol4 \ pixel byte is on the left track verge, so jump to \ scol4 to work out its colour LDA backgroundColour,Y \ If we get here then the byte is to the left of the \ left track verge, so set A to the background colour of \ this track line so we can extract the colour from bits \ 0-1 below BCC scol7 \ Jump to scol7 to return the pixel byte for the colour \ in A (this BCC is effectively a JMP as we just passed \ through a BCS) .scol2 LDA colourPalette \ Set A to logical colour 0 (black) from the colour \ palette RTS \ Return from the subroutine .scol3 LDA colourPalette+3 \ Set A to logical colour 3 (green) from the colour \ palette RTS \ Return from the subroutine .scol4 \ If we get here then the pixel byte is on the left \ track verge CPY vergeTopLeft \ If the track line in Y >= vergeTopLeft, jump to scol3 BCS scol3 \ to return colour 3 (green) LDA leftSegment,Y \ Set A to the index within the track segment list of \ the segment for the left verge on this track line JMP scol6 \ Jump to scol6 .scol5 \ If we get here then the pixel byte is on the right \ track verge CPY vergeTopRight \ If the track line in Y >= vergeTopRight, jump to scol3 BCS scol3 \ to return colour 3 (green) LDA rightSegment,Y \ Set A to the index within the track segment list of \ the segment for the right verge on this track line .scol6 AND #%01111111 \ Clear bit 7 of A TAX \ Set X to A LDA vergeDataRight-1,X \ Set A to entry X - 1 from vergeDataRight, which \ contains the colour of the verge mark for the segment \ beyond segment X .scol7 AND #%00000011 \ Extract the colour number from bits 0-1 of A into X TAX LDA colourPalette,X \ Set A to logical colour X from the colour palette RTS \ Return from the subroutine ENDIFName: GetColourSup [Show more] Type: Subroutine Category: Screen buffer Summary: Calculate the colour of a specific pixel byte in the screen bufferContext: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawObjectEdge (Part 4 of 5) calls GetColourSup * FillAfterObjectSup calls GetColourSup
Arguments: Y The track line number of the pixel byte to check blockNumber The dash data block number of the pixel byte to check
Returns: A The colour of this pixel byte in the screen buffer
[X]
Variable backgroundColour (category: Screen buffer)
The background colour for each track line
[X]
Variable blockNumber in workspace Zero page
The dash data block number for the current edge
[X]
Variable colourPalette (category: Drawing pixels)
The main colour palette that maps logical colours 0 to 3 to physical colours
[X]
Variable horizonLine in workspace Zero page
The track line number of the horizon
[X]
Variable leftSegment in workspace Main variable workspace
For each track line, the index of the segment within the track segment list for the left verge
[X]
Variable leftTrackStart in workspace Main variable workspace
For each track line, the block number where the track starts (i.e. the left edge of the black track)
[X]
Variable leftVergeStart in workspace Main variable workspace
For each track line, the block number where the left track verge starts
[X]
Variable rightGrassStart in workspace Main variable workspace
For each track line, the block number where the grass starts to the right of the track
[X]
Variable rightSegment in workspace Main variable workspace
For each track line, the index of the segment within the track segment list for the right verge
[X]
Variable rightVergeStart in workspace Main variable workspace
For each track line, the block number where the right track verge starts
[X]
Label scol1 is local to this routine
[X]
Label scol2 is local to this routine
[X]
Label scol3 is local to this routine
[X]
Label scol4 is local to this routine
[X]
Label scol5 is local to this routine
[X]
Label scol6 is local to this routine
[X]
Label scol7 is local to this routine
[X]
Variable vergeDataRight (category: Track geometry)
Data (such as colour) for the verge marks on the right side of the track
[X]
Variable vergeTopLeft in workspace Zero page
The track line just above the segment at vergeDepthOfField (i.e. the furthest segment that might contain a verge) when drawing the left verge
[X]
Variable vergeTopRight in workspace Zero page
The track line just above the segment at vergeDepthOfField (i.e. the furthest segment that might contain a verge) when drawing the right verge