Fix circle-code (wip) Now the test renders the forth quarter of a circle!
This commit is contained in:
parent
50a17ad691
commit
363e3907ff
2 changed files with 13 additions and 12 deletions
|
@ -6,22 +6,23 @@
|
||||||
;; https://schwarzers.com/algorithms/
|
;; https://schwarzers.com/algorithms/
|
||||||
|
|
||||||
|
|
||||||
;; X_pos = X_pos + r (hack, should fix later ( xpos == ypos is not always true))
|
;; X_pos is changed (fix this later)
|
||||||
CLC
|
LDA radius
|
||||||
LDA X_pos
|
|
||||||
ADC radius
|
|
||||||
STA X_pos
|
STA X_pos
|
||||||
|
|
||||||
|
LDA #$00
|
||||||
|
STA Y_pos
|
||||||
|
|
||||||
;; t1 = radius >> 4
|
;; t1 = radius >> 4
|
||||||
LDA radius
|
LDA radius
|
||||||
LSR A
|
LSR
|
||||||
LSR A
|
LSR
|
||||||
LSR A
|
LSR
|
||||||
LSR A
|
LSR
|
||||||
STA t1
|
STA t1
|
||||||
while_x_bigger_then_y:
|
while_x_bigger_then_y:
|
||||||
|
|
||||||
jsr pixel_draw
|
JSR pixel_draw
|
||||||
|
|
||||||
INC Y_pos ; y++
|
INC Y_pos ; y++
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ while_x_bigger_then_y:
|
||||||
STA t1
|
STA t1
|
||||||
;; t2 = t1 - x
|
;; t2 = t1 - x
|
||||||
SEC
|
SEC
|
||||||
LDA t2
|
LDA t1
|
||||||
SBC X_pos
|
SBC X_pos
|
||||||
STA t2
|
STA t2
|
||||||
;; if t2 < 0 then skip to endif
|
;; if t2 < 0 then skip to endif
|
||||||
|
@ -47,6 +48,6 @@ endif:
|
||||||
LDA X_pos
|
LDA X_pos
|
||||||
CMP Y_pos
|
CMP Y_pos
|
||||||
|
|
||||||
BNE while_x_bigger_then_y
|
BCS while_x_bigger_then_y
|
||||||
RTS
|
RTS
|
||||||
.endproc
|
.endproc
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
LDA #$50
|
LDA #$50
|
||||||
STA X_pos
|
STA X_pos
|
||||||
STA Y_pos
|
STA Y_pos
|
||||||
LDA #$08
|
LDA #$55
|
||||||
STA radius
|
STA radius
|
||||||
JSR circle
|
JSR circle
|
||||||
.endscope
|
.endscope
|
||||||
|
|
Loading…
Add table
Reference in a new issue