aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2022-11-17 02:10:23 -0500
committerB. Watson <urchlay@slackware.uk>2022-11-17 02:10:23 -0500
commit17452e6854ef29efeaaee862a08d50186c444515 (patch)
treef4bfda66225060bea9f54b3042b8bc96f299a67a
parent6c612710debc11f942e4390aa636991e22d40d89 (diff)
downloaddla-asm-17452e6854ef29efeaaee862a08d50186c444515.tar.gz
dla2csv.xex: use register for inp in convert(), add profiling.
-rw-r--r--Makefile2
-rw-r--r--dla2csv.c17
-rw-r--r--dla2csv.xexbin11277 -> 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
--- a/dla2csv.xex
+++ b/dla2csv.xex
Binary files differ