aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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