Skip to navigation

Charts: TT105

[Apple II 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 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 #29 ; If the horizontal distance in A < 29, 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 #227 ; If the horizontal distance in A < -29, 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 = 105 + A * 4 ASL A ; CLC ; 105 is the x-coordinate of the centre of the chart, ADC #105*4/3 ; so this sets QQ19 to the screen pixel x-coordinate JSR SCALEY2 ; STA QQ19 ; ; The call to SCALEY2 reduces the size of the chart to ; three-quarters of the original size, so it can fit ; into the Apple's screen mode, which is smaller than ; the original BBC Micro screen ; ; The 105 is multiplied by 4/3 to counteract the scaling ; by 3/4 in SCALEY2, so the 105 part is not scaled, only ; the x-delta element is LDA QQ10 ; Set A = QQ10 - QQ1, the vertical distance between the SEC ; crosshairs (QQ10) and the current system (QQ1) SBC QQ1 CMP #35 ; If the vertical distance in A is < 35, 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 #230 ; If the horizontal distance in A is < -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) ASL A ; Set QQ19+1 = 99 + A * 2 CLC ; ADC #99 ; 90 is the y-coordinate of the centre of the chart, JSR SCALEY2 ; so this sets QQ19+1 to the screen pixel x-coordinate STA QQ19+1 ; of the crosshairs ; ; The call to SCALEY2 reduces the size of the chart to ; three-quarters of the original size, so it can fit ; into the Apple's screen mode, which is smaller than ; the original BBC Micro screen LDA #8 ; Set QQ19+2 to 8 denote crosshairs of size 8 STA QQ19+2 LDA #GREEN ; Switch to stripe 3-1-3-1, which is white/yellow in the STA COL ; chart view JMP TT15 ; Jump to TT15 to draw crosshairs of size 8 at the ; crosshairs coordinates, returning from the subroutine ; using a tail call