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

From: Daniel Serpell <>
Date: 2009-11-26 03:50:24

On Wed, Nov 25, 2009 at 4:47 PM, Christian GrŲssler <> wrote:
> The ucase_fn code in fact does two things:
> † † † †a) uppercasing the string
> † † † †b) preprending a device string (like "D1:"), dependent on the
> † † † † † current "default" drive
> This happened historically somehow and I hope I can split these tasks
> when I rework the code.
> Removing b) is IMO problematic. Consider the TGI driver names. They
> don't have a device descriptor preceeding. We could use e.g. "D1:",
> but this would force the drivers always to be loaded from disk 1.
> Typically, the drivers probably are on the same disk as the program.

I agree, but found a bug with current implementation, and have some
ideas to improve it.

Currently, the only part of _defdev that is used is the number after the
letter, this does not work if the current device is not a disk drive, for
example, using the atari800 emulator with th "H:" device, BWDOS
allows you to change the current drive to "H1:", and directly execute
programs there. But the default drive is set to "D1:" regardless.

I tough an idea to get smaller code and also fix the ucase_fn routine,
joust reserve the space for _defdev in the BSS as 128 bytes, then
you can use it as the temporal buffer to hold the uppercased filename
always, no need to allocate in the stack.

The first patch attached allocates __defdev in bss segment. The second
patch, applied after the first, allocates the extra buffer after __defdev and
directly copies the uppercased filename to that buffer.

> This said, it seems that only SpartaDOS, OS/A, and MyDOS provide the
> notion of a "default drive". At least, only these are recognized by
> the runtime lib. The other DOSes will use the DEFAULT_DEVICE as set
> in the runtime lib Makefile.

Also BW-DOS, that is compatible with SpartaDOS. I prefer BW-DOS
because is smaller and works great with the H: device of atari800 emulator.

> To wrap it up, I'll split tasks a) and b) into separate defines, and
> let the community (you :-)) decide which ones should be enabled by
> default.

I think that if the size is small the defines could simply be removed.


To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Nov 26 03:50:31 2009

This archive was generated by hypermail 2.1.8 : 2009-11-26 03:50:32 CET