Skip to navigation


Drawing circles: TT14

[Apple II version]

Name: TT14 [Show more] Type: Subroutine Category: Drawing circles Summary: Draw a circle with crosshairs on a chart
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * TT22 calls TT14 * TT23 calls TT14

Draw a circle with crosshairs at the current system's galactic coordinates.
.TT126 LDA #105 ; Set QQ19 = 105, for the x-coordinate of the centre of STA QQ19 ; the fixed circle on the Short-range Chart LDA #75 ; Set QQ19+1 = 75, for the y-coordinate of the centre of STA QQ19+1 ; the fixed circle on the Short-range Chart LDA #16 ; Set QQ19+2 = 16, the size of the crosshairs on the STA QQ19+2 ; Short-range Chart LDA #GREEN ; Switch to stripe 3-1-3-1, which is white/yellow in the STA COL ; chart view JSR TT15 ; Draw the set of crosshairs defined in QQ19, at the ; exact coordinates as this is the Short-range Chart LDA QQ14 ; Set K to the fuel level from QQ14, so this can act as JSR SCALEY2 ; the circle's radius (70 being a full tank) STA K ; ; 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 JMP TT128 ; Jump to TT128 to draw a circle with the centre at the ; same coordinates as the crosshairs, (QQ19, QQ19+1), ; and radius K that reflects the current fuel levels, ; returning from the subroutine using a tail call .TT14 LDA QQ11 ; If the current view is the Short-range Chart, which BMI TT126 ; is the only view with bit 7 set, then jump up to TT126 ; to draw the crosshairs and circle for that view ; Otherwise this is the Long-range Chart, so we draw the ; crosshairs and circle for that view instead LDA QQ14 ; Set K to the fuel level from QQ14 divided by 4, so LSR A ; this can act as the circle's radius (70 being a full JSR SCALEY ; tank, which divides down to a radius of 17) STA K ; ; The call to SCALEY halves the value in A (to give a ; total division by 4), and then it reduces the result ; to three-quarters of the original value, so we can fit ; the chart into the Apple's screen mode, which is ; smaller than the original BBC Micro screen LDA QQ0 ; Set QQ19 to the x-coordinate of the current system, JSR SCALEX ; which will be the centre of the circle and crosshairs STA QQ19 ; we draw ; ; The call to SCALEX 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 QQ1 ; Set QQ19+1 to the y-coordinate of the current system, JSR SCALEY ; which will again be the centre of the circle and STA QQ19+1 ; crosshairs we draw ; ; Again, the call to SCALEY halves and scales the value ; in A (see the comment above) LDA #7 ; Set QQ19+2 = 7, the size of the crosshairs on the STA QQ19+2 ; Long-range Chart LDA #GREEN ; Switch to colour green STA COL JSR TT15 ; Draw the set of crosshairs defined in QQ19, which will ; be drawn 24 pixels to the right of QQ19+1 LDA QQ19+1 ; Add GCYT to the y-coordinate of the crosshairs in CLC ; QQ19+1 so that the centre of the circle matches the ADC #GCYT ; centre of the crosshairs STA QQ19+1 ; Fall through into TT128 to draw a circle with the ; centre at the same coordinates as the crosshairs, ; (QQ19, QQ19+1), and radius K that reflects the ; current fuel levels