Re: [cc65] Permanent & Temporary Reservation of Memory

From: Ullrich von Bassewitz <>
Date: 2012-09-09 13:59:24
On Sat, Sep 08, 2012 at 06:23:35PM -0400, Michael Bazzinotti wrote:
> Automatically Temporarily Reserving portions of memory
> This would be useful for sections of code / source files, that use a
> chunk of memory, but are no longer needed after the whole section is
> finished executing.
> When I say temporary reservation, I suppose I mean temporary symbol
> dubbing, as I am using .RES currently as a way to automatically
> provide addresses for my ram symbols. But I want smarts so that i can
> also release some of the addresses these symbols relate to, so they
> can be reused later on!
> But is there a way to automatically name/reserve portions of memory
> and release these names so that further allocations will reuse these
> released addresses????

What you are talking about requires management at runtime and is therefore out
of scope for an assembler. The assembler cannot know at which point of
execution memory is no longer used.

If you want to build that knowledge into your source, you can reassign symbols
as you like:

heap:   .res    $400

.proc   foo
foovar1 := heap + 0
foovar2 := heap + 2

.proc   bar
barvar1 := heap + 0
barvar2 := heap + 2

Please note that in the given case it is in your responsibility to make sure
there are no duplicate uses and that the given buffer is large enough. For the
latter, some sort of .assert may help.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Sep 9 14:00:10 2012

This archive was generated by hypermail 2.1.8 : 2012-09-09 14:00:14 CEST