BBC Micro Elite

# Drawing circles: TT128

```       Name: TT128                                             [View in context]
Type: Subroutine
Category: Drawing circles
Summary: Draw a circle on a chart

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

LDX #0                 \ Set the high bytes of K3(1 0) and K4(1 0) to 0
STX K4+1
STX K3+1

\STX LSX                \ This instruction is commented out in the original
\ source

INX                    \ Set LSP = 1 to reset the ball line heap
STX LSP

LDX #2                 \ Set STP = 2, the step size for the circle
STX STP

JSR CIRCLE2            \ Call CIRCLE2 to draw a circle with the centre at
\ (K3(1 0), K4(1 0)) and radius K

\LDA #&FF               \ These instructions are commented out in the original
\STA LSX                \ source

RTS                    \ Return from the subroutine
```