From 913a6ba0721f1cc717ed5fa5940801bf02d99c43 Mon Sep 17 00:00:00 2001 From: hugova Date: Wed, 2 Jul 2025 00:45:41 +0200 Subject: [PATCH] optimize circle draw (more code cleanup) --- wip-hugo/routines/circle/circle_help.s | 41 ++++++++++++-------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/wip-hugo/routines/circle/circle_help.s b/wip-hugo/routines/circle/circle_help.s index f70fc1c..98d92c9 100644 --- a/wip-hugo/routines/circle/circle_help.s +++ b/wip-hugo/routines/circle/circle_help.s @@ -15,6 +15,7 @@ ;; qcb | qdb ;; | ;; v Y + ;; The q stands for quarter, whe have 4 quarter, and each quarter is split into 2 ;; We first calculate all btp_mem_pos for the inverted half quarters! @@ -55,16 +56,20 @@ calculate: end_calculation: ;; Lets draw all half-quatrons of the circle. This draws only 8 pixels per iteration. +;; Note that I have the draw_qxx in listed pairs. Each pair chair the same Y-register :) draw_qaa: LDA byte_to_paint ;A byte containing a single 1. Coresponds to X position in the chunk. ORA (btp_mem_pos), Y STA (btp_mem_pos), Y - +draw_qba: ;;mirror_technique + LDX byte_to_paint + LDA inverse_factor_value, X;; (see END.s) + ORA (btp_mem_pos_qba), Y + STA (btp_mem_pos_qba), Y draw_qcb:; xy swoped STY temp - LDX byte_to_paint LDA inverse_factor_value, X;; (see END.s) TAX LDA log, X @@ -73,36 +78,36 @@ draw_qcb:; xy swoped ;;modify X_pos LDX temp LDA binary_factor, X; (see END.s) - + TAX ORA (btp_mem_pos_qcb), Y STA (btp_mem_pos_qcb), Y -draw_qdb:; xy swaped and y is inverted. - ;;modify X - LDA #$07 - SBC temp - TAX - LDA binary_factor, X; (see END.s) - TAX +draw_qdb:; xy swaped and y is inverted. ;;;;;;;;;;;;;;;;;;; + + LDA inverse_factor_value, X + STA temp__ ;;Uses modifyed Y from above ORA (btp_mem_pos_qdb), Y STA (btp_mem_pos_qdb), Y -draw_qbb:;; the one not working +draw_qbb: + STY temp_ LDA #$07 SBC temp_ TAY - LDA inverse_factor_value, X;; (see END.s) + LDX temp + LDA binary_factor, X; (see END.s) + TAX ORA (btp_mem_pos_qbb), Y STA (btp_mem_pos_qbb), Y -draw_qab:; xy swoped + mirroring +draw_qab:; xy swoped + mirroring ;!!!!!!!!!!!!!!!!!!!!!!!!!!1111111!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - TXA + LDA temp__ ORA (btp_mem_pos_qab), Y STA (btp_mem_pos_qab), Y @@ -123,8 +128,6 @@ draw_qca: ;;mirror technique ;; uses a table! LDX byte_to_paint LDA inverse_factor_value, X;; (see END.s) - TAX ;; A is saved to x because qba use this as well - ; A = byte_to_paint_inv ORA (btp_mem_pos_qca), Y STA (btp_mem_pos_qca), Y @@ -132,12 +135,6 @@ draw_qca: ;;mirror technique ;;Recover the Y value (we changed it because evrything is inverted) 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