From 9aed762ea191d7dd63d3cb327adb95f1e15905c1 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 17 Nov 2022 11:11:38 -0500 Subject: Attempt to optimize dla2csv.xex. --- dla2csv.c | 25 ++++++++++++++----------- dla2csv.xex | Bin 10501 -> 10411 bytes 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dla2csv.c b/dla2csv.c index 4e5aa51..a7a4e6e 100644 --- a/dla2csv.c +++ b/dla2csv.c @@ -35,7 +35,7 @@ void print_id(void) { #ifdef __ATARI__ /* Uncomment this to see elapsed time in convert() */ - /* #define PROFILE */ + // #define PROFILE /* cc65 doesn't "localize" \b to the Atari backspace character, so: */ #define BS CH_DEL @@ -106,7 +106,7 @@ void print_id(void) { } void print_banner(void) { - int i; + unsigned char i; print_id(); @@ -132,10 +132,10 @@ void print_id(void) { drive is an ASCII digit, e.g. 0x31 is drive 1. */ void show_dir(char drive) { static char dirspec[16]; - char device = 'D'; DIR *dir; struct dirent *ent; - int column = 0; + char device = 'D'; + unsigned char column = 0; if(drive == '0') { drive++; @@ -377,8 +377,16 @@ int read_file(void) { /* convert() returns the number of particles on success, 0 on failure. */ int convert(char *eol) { - register char *inp; - int x, y, xmask, particles; +#ifdef __ATARI__ + register +#endif + unsigned char x, y; +#ifdef __ATARI__ + register +#endif + char *inp = inbuf; + unsigned char xmask = 0x80; + int particles = 0; outf = prompt_filename("Output CSV", "wb"); @@ -386,15 +394,10 @@ int convert(char *eol) { printf("Press Ctrl-C to abort conversion.\n"); #endif printf("\nConverting... "); - fflush(stdout); /* CSV file header row (column names) */ fprintf(outf, "x,y%s", eol); - inp = inbuf; - xmask = 0x80; - particles = 0; - #ifdef __ATARI__ #ifdef PROFILE OS.rtclok[0] = OS.rtclok[1] = OS.rtclok[2] = 0; diff --git a/dla2csv.xex b/dla2csv.xex index 77a67c4..c9bd19f 100644 Binary files a/dla2csv.xex and b/dla2csv.xex differ -- cgit v1.2.3