From c4b98c7be27558c662a23849126d2a802c9bf4bc Mon Sep 17 00:00:00 2001 From: Brooke Vibber Date: Mon, 30 Dec 2024 05:35:22 -0800 Subject: [PATCH] optimize out a temporary down to 11.076 ms/px on xe --- mandel.s | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mandel.s b/mandel.s index 9f594e8..0239167 100644 --- a/mandel.s +++ b/mandel.s @@ -393,6 +393,18 @@ viewport_oy: sta dest + 1 .endmacro +; clobbers a, x +.macro sqr8_add16 dest, arg + ldx arg + clc + lda sqr_lobyte,x + adc dest + sta dest + lda sqr_hibyte,x + adc dest + 1 + sta dest + 1 +.endmacro + ; lookup table for top byte -> PORTB value for bank-switch ;.align 256 ; warning - if not aligned this will cost an extra cycle sometimes bank_switch_table: @@ -720,7 +732,6 @@ arg2_pos: ; h*h*256*256 + h*l*256 + h*l*256 + l*l sqr8 result, arg - ;imul8 inter, arg, arg, xe lda #0 sta result + 2 sta result + 3 @@ -731,9 +742,7 @@ arg2_pos: add16 result + 1, result + 1, inter add_carry result + 3 - sqr8 inter, arg + 1 - ;imul8 inter, arg + 1, arg + 1, xe - add16 result + 2, result + 2, inter + sqr8_add16 result + 2, arg + 1 rts ; 6 cyc .endscope