From 71969920431a41955488154b5e562b6e77375eb3 Mon Sep 17 00:00:00 2001 From: hugova Date: Tue, 1 Jul 2025 00:06:04 +0200 Subject: [PATCH] Add last part to circle, still a bit buggy --- wip-hugo/routines/circle/circle.s | 3 ++- wip-hugo/routines/circle/circle_help.s | 34 +++++++++++++++++++------- wip-hugo/routines/circle/circle_test.s | 2 +- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/wip-hugo/routines/circle/circle.s b/wip-hugo/routines/circle/circle.s index abef4c2..a7c5e05 100644 --- a/wip-hugo/routines/circle/circle.s +++ b/wip-hugo/routines/circle/circle.s @@ -110,8 +110,9 @@ move_8px_left: ;; Restores byte to paint LDX #%00000001 STX byte_to_paint -decrement_x_pos_end: + LDA t2 +decrement_x_pos_end: STA t1 ; t1 = t2 endif: ;; repeat if X > Y diff --git a/wip-hugo/routines/circle/circle_help.s b/wip-hugo/routines/circle/circle_help.s index 2f30f8f..e4d1521 100644 --- a/wip-hugo/routines/circle/circle_help.s +++ b/wip-hugo/routines/circle/circle_help.s @@ -21,7 +21,8 @@ calculate: ;; qab = 2*center - qcb ;; qca = 2*center - qaa - ;; qbq = 2*center - qda + ;; qba = 2*center - qda + ;; qbb = 2*center - qdb ;; a = 2*center - b comes from that a = center -(b-center) LDA btp_mem_pos_center_two @@ -44,6 +45,13 @@ calculate: LDA btp_mem_pos_center_two + 1 SBC btp_mem_pos_qda + 1 STA btp_mem_pos_qba + 1 + + LDA btp_mem_pos_center_two + SBC btp_mem_pos_qdb + STA btp_mem_pos_qbb + LDA btp_mem_pos_center_two + 1 + SBC btp_mem_pos_qdb + 1 + STA btp_mem_pos_qbb + 1 end_calculation: ;; Lets draw all half-quatrons of the circle. This draws only 8 pixels per iteration. @@ -87,16 +95,27 @@ draw_qdb:; xy swaped and y is inverted. TAX ;;Uses modifyed Y from above - ORA (btp_mem_pos_qdb), Y STA (btp_mem_pos_qdb), Y +draw_qbb:;; the one not working + STY temp_ + LDA #$07 + SBC temp_ + TAY + + LDA inverse_factor_value, X;; (see END.s) + + ORA (btp_mem_pos_qbb), Y + STA (btp_mem_pos_qbb), Y + + ;LDY temp_ draw_qab:; xy swoped + mirroring - STY temp___ - LDA #$07 - SBC temp___ - TAY + ;STY temp_ + ;LDA #$07 + ;SBC temp_ + ;TAY TXA ORA (btp_mem_pos_qab), Y @@ -129,14 +148,11 @@ draw_qca: ;;mirror technique LDY temp draw_qba: ;;mirror_technique - TXA ORA (btp_mem_pos_qba), Y STA (btp_mem_pos_qba), Y - - increment_y_pos: INC Y_rel ; y++ DEY diff --git a/wip-hugo/routines/circle/circle_test.s b/wip-hugo/routines/circle/circle_test.s index b3ded49..bfe18aa 100644 --- a/wip-hugo/routines/circle/circle_test.s +++ b/wip-hugo/routines/circle/circle_test.s @@ -3,7 +3,7 @@ LDA #$50 STA X_pos STA Y_pos - LDA #$35 + LDA #$55 STA radius JSR circle .endscope