aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-11-16 19:03:37 -0500
committerB. Watson <urchlay@slackware.uk>2022-11-16 19:08:31 -0500
commitbdd220fe5f4b0603b547a4370250a376f2e94c03 (patch)
tree9b404e931966adef0d34a27b53442c5e7c8d2a31
parent10f07d4652cee36a792edf555f5c8bad2c6ca04d (diff)
downloaddla-asm-bdd220fe5f4b0603b547a4370250a376f2e94c03.tar.gz
dla2csv.xex: stop using atexit(), it crashes under MyDOS.
-rw-r--r--autorun.s15
-rw-r--r--autorun.sysbin1348 -> 1381 bytes
-rw-r--r--dla.atrbin92176 -> 92176 bytes
-rw-r--r--dla2csv.c15
-rw-r--r--dla2csv.xexbin11322 -> 11270 bytes
5 files changed, 28 insertions, 2 deletions
diff --git a/autorun.s b/autorun.s
index 8f75ac3..af3b1d9 100644
--- a/autorun.s
+++ b/autorun.s
@@ -135,6 +135,18 @@ keytabloop:
; load and run the file (Y is index into filename table)
load_file:
+ ; first print a "Loading D1:whatever" message.
+ sty keycode
+ lda #<loadingmsg
+ ldx #>loadingmsg
+ jsr printmsg
+ ldy keycode
+ lda fntab_l,y
+ ldx fntab_h,y
+ jsr printmsg
+ ldy keycode
+
+ ; now we can set up the IOCB and call CIO to load the file.
ldx #$10 ; IOCB #1
lda #$28 ; MyDOS, Sparta 3.2, and SDX all support this XIO
sta ICCOM,x
@@ -178,9 +190,11 @@ exit:
; a good reason...
dla_filename: .byte "D1:DLA.XEX"
dla_fn_len = * - dla_filename
+ .byte 0 ; null terminate for printmsg
csv_filename: .byte "D1:DLA2CSV.XEX"
csv_fn_len = * - csv_filename
+ .byte 0
; these tables only have 2 entries, but could have many more if
; we ever need them (up to 255).
@@ -194,5 +208,6 @@ keytab: .byte KEY_1, KEY_2, KEY_NONE
diskerrmsg: .byte "I/O Error ",0
presskeymsg: .byte $9b,"Press any key...",0
+loadingmsg: .byte "Loading ",0
xex_run main
diff --git a/autorun.sys b/autorun.sys
index f94eeb4..ad646d1 100644
--- a/autorun.sys
+++ b/autorun.sys
Binary files differ
diff --git a/dla.atr b/dla.atr
index 5e57946..30577f9 100644
--- a/dla.atr
+++ b/dla.atr
Binary files differ
diff --git a/dla2csv.c b/dla2csv.c
index 32e673b..c04e793 100644
--- a/dla2csv.c
+++ b/dla2csv.c
@@ -95,8 +95,11 @@ void print_id(void) {
OS.color2 = TEXT_BG_COLOR;
/* Put things back the way they were, when we exit. */
+ /* Nope. Using atexit() here makes MyDOS crash. Used
+ atari_exit() and EXIT() macro instead.
atexit(restore_colors);
atexit(enable_break);
+ */
}
void print_banner(void) {
@@ -156,6 +159,13 @@ void print_id(void) {
if(column) putchar('\n');
}
+ void atari_exit(int status) {
+ restore_colors();
+ enable_break();
+ exit(0);
+ }
+ #define EXIT(x) atari_exit(x)
+
/* On the Atari, EOF is Ctrl-3. *Terrible* things happen if we
ever get EOF on stdin on the Atari! The screen shows gibberish
(display list gets mangled). Even calling exit() doesn't help.
@@ -181,6 +191,7 @@ void print_id(void) {
#define enable_break() noop()
#define disable_break() noop()
#define init_console() noop()
+ #define EXIT(x) exit(1)
#define exit_eof_stdin() exit(1)
#endif
@@ -247,7 +258,7 @@ FILE *prompt_filename(const char *name, const char *mode) {
stringbuf[strlen(stringbuf) - 1] = '\0'; /* kill trailing \n */
if(strlen(stringbuf) == 0) {
if(prompt_yn("Exit program", 0)) {
- exit(0);
+ EXIT(0);
}
continue;
}
@@ -468,5 +479,5 @@ int main(int argc, char **argv) {
if(!prompt_yn("\nConvert another file", 1))
break;
}
- exit(0);
+ EXIT(0);
}
diff --git a/dla2csv.xex b/dla2csv.xex
index 0d03935..b83f1e2 100644
--- a/dla2csv.xex
+++ b/dla2csv.xex
Binary files differ