Re: [cc65] some patches

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-03-15 23:32:47
On Mon, Mar 15, 2010 at 10:51:30PM +0100, Kajtár Zsolt wrote:
> > That's true. But the real problem is the amount of custom hardware that is in
> > use. It is impossible to support everybodys pet hardware in the standard cc65
> > libraries. I cannot produce a separate library for each combination of
> > patches. A library for the C64 without IDE64 routines for smaller size,
>
> Ok, of course it does not have to be compiled in by default. I was thinking
> about something like this:
>
> #define __USE_IDE64
>
> At the beginning of a the user's program would redefine a few routine calls to
> alternative versions in the library header files (stdio.h, unistd.h) for
> read/write and possibly seek.

That doesn't work.

If you use printf, write() is called internally. printf calls fprintf which
calls vfprintf, which calls write. In this call chain, the address of write is
part of the precompiled library and a simple #define in the user code won't
change the contents of the library you're linking to your application.

> What is the reason for the final RESTOR? Interrupts are restored already,
> anything else?

The call to RESTOR is probably a relict from older versions that didn't have
destructors.  Some parts of the library set their own vectors (the debugger
for example takes over the BREAK vector). RESTOR is called so that even in
case of a program abort, the machine is not left in an unstable state. I
haven't checked the code, it may be possible to add destructors if they're not
already present and remove the call.

> > So we will have to live with the fact that the cc65 do only cover the most
> > common case. If it is cheap, they can also cover a few less common ones, too.
>
> There would be no cost if it's not selected.

How are you going to "select" it? As said above, using #defines won't work.
The only thing that works is a separate library, but ...

> I'm not sure if this is a good idea, at least I would not do it.

... that doesn't seem to get your approval :-)

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Mar 15 23:32:52 2010

This archive was generated by hypermail 2.1.8 : 2010-03-15 23:32:54 CET