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

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

View file

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