[cc65] Memory impact of Atari library compile time defines

From: Christian Grössler <chris1groessler.org>
Date: 2009-11-15 19:05:45
Hi,

here are the impacts of various parameter which can be disabled
when compiling the library:


empty.c:
--------

int main ()
{
     return 0;
}


hello.c:
--------

#include <stdio.h>
int main ()
{
     printf ("Hello world!\n");
     return 0;
}


open.c:
-------

#include <stdio.h>
int main ()
{
         FILE *fp;
         fp = fopen("bla.txt","w");
         if (fp) fclose(fp);
         return 0;
}



default configuration:

-rw-r--r-- 1 chris chris  557 Nov 15 16:23 empty
-rw-r--r-- 1 chris chris 3277 Nov 15 16:23 hello
-rw-r--r-- 1 chris chris 2055 Nov 15 16:33 open

no DYNAMIC_DD:

-rw-r--r-- 1 chris chris  430 Nov 15 16:25 empty
-rw-r--r-- 1 chris chris 3150 Nov 15 16:24 hello
-rw-r--r-- 1 chris chris 1927 Nov 15 16:34 open

no UCASE_FILENAME:

-rw-r--r-- 1 chris chris  430 Nov 15 16:35 empty
-rw-r--r-- 1 chris chris 3150 Nov 15 16:35 hello
-rw-r--r-- 1 chris chris 1504 Nov 15 16:35 open


DYNAMIC_DD should be easily possible to make a contructor
of open(). Then its size impact would only affect programs
which really open files.

UCASE_FILENAME is a different thing, though. Despite its
name it not only uppercases file names at open() time (needed
for DOS 2.5 which only accepts file names in uppercase), it
also prepends a "Dx:" to the file name. Because of this one
can open "BLA.TXT" instead of "D0:BLA.TXT". "BLA.TXT" alone
is no valid string for the DOS open routine. So without
this setting the user program must take care to uppercase
the filename and prepend a "Dx:". Additionally, the driver
names for dynamically loaded drivers would have to be
adapted. (They don't contain a "Dx:" in front.)

The file descriptor initialization is done in order
to have stdin/stdout/stderr implicitly available.
I think I could move it to a contructor for open/close/read/write.
Then programs which use conio and/or joysticks to get their
input and use conio for output shouldn't be affected.


regards,
chris
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Nov 15 19:06:02 2009

This archive was generated by hypermail 2.1.8 : 2009-11-15 19:06:05 CET