aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dla.s34
1 files changed, 25 insertions, 9 deletions
diff --git a/dla.s b/dla.s
index 4b2be32..4b861f8 100644
--- a/dla.s
+++ b/dla.s
@@ -380,13 +380,13 @@ jsaveimage:
set_limits:
ldx circlesize
lda xmin,x
- sta min_x
+ sta selfmod_xmin
lda ymin,x
- sta min_y
+ sta selfmod_ymin
lda xmax,x
- sta max_x
+ sta selfmod_xmax
lda ymax,x
- sta max_y
+ sta selfmod_ymax
rts
;;; Subroutine: initscreen
@@ -526,16 +526,21 @@ right:
inc part_x ;3
checkbounds:
+ ; all the "cmp #0" here get their operands modified by set_limits.
lda part_x
- cmp min_x
+selfmod_xmin = * + 1
+ cmp #0
beq oob
- cmp max_x
+selfmod_xmax = * + 1
+ cmp #0
beq oob
;sta cursor_x
lda part_y
- cmp min_y
+selfmod_ymin = * + 1
+ cmp #0
beq oob
- cmp max_y
+selfmod_ymax = * + 1
+ cmp #0
beq oob
;sta cursor_y
; checkbounds is 30 cycles when the pixel is in bounds.
@@ -573,12 +578,23 @@ slow_x:
bne stick
check_y:
; (0,-1)
+.if 0
ldx part_y ;3
lda lineaddrs_l-1,x ;5
sta pixptr ;3
lda lineaddrs_h-1,x ;5
sta pixptr+1 ;3
;=19
+.else
+ lda pixptr ; 3
+ sec ; 2
+ sbc #$20 ; 2
+ sta pixptr ; 3
+ bcs pp1ok ; 3|2
+ dec pixptr+1 ; 0|5
+ ; =13|17 (avg closer to 13)
+pp1ok:
+.endif
ldx part_x
ldy xoffsets,x
lda xmasks,x
@@ -594,7 +610,7 @@ check_y:
bne stick
jmp drunkwalk ; too far for a branch
-stick:
+stick: ; we always get here with Z flag clear
rts
;;; Subroutine: drawseed