diff options
author | B. Watson <urchlay@slackware.uk> | 2022-11-08 02:08:54 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2022-11-08 02:08:54 -0500 |
commit | 8303d83efab1ee1135cf2396a792479966ed2303 (patch) | |
tree | b031c989e686b8e1fd0bb33998a8def772489b21 | |
parent | c38d545b4882898faccf9db32d88ace67f4e1f05 (diff) | |
download | dla-asm-8303d83efab1ee1135cf2396a792479966ed2303.tar.gz |
drunkwalk does spawning and plotting, too.
-rw-r--r-- | dla.s | 12 | ||||
-rw-r--r-- | drunkwalk.s | 21 |
2 files changed, 18 insertions, 15 deletions
@@ -181,17 +181,7 @@ wl: jsr drawseed next_particle: - ldy RANDOM ; spawn a new particle - lda (spawn_x),y - sta cursor_x - lda (spawn_y),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 - jsr plot - + jsr drunkwalk ; spawn, walk around, plot (all in one) inc particles bne ph_ok inc particles+1 diff --git a/drunkwalk.s b/drunkwalk.s index ca017c0..02ab67d 100644 --- a/drunkwalk.s +++ b/drunkwalk.s @@ -6,12 +6,16 @@ ;;; possible. ; Y and X are backwards: Y holds the X coordinate, and X holds the Y coordinate. ; Has to be, because there's no (zpind),x addressing mode. -oob: - rts drunkwalk: - ldy cursor_x ; 3 - ldx cursor_y ; 3 +oob: + ldy RANDOM ; spawn a new particle + lda (spawn_x),y + sta cursor_x + lda (spawn_y),y + sta cursor_y + tax + ldy cursor_x lda lineaddrs_l,x ; 5 sta pixptr ; 3 @@ -132,4 +136,13 @@ check_lrd: jmp move_pixel stick: + ; pixel stuck next to an existing pixel, draw it and return. + ldx cursor_y + lda lineaddrs_l,x + sta pixptr + lda lineaddrs_h,x + sta pixptr+1 + ldy cursor_x + lda #1 + sta (pixptr),y rts |