;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- .proc circle .include "circle.inc" ;; We use the algorithm jerkos method ;; https://schwarzers.com/algorithms/ ;; X_pos = X_pos + r (hack, should fix later ( xpos == ypos is not always true)) CLC LDA X_pos ADC radius STA X_pos ;; t1 = radius >> 4 LDA radius LSR A LSR A LSR A LSR A STA t1 while_x_bigger_then_y: jsr pixel_draw INC Y_pos ; y++ ;;t1 += y CLC LDA t1 ADC Y_pos STA t1 ;; t2 = t1 - x SEC LDA t2 SBC X_pos STA t2 ;; if t2 < 0 then skip to endif CMP #$00 BMI endif if: DEC X_pos ; x-- LDA t2 STA t1 ; t1 = t2 endif: ;; repeat if X > Y LDA X_pos CMP Y_pos BNE while_x_bigger_then_y RTS .endproc