aboutsummaryrefslogtreecommitdiff
path: root/dla.s
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-10-31 15:07:02 -0400
committerB. Watson <urchlay@slackware.uk>2022-10-31 15:07:02 -0400
commitb0d6af17e313ac574fc7db761c79a812ec2ecf15 (patch)
tree380cf2d7b490800a1060dee97727268405ad0fc9 /dla.s
parent081a62091a60153e814b361d858e4a51ec59cd5f (diff)
downloaddla-asm-b0d6af17e313ac574fc7db761c79a812ec2ecf15.tar.gz
Keep default particles & seed on New.
Diffstat (limited to 'dla.s')
-rw-r--r--dla.s75
1 files changed, 43 insertions, 32 deletions
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
+ 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
- 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
+ ldx #>banner
+ jsr printmsg
+
+ lda maxparticles
+ ldx maxparticles+1
+ jsr printdecw
+
+ lda #<prompt
+ ldx #>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
+ ldx #>seedprompt
+ jsr printmsg
+ ldx seedtype
inx
- bne pm2loop
-pm2done:
+ txa
+ jsr printdecb
+ lda #<seedprompt2
+ ldx #>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: