From 8d7e5662f08dada2f88fa03b6129fb0eb3119de0 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 3 Nov 2022 15:16:19 -0400 Subject: Micro-optimizations. --- dla.s | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dla.s b/dla.s index 927acb8..4b2be32 100644 --- a/dla.s +++ b/dla.s @@ -531,17 +531,20 @@ checkbounds: beq oob cmp max_x beq oob - sta cursor_x + ;sta cursor_x lda part_y cmp min_y beq oob cmp max_y beq oob - sta cursor_y + ;sta cursor_y + ; checkbounds is 30 cycles when the pixel is in bounds. + ; I think we can beat this. +checkneigh: ; check neighbors. used to be a subroutine, inlined it. ; also inlined plotsetup here. - ldx cursor_y + ldx part_y lda lineaddrs_l,x sta pixptr lda lineaddrs_h,x @@ -550,7 +553,7 @@ checkbounds: ; 3/4 of the time, we can use a faster code path, check ; (-1,0) and (1,0) at the same time. this happens only when ; both pixels lie within the same byte. - ldx cursor_x + ldx part_x lda fastmasks,x beq slow_x ldy xoffsets,x @@ -570,13 +573,13 @@ slow_x: bne stick check_y: ; (0,-1) - ldx cursor_y ;3 + ldx part_y ;3 lda lineaddrs_l-1,x ;5 sta pixptr ;3 lda lineaddrs_h-1,x ;5 sta pixptr+1 ;3 ;=19 - ldx cursor_x + ldx part_x ldy xoffsets,x lda xmasks,x sta pixmask -- cgit v1.2.3