This code appears in the following versions (click to see it in the source code):
Code variations between these versions are shown below.
.CIRCLEName: CIRCLE Type: Subroutine Category: Drawing circles Summary: Draw a circle for the planet Deep dive: Drawing circles
Draw a circle with the centre at (K3, K4) and radius K. Used to draw the planet's main outline.
Arguments: K The planet's radius K3(1 0) Pixel x-coordinate of the centre of the planet K4(1 0) Pixel y-coordinate of the centre of the planet
JSR CHKON \ Call CHKON to check whether the circle fits on-screen BCS RTS2 \ If CHKON set the C flag then the circle does not fit \ on-screen, so return from the subroutine (as RTS2 \ contains an RTS)
LDA #0 \ Set LSX2 = 0 to indicate that the ball line heap is STA LSX2 \ not empty, as we are about to fill it
LDX K \ Set X = K = radius LDA #8 \ Set A = 8
The cassette, disc and Master versions define a circle as being small when it has a radius of less than 8, while in the 6502SP version, a circle is small if it has a radius of less than 4, and in the Electron version, small circles have a radius of less than 9. Small circles are drawn with a step size of 8.
Tap on a block to expand it, and tap it again to revert.
LSR A \ Halve A so A = 4
The cassette, disc and Master versions define a circle as being medium when it has a radius of less than 60, while in the 6502SP version, a circle is medium if it has a radius of less than 50. Medium circles are drawn with a step size of 4, and large circles are drawn with a step size of 2. The Electron version, meanwhile, only has small and medium circles (no large), with medium circles having a radius of 9 or more.
This variation is blank in the Electron version.
Tap on a block to expand it, and tap it again to revert.
.PL89 STA STP \ Set STP = A. STP is the step size for the circle, so \ the above sets a smaller step size for bigger circles