Fix circle-code (wip) Now the test renders the forth quarter of a circle!

This commit is contained in:
hugova 2025-06-28 21:05:25 +02:00
parent 50a17ad691
commit 363e3907ff
2 changed files with 13 additions and 12 deletions

View file

@ -6,22 +6,23 @@
;; 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
;; X_pos is changed (fix this later)
LDA radius
STA X_pos
LDA #$00
STA Y_pos
;; t1 = radius >> 4
LDA radius
LSR A
LSR A
LSR A
LSR A
LSR
LSR
LSR
LSR
STA t1
while_x_bigger_then_y:
jsr pixel_draw
JSR pixel_draw
INC Y_pos ; y++
@ -32,7 +33,7 @@ while_x_bigger_then_y:
STA t1
;; t2 = t1 - x
SEC
LDA t2
LDA t1
SBC X_pos
STA t2
;; if t2 < 0 then skip to endif
@ -47,6 +48,6 @@ endif:
LDA X_pos
CMP Y_pos
BNE while_x_bigger_then_y
BCS while_x_bigger_then_y
RTS
.endproc

View file

@ -3,7 +3,7 @@
LDA #$50
STA X_pos
STA Y_pos
LDA #$08
LDA #$55
STA radius
JSR circle
.endscope