diff options
-rw-r--r-- | dla.s | 11 | ||||
-rw-r--r-- | drunkwalk.s | 12 |
2 files changed, 9 insertions, 14 deletions
@@ -39,8 +39,6 @@ screenptr = pixptr2 circlesize: .res 1 ; 0 to 3 -part_x: .res 1 ; x/y coords of current particle -part_y: .res 1 particles: .res 2 spawn_x: .res 2 spawn_y: .res 2 @@ -81,6 +79,7 @@ init: sta maxparticles lda #>DEFAULTPART sta maxparticles+1 + ; end of init stuff. ; "New" option jumps here, restore GR.0 screen getargs: @@ -184,17 +183,13 @@ wl: next_particle: ldy RANDOM ; spawn a new particle lda (spawn_x),y - sta part_x + sta cursor_x lda (spawn_y),y - sta part_y + sta cursor_y jsr drunkwalk ; walk it around beq next_particle ; if it went out of bounds, try again ; particle stuck to an existing pixel, draw it - lda part_x - sta cursor_x - lda part_y - sta cursor_y jsr plot inc particles diff --git a/drunkwalk.s b/drunkwalk.s index 6156e4a..ca017c0 100644 --- a/drunkwalk.s +++ b/drunkwalk.s @@ -10,8 +10,8 @@ oob: rts drunkwalk: - ldy part_x ; 3 - ldx part_y ; 3 + ldy cursor_x ; 3 + ldx cursor_y ; 3 lda lineaddrs_l,x ; 5 sta pixptr ; 3 @@ -27,14 +27,14 @@ up: selfmod_ymin = * + 1 cpx #0 ; 2 beq oob ; 2 - stx part_y + stx cursor_y jmp check_lru down: inx ; 2 ; N=1 V=0 down selfmod_ymax = * + 1 cpx #0 ; 2 beq oob ; 2 - stx part_y + stx cursor_y jmp check_lrd lr: bvc right ; 2/3 @@ -43,7 +43,7 @@ left: selfmod_xmin = * + 1 cpy #0 ; 2 beq oob ; 2 - sty part_x + sty cursor_x ; check left neighbor (we just vacated the right one) dey lda (pixptr),y @@ -55,7 +55,7 @@ right: selfmod_xmax = * + 1 cpy #0 ; 2 beq oob ; 2 - sty part_x + sty cursor_x ; check right neighbor (we just vacated the left one) iny lda (pixptr),y |