Fix quartercircle offset isse (before the circle had the offset (0,0) always!)

This commit is contained in:
hugova 2025-06-28 21:10:59 +02:00
parent 363e3907ff
commit 484bafa828
2 changed files with 13 additions and 11 deletions

View file

@ -5,3 +5,5 @@
;; private args
t1 = $E0
t2 = $E1
X_rel = radius
Y_rel = $E3

View file

@ -5,13 +5,11 @@
;; We use the algorithm jerkos method
;; https://schwarzers.com/algorithms/
;; X_rel = radius (share the same address)
;; X_pos is changed (fix this later)
LDA radius
STA X_pos
;;Y_rel =0
LDA #$00
STA Y_pos
STA Y_rel
;; t1 = radius >> 4
LDA radius
@ -25,28 +23,30 @@ while_x_bigger_then_y:
JSR pixel_draw
INC Y_pos ; y++
INC Y_rel
;;t1 += y
CLC
LDA t1
ADC Y_pos
ADC Y_rel
STA t1
;; t2 = t1 - x
SEC
LDA t1
SBC X_pos
SBC X_rel
STA t2
;; if t2 < 0 then skip to endif
CMP #$00
BMI endif
if:
DEC X_pos ; x--
DEC X_rel
LDA t2
STA t1 ; t1 = t2
endif:
;; repeat if X > Y
LDA X_pos
CMP Y_pos
LDA X_rel
CMP Y_rel
BCS while_x_bigger_then_y
RTS