From dc6e3ae419dfefaceee57592525c7d1bf9f4ca4c Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 25 Oct 2022 05:28:20 -0400 Subject: Micro-optimization: inline spawn subroutine. --- dla.s | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/dla.s b/dla.s index 0c4b452..89c466a 100644 --- a/dla.s +++ b/dla.s @@ -173,7 +173,11 @@ wl: jsr plot next_particle: - jsr spawn ; spawn a new particle + ldy RANDOM ; spawn a new particle + lda (spawn_x),y + sta part_x + lda (spawn_y),y + sta part_y jsr drunkwalk ; walk it around beq next_particle ; if it went out of bounds, try again @@ -478,22 +482,22 @@ unplot: ;;; check the pixel at (cursor_x, cursor_y) ;;; if set, return with Z=0 ;;; otherwise, return with Z=1 -locate: - jsr plotsetup - and (pixptr),y - rts - -masks: .byte $80,$40,$20,$10,$08,$04,$02,$01 +;;;; Inlined (keep for reference) +;locate: +; jsr plotsetup +; and (pixptr),y +; rts ;;; Subroutine: spawn ;;; Pick a random point on the edge of a circle -spawn: - ldy RANDOM - lda (spawn_x),y - sta part_x - lda (spawn_y),y - sta part_y - rts +;;;; Inlined (keep for reference) +; spawn: +; ldy RANDOM +; lda (spawn_x),y +; sta part_x +; lda (spawn_y),y +; sta part_y +; rts ;;; Subroutine: drunkwalk ;;; Walk the point around randomly until it either is @@ -532,7 +536,6 @@ checkbounds: beq oob cmp max_y beq oob - sta cursor_y ldx #0 @@ -578,8 +581,6 @@ stick: oob: rts - rts - ;;;;; end of executable code ; dlatbl.s is generated by perl script, mkdlatbl.pl -- cgit v1.2.3