From 017a337180870bc16ff5d287a132b8cb0784008d Mon Sep 17 00:00:00 2001 From: hugova Date: Sun, 11 May 2025 20:00:48 +0200 Subject: [PATCH] make pixel drawing faster using lookup table --- wip-hugo/routines/memory/mem.inc | 2 +- wip-hugo/routines/pixel/pixel_draw.s | 13 +++---------- wip-hugo/source.s | 1 + 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/wip-hugo/routines/memory/mem.inc b/wip-hugo/routines/memory/mem.inc index 60777b9..6d7e188 100644 --- a/wip-hugo/routines/memory/mem.inc +++ b/wip-hugo/routines/memory/mem.inc @@ -1,6 +1,6 @@ ;;; -*- Mode: asm; indent-tabs-mode: t; tab-width: 8 -*- - ;;Public args + ;; public args A_start = $D0 ; 16-bit value (uses D1) B_start = $D2 ; 16-bit value (uses D3) B_end = $D4 ; 16-bit value (uses D5) diff --git a/wip-hugo/routines/pixel/pixel_draw.s b/wip-hugo/routines/pixel/pixel_draw.s index 8893e10..c79ddc3 100755 --- a/wip-hugo/routines/pixel/pixel_draw.s +++ b/wip-hugo/routines/pixel/pixel_draw.s @@ -11,16 +11,9 @@ AND #%00000111 TAX - ;;Store pixel in byte_to_paint - LDA #%10000000 - INX -@shift_btp: ;; check out SMB instruction here! //Hugo - DEX - BEQ end__;X=0 end this - CLC - ROR A - jmp @shift_btp -end__: + # this is the same as: A = 2^X + LDA binary_factor, X + STA byte_to_paint ;;FIND THE POSITION IN MEMORY TO WRITE PIXEL diff --git a/wip-hugo/source.s b/wip-hugo/source.s index 8da786c..a349a18 100755 --- a/wip-hugo/source.s +++ b/wip-hugo/source.s @@ -18,3 +18,4 @@ JMP exit .include "routines/pixel/pixel_draw.s" .include "routines/memory/memset.s" .include "routines/memory/memcpy.s" +.include "END.s"