aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-11-12 17:39:54 -0500
committerB. Watson <urchlay@slackware.uk>2022-11-12 17:39:54 -0500
commit9d0a7125585360cad3ed3e6ddb6a6168f1503eeb (patch)
treed606c2ca356ac6fe268c7891447bfac1490628d1
parenta6d47b5b53ca4fcd814136c2d7eec475b03ef5d6 (diff)
downloaddla-asm-9d0a7125585360cad3ed3e6ddb6a6168f1503eeb.tar.gz
dla2csv derp.
-rw-r--r--dla2csv.c18
-rw-r--r--dla2csv.xexbin11150 -> 11176 bytes
2 files changed, 13 insertions, 5 deletions
diff --git a/dla2csv.c b/dla2csv.c
index 4910f7e..79de16a 100644
--- a/dla2csv.c
+++ b/dla2csv.c
@@ -53,11 +53,11 @@ void atari_perror(char *msg) {
so call disable_break() at startup, then wrap disk I/O in
enable_break() and disable_break(). */
void enable_break() {
- OS.pokmsk = POKEY_WRITE.irqen = POKEY_READ.irqst | 0x80;
+ OS.pokmsk = POKEY_WRITE.irqen = (OS.pokmsk | 0x80);
}
void disable_break() {
- OS.pokmsk = POKEY_WRITE.irqen = POKEY_READ.irqst & 0x7f;
+ OS.pokmsk = POKEY_WRITE.irqen = (OS.pokmsk & 0x7f);
}
void init_console(void) {
@@ -207,6 +207,7 @@ int prompt_yn(char *prompt, int default_y) {
opens the file. */
FILE *prompt_filename(const char *name, const char *mode) {
FILE *f = NULL;
+
putchar('\n');
while(f == NULL) {
printf("%s file: ", name);
@@ -220,22 +221,27 @@ FILE *prompt_filename(const char *name, const char *mode) {
}
continue;
}
+
#ifdef __ATARI__
/* if the user enters a single digit, show directory of that drive. */
if(isdigit(stringbuf[0])) {
show_dir(stringbuf[0]);
continue;
}
- /* if there's no device spec (D: or D1: etc), prepend D: */
+
+ /* if user entered a filename with no device spec (D: or D1: etc),
+ prepend D: */
if(!strchr(stringbuf, ':')) {
memmove(stringbuf+2, stringbuf, strlen(stringbuf) + 1);
stringbuf[0] = 'D';
stringbuf[1] = ':';
}
#endif
+
enable_break();
f = fopen(stringbuf, mode);
disable_break();
+
if(!f) PERROR(stringbuf);
}
return f;
@@ -244,6 +250,7 @@ FILE *prompt_filename(const char *name, const char *mode) {
/* Prompt for and read EOL type, retry if needed. Will not return
until a valid number was entered. */
char *prompt_eol(void) {
+ static int default_eoltype = 0;
int i;
putchar('\n');
@@ -254,17 +261,18 @@ char *prompt_eol(void) {
i = -1;
while(i == -1) {
- printf("Line ending type[1]? ");
+ printf("Line ending type[%d]? ", default_eoltype + 1);
fflush(stdout);
readstring();
if(stringbuf[0] == '\n') {
- i = 0;
+ i = default_eoltype;
} else {
i = stringbuf[0] - 49; /* ASCII 1-3 => 0-2 */
if(i < 0 || i > 2)
i = -1;
}
}
+ default_eoltype = i;
return eoltypes[i][1];
}
diff --git a/dla2csv.xex b/dla2csv.xex
index 3d03634..f89fdd2 100644
--- a/dla2csv.xex
+++ b/dla2csv.xex
Binary files differ