diff --git a/wip-hugo/routines/circle/circle.s b/wip-hugo/routines/circle/circle.s index 9c52deb..4b9e40f 100644 --- a/wip-hugo/routines/circle/circle.s +++ b/wip-hugo/routines/circle/circle.s @@ -4,15 +4,14 @@ .include "circle.inc" ;; We use the algorithm jerkos method ;; 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)) CLC LDA X_pos ADC radius STA X_pos - ;; t1 = radius >> 4 LDA radius LSR @@ -22,39 +21,30 @@ STA t1 while_x_bigger_then_y: - STY Y_pos - STX X_pos - STA temp jsr pixel_draw - LDY Y_pos - LDX X_pos - LDA temp - - INY ; y++ + INC Y_pos ; y++ ;;t1 += y CLC LDA t1 - STY temp - ADC temp + ADC Y_pos STA t1 - ;; t2 = t1 -x + ;; t2 = t1 - x SEC - STX temp - SBC temp - + LDA t2 + SBC X_pos + STA t2 ;; if t2 < 0 then skip to endif CMP #$00 BMI endif if: - DEX; x-- - STA t1; t1 = t2 + DEC X_pos ; x-- + STA t1 ; t1 = t2 endif: ;; repeat if X > Y - STX temp - TYA - CMP temp + LDA X_pos + CMP Y_pos JMP while_x_bigger_then_y - BEQ while_x_bigger_then_y + ;BNE while_x_bigger_then_y .endproc