Re: [cc65] Memory impact of Atari library compile time defines

From: Christian Grössler <>
Date: 2009-11-19 23:59:54

Ullrich von Bassewitz wrote:
> I cannot really comment on these two. But uppercasing file name string
> literals in the source code is not really a problem.

Hmm, yes, of course. But what about user input of filenames? If the C
code would have to deal with this I think it would have a bigger memory

I've invented these customizable defines in the Atari library makefile
in order to provide a default configuration which works out of the box
for most users. ("users" are in this case the developers using cc65,
not the "end users" running the program.)
But give advanced users a way to do some adjustments.

> And, browsing through
> crt0.s and ucase_fn.s, I can see a few places where it is possible to save a
> few bytes of code.

Please tell me where. 4 eyes see more than 2 eyes :-)

 > The code could also be written simpler, if the options are
> always assumed to be enabled (that is, with the .if's removed). For example in
> ucase_fn: Always allocate enough stack space for the length of the string +
> the three bytes for drive and terminator.

Simpler or smaller? I've tried to make it optimal for any ".if" case.

>> 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.
> That is how it works on the CBMs.

Ok, I moved some initialization parts from crt0.s to constructors.
Namely the initialization of stdin/stdout/stderr and the retrievement of
the default (floppy) device.

Old memory usage (copied from my previous mail):

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


-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


-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

New memory consumption (current svn):

default configuration:

-rw-r-----  1 chris  wheel   291 19 Nov 23:09
-rw-r-----  1 chris  wheel  3150 19 Nov 23:09
-rw-r-----  1 chris  wheel  2054 19 Nov 23:09


-rw-r-----  1 chris  wheel   291 19 Nov 23:08
-rw-r-----  1 chris  wheel  3150 19 Nov 23:08
-rw-r-----  1 chris  wheel  1927 19 Nov 23:07


-rw-r-----  1 chris  wheel   291 19 Nov 23:06
-rw-r-----  1 chris  wheel  3150 19 Nov 23:06
-rw-r-----  1 chris  wheel  1504 19 Nov 23:06

I did some sanity checks for these changes, but if I broke something
please tell me...

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Nov 20 00:00:15 2009

This archive was generated by hypermail 2.1.8 : 2009-11-20 00:00:18 CET