From 36dcaa5343f1abbf76df9e34f25a61d322eb9388 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 14 Nov 2022 18:12:54 -0500 Subject: v0.3.1: dla.xex: handle Break and EOF at prompts. --- Makefile | 2 +- VERSION | 2 +- dla.s | 24 +++++++++++++++++++----- dla.xex | Bin 4696 -> 4696 bytes dla2csv.xex | Bin 11338 -> 11338 bytes dla2img.sh | 2 +- dlaver.h | 2 +- dlaver.inc | 2 +- io.s | 9 +++++++-- 9 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index fdede2c..c92b9eb 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/VERSION b/VERSION index 0d91a54..9e11b32 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +0.3.1 diff --git a/dla.s b/dla.s index f08084f..627ebe9 100644 --- a/dla.s +++ b/dla.s @@ -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 @@ -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 +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. diff --git a/dla.xex b/dla.xex index d6b762b..78fd3ca 100644 Binary files a/dla.xex and b/dla.xex differ diff --git a/dla2csv.xex b/dla2csv.xex index 4809291..ece05b8 100644 Binary files a/dla2csv.xex and b/dla2csv.xex differ diff --git a/dla2img.sh b/dla2img.sh index 637ee7f..ba97d95 100755 --- a/dla2img.sh +++ b/dla2img.sh @@ -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 diff --git a/dlaver.h b/dlaver.h index b3a9dfe..5fd3a70 100644 --- a/dlaver.h +++ b/dlaver.h @@ -1 +1 @@ -#define VERSION "0.3.0" +#define VERSION "0.3.1" diff --git a/dlaver.inc b/dlaver.inc index 44f0d63..dbfff61 100644 --- a/dlaver.inc +++ b/dlaver.inc @@ -1 +1 @@ - .define VERSION "0.3.0" + .define VERSION "0.3.1" diff --git a/io.s b/io.s index 7b63f95..6968aa4 100644 --- a/io.s +++ b/io.s @@ -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. -- cgit v1.2.3