From 17452e6854ef29efeaaee862a08d50186c444515 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 17 Nov 2022 02:10:23 -0500 Subject: dla2csv.xex: use register for inp in convert(), add profiling. --- Makefile | 2 +- dla2csv.c | 17 ++++++++++++++++- dla2csv.xex | Bin 11277 -> 10501 bytes 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 19bb980..4151db7 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ CA65FLAGS=-t none # also works, but not all DOSes have MEMLO set that low... must investigate # why this happens. CC65=$(CL65) -CC65FLAGS=-t atari -W -unused-param --start-addr 0x2800 +CC65FLAGS=-t atari -W -unused-param --start-addr 0x2800 -Or # Host C compiler (usually a symlink to gcc or clang). CC=cc diff --git a/dla2csv.c b/dla2csv.c index 80880d4..4e5aa51 100644 --- a/dla2csv.c +++ b/dla2csv.c @@ -34,6 +34,9 @@ void print_id(void) { #ifdef __ATARI__ +/* Uncomment this to see elapsed time in convert() */ + /* #define PROFILE */ + /* cc65 doesn't "localize" \b to the Atari backspace character, so: */ #define BS CH_DEL @@ -374,7 +377,7 @@ int read_file(void) { /* convert() returns the number of particles on success, 0 on failure. */ int convert(char *eol) { - char *inp; + register char *inp; int x, y, xmask, particles; outf = prompt_filename("Output CSV", "wb"); @@ -392,6 +395,12 @@ int convert(char *eol) { xmask = 0x80; particles = 0; +#ifdef __ATARI__ + #ifdef PROFILE + OS.rtclok[0] = OS.rtclok[1] = OS.rtclok[2] = 0; + #endif +#endif + /* write output file one line at a time */ /* loop over all the pixels, by row, then column. this loop is rather slow. */ @@ -435,6 +444,12 @@ int convert(char *eol) { } fclose(outf); +#ifdef __ATARI__ + #ifdef PROFILE + printf("\nElapsed time: %ds\n", ((OS.rtclok[1] << 8) | OS.rtclok[2]) / 60); + #endif +#endif + return particles; } diff --git a/dla2csv.xex b/dla2csv.xex index f25c2ca..77a67c4 100644 Binary files a/dla2csv.xex and b/dla2csv.xex differ -- cgit v1.2.3