From 9694d8d55b67ecc174769d50f033102be42c9952 Mon Sep 17 00:00:00 2001 From: hugova Date: Wed, 5 Mar 2025 22:42:00 +0100 Subject: [PATCH] Redused paint_pixel to 1 call in draw line --- wip-hugo/routines/line/line.inc | 3 ++ wip-hugo/routines/line/line_down.s | 46 +++++++++++++++++++++---- wip-hugo/routines/line/line_test_time.s | 4 +-- wip-hugo/routines/memory/pixel_draw.s | 3 +- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/wip-hugo/routines/line/line.inc b/wip-hugo/routines/line/line.inc index 8f5777b..b7d9fcd 100644 --- a/wip-hugo/routines/line/line.inc +++ b/wip-hugo/routines/line/line.inc @@ -9,3 +9,6 @@ dx_2 = dy_2 V = $0809 D = $0a0b + ;;These are also used in pixel_draw. Look there to find out more + byte_to_paint = $FE ;Byte with one 1 that corasponds to a pixel. + btp_mem_pos =$494A; byte to paint memory position ;Position of byte on screen diff --git a/wip-hugo/routines/line/line_down.s b/wip-hugo/routines/line/line_down.s index 06a32f6..edccd11 100644 --- a/wip-hugo/routines/line/line_down.s +++ b/wip-hugo/routines/line/line_down.s @@ -32,7 +32,6 @@ ;dy_2 = dy*2 mult_16 >dy_2, =V. @@ -49,10 +48,33 @@ Add_16 >D, D, btp_mem_pos, X) + STA (>btp_mem_pos, X) + BCS move_8px_left + jmp increment_x_pos_end +move_8px_left: +;; add +8 to btp_mem_pos. Find more of why in pixel_draw +Add_16 >btp_mem_pos, D, D, V, D, V, btp_mem_pos, btp_mem_pos, D, dy_2, D, dy_2, btp_mem_pos, X) STA (>btp_mem_pos, X) RTS