From 55e63ff6270ef37d803a7392a76ab27dc7241344 Mon Sep 17 00:00:00 2001 From: hugova Date: Mon, 12 May 2025 02:24:55 +0200 Subject: [PATCH] optimise away constant by adding it to lookup-table --- wip-hugo/END.s | 101 ++++++++++++++------------- wip-hugo/routines/pixel/pixel_draw.s | 4 +- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/wip-hugo/END.s b/wip-hugo/END.s index 9a6c97a..df88390 100644 --- a/wip-hugo/END.s +++ b/wip-hugo/END.s @@ -1,55 +1,56 @@ binary_factor: .byte %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 +Bitmap = $4000 ;;This is used by pixel_draw! look at it for more detail big_y_offset: - .lobytes $0000 - .hibytes $0000 - .lobytes $0140 - .hibytes $0140 - .lobytes $0280 - .hibytes $0280 - .lobytes $03C0 - .hibytes $03C0 - .lobytes $0500 - .hibytes $0500 - .lobytes $0640 - .hibytes $0640 - .lobytes $0780 - .hibytes $0780 - .lobytes $08C0 - .hibytes $08C0 - .lobytes $0A00 - .hibytes $0A00 - .lobytes $0B40 - .hibytes $0B40 - .lobytes $0C80 - .hibytes $0C80 - .lobytes $0DC0 - .hibytes $0DC0 - .lobytes $0F00 - .hibytes $0F00 - .lobytes $1040 - .hibytes $1040 - .lobytes $1180 - .hibytes $1180 - .lobytes $12C0 - .hibytes $12C0 - .lobytes $1400 - .hibytes $1400 - .lobytes $1540 - .hibytes $1540 - .lobytes $1680 - .hibytes $1680 - .lobytes $17C0 - .hibytes $17C0 - .lobytes $1900 - .hibytes $1900 - .lobytes $1A40 - .hibytes $1A40 - .lobytes $1B80 - .hibytes $1B80 - .lobytes $1CC0 - .hibytes $1CC0 - .lobytes $1E00 - .hibytes $1E00 + .lobytes $0000 + Bitmap + .hibytes $0000 + Bitmap + .lobytes $0140 + Bitmap + .hibytes $0140 + Bitmap + .lobytes $0280 + Bitmap + .hibytes $0280 + Bitmap + .lobytes $03C0 + Bitmap + .hibytes $03C0 + Bitmap + .lobytes $0500 + Bitmap + .hibytes $0500 + Bitmap + .lobytes $0640 + Bitmap + .hibytes $0640 + Bitmap + .lobytes $0780 + Bitmap + .hibytes $0780 + Bitmap + .lobytes $08C0 + Bitmap + .hibytes $08C0 + Bitmap + .lobytes $0A00 + Bitmap + .hibytes $0A00 + Bitmap + .lobytes $0B40 + Bitmap + .hibytes $0B40 + Bitmap + .lobytes $0C80 + Bitmap + .hibytes $0C80 + Bitmap + .lobytes $0DC0 + Bitmap + .hibytes $0DC0 + Bitmap + .lobytes $0F00 + Bitmap + .hibytes $0F00 + Bitmap + .lobytes $1040 + Bitmap + .hibytes $1040 + Bitmap + .lobytes $1180 + Bitmap + .hibytes $1180 + Bitmap + .lobytes $12C0 + Bitmap + .hibytes $12C0 + Bitmap + .lobytes $1400 + Bitmap + .hibytes $1400 + Bitmap + .lobytes $1540 + Bitmap + .hibytes $1540 + Bitmap + .lobytes $1680 + Bitmap + .hibytes $1680 + Bitmap + .lobytes $17C0 + Bitmap + .hibytes $17C0 + Bitmap + .lobytes $1900 + Bitmap + .hibytes $1900 + Bitmap + .lobytes $1A40 + Bitmap + .hibytes $1A40 + Bitmap + .lobytes $1B80 + Bitmap + .hibytes $1B80 + Bitmap + .lobytes $1CC0 + Bitmap + .hibytes $1CC0 + Bitmap + .lobytes $1E00 + Bitmap + .hibytes $1E00 + Bitmap diff --git a/wip-hugo/routines/pixel/pixel_draw.s b/wip-hugo/routines/pixel/pixel_draw.s index 1c06e0e..fb3c7db 100755 --- a/wip-hugo/routines/pixel/pixel_draw.s +++ b/wip-hugo/routines/pixel/pixel_draw.s @@ -31,7 +31,7 @@ calc_byte_to_paint: ;; the chunks are orderd from the left to the right and then looping downwards. ;; Therefore we have that: btp_mem_pos = big_x_offset + smal_y_offset + big_y_offset + bitmap_offset - ;; We use a lookup-table for big_y_offset (see END.s) + ;; We use a lookup-table for big_y_offset + bitmap_offset (see END.s) ;; (Y_pos / 8 floor)*2 LDA Y_pos LSR A @@ -57,7 +57,7 @@ calc_byte_to_paint: AND Y_pos ;; offset to add TAY - Add_16 btp_mem_pos, btp_mem_pos + 1, #Bitmap, ! + ;Add_16 btp_mem_pos, btp_mem_pos + 1, #Bitmap, ! ;;Let draw some stuff LDA byte_to_paint ;; note that both bytes are used!