diff options
author | B. Watson <urchlay@slackware.uk> | 2022-11-14 18:12:54 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2022-11-14 18:12:54 -0500 |
commit | 36dcaa5343f1abbf76df9e34f25a61d322eb9388 (patch) | |
tree | 7780dc65df0ca83a2400cee6928c32bcc13ab553 | |
parent | 9a2f5f4c83201c193dd1029aeca04cff44574e60 (diff) | |
download | dla-asm-36dcaa5343f1abbf76df9e34f25a61d322eb9388.tar.gz |
v0.3.1: dla.xex: handle Break and EOF at prompts.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | dla.s | 24 | ||||
-rw-r--r-- | dla.xex | bin | 4696 -> 4696 bytes | |||
-rw-r--r-- | dla2csv.xex | bin | 11338 -> 11338 bytes | |||
-rwxr-xr-x | dla2img.sh | 2 | ||||
-rw-r--r-- | dlaver.h | 2 | ||||
-rw-r--r-- | dlaver.inc | 2 | ||||
-rw-r--r-- | io.s | 9 |
9 files changed, 31 insertions, 12 deletions
@@ -33,7 +33,7 @@ dla2csv: dla2csv.c dlaver.h # turn off unused parameter warnings because cc65 insists on complaining # that argc and argv are unused. dla2csv.xex: dla2csv.c dlaver.h - $(CL65) $(CL65FLAGS) -t atari -W -unused-param -o $@ dla2csv.c + $(CL65) $(CL65FLAGS) -t atari -W -unused-param -m dla2csv.map -o $@ dla2csv.c disk: drive1.atr @@ -1 +1 @@ -0.3.0 +0.3.1 @@ -136,8 +136,15 @@ printbanner: ; use CIO to read input, so user can use backspace/etc. jsr readline lda linebuf + + ; check for error (user hit Break or Ctrl-3 for EOF). + cpy #1 + bne printbanner + + ; if user hit Return by itself, use the old value. cmp #$9b - beq usedefault ; if user hit Return + beq prompt4seed + ; use floating point ROM to convert input to an integer. lda #0 sta CIX @@ -153,8 +160,7 @@ printbanner: stx maxparticles sta maxparticles+1 -usedefault: - +prompt4seed: ; print seed type prompt lda #<seedprompt ldx #>seedprompt @@ -168,7 +174,10 @@ usedefault: jsr printmsg readseed: - jsr getchrx + jsr getchr ; N.B. getchrx won't work here (see io.s) + cpy #1 + bne readseed + cmp #$9b beq dfltseed ; use default if user pressed return cmp #$31 @@ -285,7 +294,7 @@ main_done: waitkey: jsr getchr - ; see what key was hit + ; see what key was hit. don't need extra code for Break or ^3 here. and #$5f ; ignore case cmp #'R' ; Redo bne notredo @@ -306,9 +315,14 @@ saveimage: jsr restore_gr0 ; back to GR.0, so we can... lda #<saveprompt ldx #>saveprompt +siprompt: jsr printmsg ; ...prompt for, and... jsr readline ; ...let the user type a filename. + ; if user hit Break or ^3, prompt again. + cpy #1 + bne siprompt + jsr close1 ; make sure the IOCB is closed before we open it! ; prepend D: to the filename, if there's no device given. Binary files differdiff --git a/dla2csv.xex b/dla2csv.xex Binary files differindex 4809291..ece05b8 100644 --- a/dla2csv.xex +++ b/dla2csv.xex @@ -16,7 +16,7 @@ SELF="`basename $0`" # This line may get changed by the Makefile (do not hand-edit): -VERSION=0.3.0 +VERSION=0.3.1 # allow overriding magick path via environment. if [ "$MAGICK" = "" ]; then @@ -1 +1 @@ -#define VERSION "0.3.0" +#define VERSION "0.3.1" @@ -1 +1 @@ - .define VERSION "0.3.0" + .define VERSION "0.3.1" @@ -26,7 +26,9 @@ printchr: ; Subroutine: getchr ; ; Read ATASCII character from keyboard, return in A, without - ; preserving registers. + ; preserving registers. On return, Y = 1 on success. On error, + ; Y will contain the error number (probably 128 for Break key or + ; 136 for EOF). Note that getchrx does NOT return the error code in Y! ; ; Uses the published and immutable KEYBDV address in the ROM, meaning ; it (a) doesn't require an IOCB open to the K: device, and (b) @@ -111,12 +113,15 @@ printchrx: ; Actually, the return value here is also in Y, if you can think of a ; use for that. ; + ; Note: The CIO error code is NOT returned in Y! Use getchr if you + ; need that. + ; ; Calls getchr. ; getchrx: txa ; save X, pha ; on stack. - jsr getchr ; get the character. + jsr getchr ; get the character. tay ; save A (our return value). pla ; restore X, tax ; from stack. |