more pritty circle bugs
This commit is contained in:
parent
8b955a5007
commit
d691d692b9
1 changed files with 13 additions and 23 deletions
|
@ -4,15 +4,14 @@
|
||||||
.include "circle.inc"
|
.include "circle.inc"
|
||||||
;; We use the algorithm jerkos method
|
;; We use the algorithm jerkos method
|
||||||
;; https://schwarzers.com/algorithms/
|
;; https://schwarzers.com/algorithms/
|
||||||
LDY Y_pos
|
|
||||||
LDX X_pos
|
|
||||||
;; X_pos = X_pos + r (hack, should fix later ( xpos == ypos is not always true))
|
;; X_pos = X_pos + r (hack, should fix later ( xpos == ypos is not always true))
|
||||||
CLC
|
CLC
|
||||||
LDA X_pos
|
LDA X_pos
|
||||||
ADC radius
|
ADC radius
|
||||||
STA X_pos
|
STA X_pos
|
||||||
|
|
||||||
|
|
||||||
;; t1 = radius >> 4
|
;; t1 = radius >> 4
|
||||||
LDA radius
|
LDA radius
|
||||||
LSR
|
LSR
|
||||||
|
@ -22,39 +21,30 @@
|
||||||
STA t1
|
STA t1
|
||||||
while_x_bigger_then_y:
|
while_x_bigger_then_y:
|
||||||
|
|
||||||
STY Y_pos
|
|
||||||
STX X_pos
|
|
||||||
STA temp
|
|
||||||
jsr pixel_draw
|
jsr pixel_draw
|
||||||
LDY Y_pos
|
|
||||||
LDX X_pos
|
|
||||||
LDA temp
|
|
||||||
|
|
||||||
|
INC Y_pos ; y++
|
||||||
INY ; y++
|
|
||||||
|
|
||||||
;;t1 += y
|
;;t1 += y
|
||||||
CLC
|
CLC
|
||||||
LDA t1
|
LDA t1
|
||||||
STY temp
|
ADC Y_pos
|
||||||
ADC temp
|
|
||||||
STA t1
|
STA t1
|
||||||
;; t2 = t1 - x
|
;; t2 = t1 - x
|
||||||
SEC
|
SEC
|
||||||
STX temp
|
LDA t2
|
||||||
SBC temp
|
SBC X_pos
|
||||||
|
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:
|
||||||
DEX; x--
|
DEC X_pos ; x--
|
||||||
STA t1 ; t1 = t2
|
STA t1 ; t1 = t2
|
||||||
endif:
|
endif:
|
||||||
;; repeat if X > Y
|
;; repeat if X > Y
|
||||||
STX temp
|
LDA X_pos
|
||||||
TYA
|
CMP Y_pos
|
||||||
CMP temp
|
|
||||||
JMP while_x_bigger_then_y
|
JMP while_x_bigger_then_y
|
||||||
BEQ while_x_bigger_then_y
|
;BNE while_x_bigger_then_y
|
||||||
.endproc
|
.endproc
|
||||||
|
|
Loading…
Add table
Reference in a new issue