From d7ae2f127c09229227f91d2309bc044a49dab2b4 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 6 Nov 2022 16:09:13 -0500 Subject: Remove dead code, save 3 cycles in drunkwalk, v0.1.3. --- dla.s | 73 +++++-------------------------------------------------------------- 1 file changed, 5 insertions(+), 68 deletions(-) diff --git a/dla.s b/dla.s index 785f3e9..3e549f5 100644 --- a/dla.s +++ b/dla.s @@ -461,39 +461,6 @@ plot: sta (pixptr),y rts -;;; Subroutine: unplot -;;; erases a pixel at (cursor_x, cursor_y) -unplot: - jsr plotsetup - lda pixmask - eor #$ff - sta pixmask - lda (pixptr),y - and pixmask - sta (pixptr),y - rts - -;;; Subroutine: locate -;;; check the pixel at (cursor_x, cursor_y) -;;; if set, return with Z=0 -;;; otherwise, return with Z=1 -;;;; Inlined (keep for reference) -;locate: -; jsr plotsetup -; and (pixptr),y -; rts - -;;; Subroutine: spawn -;;; Pick a random point on the edge of a circle -;;;; Inlined (keep for reference) -; spawn: -; ldy RANDOM -; lda (spawn_x),y -; sta part_x -; lda (spawn_y),y -; sta part_y -; rts - oob: rts ;;; Subroutine: drunkwalk @@ -551,42 +518,10 @@ selfmod_xmax = * + 1 lda xmasks+1,x ; 4 and (pixptr),y ; 5 bne stick ; 2/3 - beq check_ud ; 3 ; still check Y neighbors. - -checkneigh: - ; check neighbors. used to be a subroutine, inlined it. - ; we only get here when the pixel has moved up or down (not left/right). - ; also inlined plotsetup here. - sty part_y ; 3 - lda lineaddrs_l,y ; 5 - sta pixptr ; 3 - lda lineaddrs_h,y ; 5 - sta pixptr+1 ; 3 - - ; 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 part_x ; X already has this from before - lda fastmasks,x ; 4 - beq slow_x ; 2/3 - ldy xoffsets,x ; 4 - and (pixptr),y ; 5 - bne stick ; 2/3 - beq check_ud ; 2/3 -slow_x: - ; (-1,0) - ldy xoffsets-1,x ; 4 - lda xmasks-1,x ; 4 - and (pixptr),y ; 5 - bne stick ; 2/3 - ; (1,0) - ldy xoffsets+1,x ; 4 - lda xmasks+1,x ; 4 - and (pixptr),y ; 5 - bne stick ; 2/3 + ; fall through to check_ud check_ud: - ; this happens no matter what direction the pixel moved. + ; this happens when the pixel moved left or right. ; (0,-1) ; subtract 32 (one line) from the pointer. one cycle faster ; than reloading from lineaddrs_l/h table. @@ -616,6 +551,7 @@ stick: ; we always get here with Z flag clear stx part_x ; only update part_x at exit. rts + ; this happens when the pixel moved up. check_lru: sty part_y ; 3 lda lineaddrs_l,y ; 5 @@ -665,6 +601,7 @@ check_u: jmp dwloop ; 3 ; too far for a branch + ; this happens when the pixel moved down. check_lrd: sty part_y ; 3 lda lineaddrs_l,y ; 5 @@ -868,7 +805,7 @@ ci_done: ; banner and saveprompt must start with a clear-screen code. banner: .byte $7d, "Diffusion Limited Aggregate",$9b - .byte "Urchlay's ASM version 0.1.2",$9b,$9b + .byte "Urchlay's ASM version 0.1.3",$9b,$9b .byte "Particle count range: 1 to 65535",$9b .byte "How many particles [",$0 -- cgit v1.2.3