Re: [cc65] Customization of cc65 for new targets

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-02-14 23:42:05
Hi!

On Sun, Feb 14, 2010 at 10:05:54PM +0100, Oliver Schmidt wrote:
> I'm not sure what type of comments you're actually looking for,
> however here's some nitpicking:

Maybe I should explain, how it came to this text:

I get a handful of requests a year from people planing to port cc65 to new
systems and asking for more information. There is currently no document that
describes how to do a port. Bruce offered to write such a document using his
target as an example. It was my request to have the text be as generic as
possible, so it is useful for a larger audience.

> These three lines initialize the external (global) and system
> variables. It should be noted that for very simple embedded systems,
> these lines could be deleted and the program would still function
> correctly; however, the user must be extremely careful since none of
> the variables will be initialized (all variables – local and global –
> must be set to a value prior to use) and the heap will not be usable
> (no calls to malloc () can occur).

I don't know if a note like this is really a good idea, because not having
variables initialized with zero violates an important part of the C standard.

Regarding the initlib/donelib stuff: The original document written by Bruce
didn't have these calls. It was my suggestion to add them, because they're
necessary for anything more complex and I thought it would be a good idea to
have the document cover more than just a specific case to be as useful as
possible.

> ...isn't that great because the author obviously hasn't asserted that
> no part of the supervision.lib he uses is actually relying on these
> three lines.

Even if he had, that could easily change with a new release.

> On the other hand I'd have expected a section saying that a 'JSR
> donelib' right before a 'BRK' could most likely be deleted, but there
> wasn't.

Yes, maybe. But as it is documented now, it covers the general case and that's
good for the reasons named above. Having calls to zerobss and initlib/donelib
is always correct and does always work. Leaving them off, may work for a
specific system and for a specific version of the library.

> On the other hand I'd have expected a section saying that a 'JSR
> donelib' right before a 'BRK' could most likely be deleted, but there
> wasn't.

Yes, I've thought about that myself. But the line does no harm, and since you
don't know, what a constructor may alter, it's a good idea to have it in
there.

Someone fighting with memory problems may think about that different, but as a
guide for porting cc65 it's much better to show the correct way that does
always work.

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 Sun Feb 14 23:42:11 2010

This archive was generated by hypermail 2.1.8 : 2010-02-14 23:42:13 CET