Skip to navigation


Drawing circles: TT14

[BBC Micro disc version, Docked]

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 Variations: See code variations for this subroutine in the different versions 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 #104 \ Set QQ19 = 104, for the x-coordinate of the centre of STA QQ19 \ the fixed circle on the Short-range Chart LDA #90 \ Set QQ19+1 = 90, 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 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 STA K \ the circle's radius (70 being a full tank) 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 LSR A \ tank, which divides down to a radius of 17) STA K LDA QQ0 \ Set QQ19 to the x-coordinate of the current system, STA QQ19 \ which will be the centre of the circle and crosshairs \ we draw LDA QQ1 \ Set QQ19+1 to the y-coordinate of the current system, LSR A \ halved because the galactic chart is half as high as STA QQ19+1 \ it is wide, which will again be the centre of the \ circle and crosshairs we draw LDA #7 \ Set QQ19+2 = 7, the size of the crosshairs on the STA QQ19+2 \ Long-range Chart 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 24 to the y-coordinate of the crosshairs in QQ19+1 CLC \ so that the centre of the circle matches the centre ADC #24 \ 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