Fix quartercircle offset isse (before the circle had the offset (0,0) always!)
This commit is contained in:
parent
363e3907ff
commit
484bafa828
2 changed files with 13 additions and 11 deletions
|
@ -5,3 +5,5 @@
|
||||||
;; private args
|
;; private args
|
||||||
t1 = $E0
|
t1 = $E0
|
||||||
t2 = $E1
|
t2 = $E1
|
||||||
|
X_rel = radius
|
||||||
|
Y_rel = $E3
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue