From 5e3eb78506cbc2c8477464448f003b7e1631f292 Mon Sep 17 00:00:00 2001 From: hugova Date: Thu, 10 Jul 2025 01:38:37 +0200 Subject: [PATCH] reduse instructions in circle draw --- wip-hugo/routines/circle/circle.inc | 1 + wip-hugo/routines/circle/circle.s | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/wip-hugo/routines/circle/circle.inc b/wip-hugo/routines/circle/circle.inc index 7ae6fff..9495d4e 100644 --- a/wip-hugo/routines/circle/circle.inc +++ b/wip-hugo/routines/circle/circle.inc @@ -35,4 +35,5 @@ Y_qda = $DE Y_qdb = $DF Y_qbb = $CE + temp__ = $CD Y_qaa = Y_copy diff --git a/wip-hugo/routines/circle/circle.s b/wip-hugo/routines/circle/circle.s index 0eb5529..7a57b0b 100644 --- a/wip-hugo/routines/circle/circle.s +++ b/wip-hugo/routines/circle/circle.s @@ -76,7 +76,7 @@ draw_upper_px_in_circle: draw_left_px_in_circle: ;similar as above SEC LDA X_pos - STA temp_ + STA temp__ SBC radius STA X_pos @@ -91,13 +91,11 @@ draw_left_px_in_circle: ;similar as above LDA byte_to_paint STA byte_to_paint_qca - - LDA temp_ + LDA temp__ STA X_pos draw_lower_px_in_circle: ;similar as above CLC LDA Y_pos - STA temp_ ADC radius STA Y_pos @@ -120,7 +118,7 @@ draw_lower_px_in_circle: ;similar as above LDA temp_ STA Y_pos draw_right_px_in_circle:; similar as above - CLC + ;; C =0 becuse pixel_draw LDA X_pos ADC radius STA X_pos @@ -137,7 +135,7 @@ draw_right_px_in_circle:; similar as above LDX #$08 ; X=8 always expected inside the loop while_x_bigger_then_y: -draw_pixels. +draw_pixels: draw_qaa: LDY Y_qaa LDA byte_to_paint ;A byte containing a single 1. Coresponds to 2^rest(X_pos/8) @@ -179,18 +177,19 @@ draw_qab: ;; Y_rel and X_rel is the X and Y in the eye of the algorithm. Thsese are calculated seperatly from the pixel cordinates, ;; but are modified at the same time. This is becsuse the pixel cordinate system is complex (see pixel draw) +LDY #$07 ;; Y is expected to be 7 from this point on in the loop + change_Y: INC Y_rel ; y++ qaa_y: DEC Y_qaa BPL qaa_y_end qaa_y_underflow: - LDA #$07 - STA Y_qaa ;; Switch to chunk bellow ; So we subtract #$0140 Sub_16 btp_mem_pos, btp_mem_pos + 1, #$40, #$01 ;-320 Sub_16 btp_mem_pos_qba, btp_mem_pos_qba + 1, #$40, #$01,! + STY Y_qaa ; Y_qaa =$07 qaa_y_end: qda_y: INC Y_qda @@ -263,8 +262,7 @@ qdb_y: qdb_overflow: Sub_16 btp_mem_pos_qdb, btp_mem_pos_qdb + 1, #$3f, #$01, ! ;+320 Sub_16 btp_mem_pos_qcb, btp_mem_pos_qcb + 1, #$40, #$01, ! ;+320 - LDA #$07 - STA Y_qdb + STY Y_qdb qdb_y_end: qbb_y: