Skip to navigation

Elite on the BBC Micro

Drawing circles: TT128 [Master version]

Name: TT128 [Show more] Type: Subroutine Category: Drawing circles Summary: Draw a circle on a chart Deep dive: Drawing circles
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: * TT14 calls TT128

Draw a circle with the centre at (QQ19, QQ19+1) and radius K. Arguments: QQ19 The x-coordinate of the centre of the circle QQ19+1 The y-coordinate of the centre of the circle K The radius of the circle
.TT128 LDA QQ19 \ Set K3 = the x-coordinate of the centre STA K3 LDA QQ19+1 \ Set K4 = the y-coordinate of the centre STA K4 STZ K4+1 \ Set the high bytes of K3(1 0) and K4(1 0) to 0 STZ K3+1 LDX #1 \ Set LSP = 1 to reset the ball line heap STX LSP INX \ Set STP = 2, the step size for the circle STX STP LDA #RED \ Switch to colour 2, which is red in the chart view STA COL JMP CIRCLE2 \ Jump to CIRCLE2 to draw a circle with the centre at \ (K3(1 0), K4(1 0)) and radius K, returning from the \ subroutine using a tail call