aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dla.s29
1 files changed, 13 insertions, 16 deletions
diff --git a/dla.s b/dla.s
index fc5bdea..4a30921 100644
--- a/dla.s
+++ b/dla.s
@@ -511,41 +511,38 @@ drunkwalk:
ldx part_x ;3
; using bit/bmi/bvc saves 5.25 cycles on average, compared to
; immediate cmp and bne.
- ; 4 code paths: up=16, down=17, left=15, right=13, avg=15.25.
+ ; 4 code paths: up=15, down=18, left=19, right=17, avg=17.25.
; note that part_x and part_y are *never* zero; all the bne's here
; are "branch always".
+ ; all the "cmp #0" here get their operands modified by set_limits.
dwloop:
ldy part_y
bit RANDOM ;4 ; use top 2 bits (probably more random, definitely faster)
bmi lr ;2/3
bvc down ;2/3
dey ;2 ; N=1 V=1 up
- bne checkbounds ;3
+selfmod_ymin = * + 1
+ cpy #0 ; 2
+ beq oob ; 2
+ bne checkneigh ;3
down:
iny ;2 ; N=1 V=0 down
- bne checkbounds ;3
+selfmod_ymax = * + 1
+ cpy #0 ; 2
+ beq oob ; 2
+ bne checkneigh ;3
lr:
bvc right ;2/3
dex ;3 ; N=0 V=1 left
- bne checkbounds ;3
-right:
- inx ;3 ; N=0 V=0 right
-
-checkbounds:
- ; all the "cmp #0" here get their operands modified by set_limits.
selfmod_xmin = * + 1
cpx #0 ; 2
beq oob ; 2
+ bne checkneigh ;3
+right:
+ inx ;3 ; N=0 V=0 right
selfmod_xmax = * + 1
cpx #0 ; 2
beq oob ; 2
-selfmod_ymin = * + 1
- cpy #0 ; 2
- beq oob ; 2
-selfmod_ymax = * + 1
- cpy #0 ; 2
- beq oob ; 2
- ; checkbounds is 16 cycles when the pixel is in bounds.
checkneigh:
; check neighbors. used to be a subroutine, inlined it.