Skip to navigation


Charts: TT105

[BBC Micro cassette version]

Name: TT105 [Show more] Type: Subroutine Category: Charts Summary: Draw crosshairs on the Short-range Chart, with clipping
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * TT103 calls TT105

Check whether the crosshairs are close enough to the current system to appear on the Short-range Chart, and if so, draw them.
.TT105 LDA QQ9 \ Set A = QQ9 - QQ0, the horizontal distance between the SEC \ crosshairs (QQ9) and the current system (QQ0) SBC QQ0 CMP #38 \ If the horizontal distance in A < 38, then the BCC TT179 \ crosshairs are close enough to the current system to \ appear in the Short-range Chart, so jump to TT179 to \ check the vertical distance CMP #230 \ If the horizontal distance in A < -26, then the BCC TT180 \ crosshairs are too far from the current system to \ appear in the Short-range Chart, so jump to TT180 to \ return from the subroutine (as TT180 contains an RTS) .TT179 ASL A \ Set QQ19 = 104 + A * 4 ASL A \ CLC \ 104 is the x-coordinate of the centre of the chart, ADC #104 \ so this sets QQ19 to the screen pixel x-coordinate STA QQ19 \ of the crosshairs LDA QQ10 \ Set A = QQ10 - QQ1, the vertical distance between the SEC \ crosshairs (QQ10) and the current system (QQ1) SBC QQ1 CMP #38 \ If the vertical distance in A is < 38, then the BCC P%+6 \ crosshairs are close enough to the current system to \ appear in the Short-range Chart, so skip the next two \ instructions CMP #220 \ If the horizontal distance in A is < -36, then the BCC TT180 \ crosshairs are too far from the current system to \ appear in the Short-range Chart, so jump to TT180 to \ return from the subroutine (as TT180 contains an RTS) ASL A \ Set QQ19+1 = 90 + A * 2 CLC \ ADC #90 \ 90 is the y-coordinate of the centre of the chart, STA QQ19+1 \ so this sets QQ19+1 to the screen pixel x-coordinate \ of the crosshairs LDA #8 \ Set QQ19+2 to 8 denote crosshairs of size 8 STA QQ19+2 JMP TT15 \ Jump to TT15 to draw crosshairs of size 8 at the \ crosshairs coordinates, returning from the subroutine \ using a tail call