From b0d6af17e313ac574fc7db761c79a812ec2ecf15 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 31 Oct 2022 15:07:02 -0400 Subject: Keep default particles & seed on New. --- dla.s | 75 ++++++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 32 deletions(-) (limited to 'dla.s') diff --git a/dla.s b/dla.s index 7106a0a..debb196 100644 --- a/dla.s +++ b/dla.s @@ -49,9 +49,13 @@ xex_org loadaddr .include "io.s" ; printchrx and getchrx + .include "printint.s" ; init stuff gets done once, at startup init: + lda #0 + sta seedtype + sta LMARGN lda SDMCTL sta old_dma lda SDLSTL @@ -59,6 +63,12 @@ init: lda SDLSTH sta old_dl+1 + ; set default particles (if user just hits return) + lda #DEFAULTPART + sta maxparticles+1 + ; "New" option jumps here, restore GR.0 screen getargs: lda #$90 @@ -74,22 +84,19 @@ getargs: lda old_dma sta SDMCTL - ; set default particles (if user just hits return) - lda #DEFAULTPART - sta maxparticles+1 - ; print banner and prompt. -printmsg: - ldx #0 -pmloop: - lda msg,x - beq pmdone - jsr printchrx - inx - bne pmloop -pmdone: +printbanner: + lda #banner + jsr printmsg + + lda maxparticles + ldx maxparticles+1 + jsr printdecw + + lda #prompt + jsr printmsg ; use CIO to read input, so user can use backspace/etc. jsr readline @@ -100,13 +107,13 @@ pmdone: lda #0 sta CIX jsr AFP ; ASCII to floating point, result in FR0 - bcs printmsg ; C set means error + bcs printbanner ; C set means error jsr FPI ; convert FR0 to integer (result in FR0) - bcs printmsg + bcs printbanner lda FR0 tax ora FR0+1 ; we don't accept 0 for an answer! - beq printmsg + beq printbanner lda FR0+1 stx maxparticles sta maxparticles+1 @@ -114,21 +121,21 @@ pmdone: usedefault: ; print seed type prompt - ldx #0 -pm2loop: - lda msg2,x - beq pm2done - jsr printchrx + lda #seedprompt + jsr printmsg + ldx seedtype inx - bne pm2loop -pm2done: + txa + jsr printdecb + lda #seedprompt2 + jsr printmsg readgen: jsr getchrx cmp #$9b - bne noteol - lda #$31 -noteol: + beq generate cmp #$31 bcc readgen cmp #$35 @@ -700,13 +707,17 @@ readline: ;;;;; end of executable code, data tables from here on out. ; prompts -msg: +banner: .byte $7d, "Diffusion Limited Aggregate",$9b .byte "Urchlay's ASM version 0.0.7",$9b,$9b .byte "Particle count range: 1 to 65535",$9b - .byte "How many particles [",.sprintf("%d", DEFAULTPART),"]? ",$0 -msg2: - .byte $9b,"Seed Type: ",$9b,"1=Dot 2=Plus 3=4Dots 4=Line [1]? ",$0 + .byte "How many particles [",$0 +prompt: + .byte "]? ",$0 +seedprompt: + .byte $9b,"Seed Type: ",$9b,"1=Dot 2=Plus 3=4Dots 4=Line [",$0 +seedprompt2: + .byte "]? ",$0 ; screen codes for menu menumsg: -- cgit v1.2.3