This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
Name: TT15 Type: Subroutine Category: Drawing lines Summary: Draw a set of crosshairs
For all views except the Short-range Chart, the centre is drawn 24 pixels to the right of the y-coordinate given.
This variation is blank in the Cassette, Disc (flight), Disc (docked), Master and Electron versions.
The crosshairs are drawn in colour 3, which is white in the chart view and cyan elsewhere. We can draw them in the current colour by calling the TT15b entry point.
Arguments: QQ19 The pixel x-coordinate of the centre of the crosshairs QQ19+1 The pixel y-coordinate of the centre of the crosshairs QQ19+2 The size of the crosshairs
This variation is blank in the Cassette, Disc (flight), Disc (docked), Master and Electron versions.
Other entry points: TT15b Draw the crosshairs in the current colour
.TT15
This variation is blank in the Cassette, Disc (flight), Disc (docked), Master and Electron versions.
The Master version uses variables to define the size of the Long-range Chart.
Tap on a block to expand it, and tap it again to revert.
STA QQ19+5 \ Set QQ19+5 to A, which now contains the correct indent \ for this view LDA QQ19 \ Set A = crosshairs x-coordinate - crosshairs size SEC \ to get the x-coordinate of the left edge of the SBC QQ19+2 \ crosshairs
In the Master version, the horizontal crosshair doesn't overlap the left border of the Short-range Chart, while it does in the other versions.
This variation is blank in the Master version.
BCS TT84 \ If the above subtraction didn't underflow, then A is \ positive, so skip the next instruction LDA #0 \ The subtraction underflowed, so set A to 0 so the \ crosshairs don't spill out of the left of the screen
.TT84
LDA QQ19 \ Set A = crosshairs x-coordinate + crosshairs size CLC \ to get the x-coordinate of the right edge of the ADC QQ19+2 \ crosshairs
This variation is blank in the Master version.
Tap on a block to expand it, and tap it again to revert.
LDA QQ19+1 \ Set A = crosshairs y-coordinate - crosshairs size SEC \ to get the y-coordinate of the top edge of the SBC QQ19+2 \ crosshairs BCS TT86 \ If the above subtraction didn't underflow, then A is \ correct, so skip the next instruction LDA #0 \ The subtraction underflowed, so set A to 0 so the \ crosshairs don't spill out of the top of the screen .TT86
LDA QQ19+1 \ Set A = crosshairs y-coordinate + crosshairs size CLC \ + indent to get the y-coordinate of the bottom edge ADC QQ19+2 \ of the indented crosshairs ADC QQ19+5
The Master version uses variables to define the size of the Long-range Chart.
Tap on a block to expand it, and tap it again to revert.
LDX QQ11 \ A >= 152, so we need to check whether this will fit in \ this view, so fetch the view type BMI TT87 \ If this is the Short-range Chart then the y-coordinate \ is fine, so skip to TT87
The bottom border of the Long-range Chart is one pixel lower down the screen in the Master version than in the other versions, and it uses variables to define the chart size, so the crosshair-clipping code is slightly different too.
Tap on a block to expand it, and tap it again to revert.
.TT87
STA XX15+3 \ Set XX15+3 (Y2) = A (the y-coordinate of the bottom \ edge of the crosshairs) LDA QQ19 \ Set XX15 (X1) = the x-coordinate of the centre of the STA XX15 \ crosshairs STA XX15+2 \ Set XX15+2 (X2) = the x-coordinate of the centre of \ the crosshairs
JMP LL30 \ Draw a vertical line from (X1, Y1) to (X2, Y2), which \ will draw from the top edge of the crosshairs to the \ bottom edge, through the centre of the crosshairs, \ and returning from the subroutine using a tail call