Re: [cc65] Temporary zero-page allocation

From: doynax <>
Date: 2013-10-27 22:21:38
> Sorry, then I got that wrong. But in assembly, it's even more difficult,
> because it's almost impossible to generate call graphs. How could the
> assembler know where a function starts and ends? There are tricks like
> "pla;
> pla; rts" to drop a return address and jump back to the caller of the
> calling
> function. Or think about functions that are called using vector tables with
> high and low byte split. Or several entry and exit points within some
> block of
> code.

It would be virtually impossible to do it automatically, admittedly.

The problem is that I'm currently doing it manually and the result is an
utter, and exceedingly error-prone, mess. Hence I'm looking for clever
linker and/or macro hacks to help out with the simple cases and/or in
detecting collisions. Any kind of system has to be better than none at all.

I vaguely described a couple of ideas in my original post but at a guess
some form of compile-time stack based on the maximum (recursive) depth of a
manually specified callees would seems like the most realistic solution.
Sprinkled with liberal assertions.

Can I get the linker to evaluate max() at link-time?

> It's difficult for me to judge how difficult that is for you:-) Changing
> code
> generation or adding pattern replacements to the optimizer is definitely
> nothing you can do in an afternoon without ever having looked at the code
> before. Provided that you aren't an absolute coding genius of course.

That's  would be a no then. I suppose I'll save that particular project for
a rainy day (or month..)


To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Oct 27 22:21:50 2013

This archive was generated by hypermail 2.1.8 : 2013-10-27 22:21:52 CET