aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-11-08 01:31:41 -0500
committerB. Watson <urchlay@slackware.uk>2022-11-08 01:31:41 -0500
commitaf122e258fe45d5081213dc1ac55f782c3dd8b9f (patch)
tree351b140fda05bd1b8298d319a304e6225288718e
parent57587d7d306f5a4ca3597f44b584ce9ad2886866 (diff)
downloaddla-asm-af122e258fe45d5081213dc1ac55f782c3dd8b9f.tar.gz
Optimize the new drunkwalk...
-rw-r--r--drunkwalk.s18
1 files changed, 14 insertions, 4 deletions
diff --git a/drunkwalk.s b/drunkwalk.s
index ca80475..6156e4a 100644
--- a/drunkwalk.s
+++ b/drunkwalk.s
@@ -13,12 +13,12 @@ drunkwalk:
ldy part_x ; 3
ldx part_y ; 3
- ; do we need this now?
lda lineaddrs_l,x ; 5
sta pixptr ; 3
lda lineaddrs_h,x ; 5
sta pixptr+1 ; 3
+move_pixel:
bit RANDOM ; 4 ; use top 2 bits (probably more random, definitely faster)
bmi lr ; 2/3
bvc down ; 2/3
@@ -79,9 +79,14 @@ check_ud:
sta pixptr2+1
lda (pixptr2),y
bne stick
- jmp drunkwalk
+ jmp move_pixel
check_lru:
+ lda lineaddrs_l,x ; 5
+ sta pixptr ; 3
+ lda lineaddrs_h,x ; 5
+ sta pixptr+1 ; 3
+
; check left neighbor
dey
lda (pixptr),y
@@ -99,9 +104,14 @@ check_lru:
sta pixptr2+1
lda (pixptr2),y
bne stick
- jmp drunkwalk
+ jmp move_pixel
check_lrd:
+ lda lineaddrs_l,x ; 5
+ sta pixptr ; 3
+ lda lineaddrs_h,x ; 5
+ sta pixptr+1 ; 3
+
; check left neighbor
dey
lda (pixptr),y
@@ -119,7 +129,7 @@ check_lrd:
sta pixptr2+1
lda (pixptr2),y
bne stick
- jmp drunkwalk
+ jmp move_pixel
stick:
rts