Re: [cc65] Relocating the stack?

From: Payton Byrd <>
Date: 2010-08-02 08:34:11
On Mon, Aug 2, 2010 at 1:27 AM, Ullrich von Bassewitz <>wrote:

> Good morning!
> On Sun, Aug 01, 2010 at 08:01:39PM -0500, Payton Byrd wrote:
> > I'm trying to squeeze some more memory out of the 32k expanded VIC-20.
>  The
> > memory config provided in the cc65 distribution leaves 8k of RAM
> unmolested
> > at $A000 to $BFFF.  I would like to relocate the STACK and HEAP to this
> > memory so I can place more code in banks 1, 2, and 3.  After reading the
> > ld65 docs I don't understand how I could accomplish this.  Can anyone
> help
> > with this task?
> Shawn is right here, the simplest way to relocate the stack is to supply a
> changed startup module. Just have a look at the one that is part of the
> source
> distribution. It should be easy to locate the place where the stack is
> initialized.
> To relocate the heap, you can either include <_heap.h> and set the
> variables
> _heaporg and _heapptr to the start of the heap memory and _heapend to the
> end
> (you will have to do this *before* accessing the heap). You can also supply
> a
> changed _heap module (see the one from the library, it's pretty short).
> The existing heap module will intialize the end of the heap to the start of
> the
> stack. Depending on where the new stack location is, this may or may not
> make
> sense.

I didn't know about the _heap.h trick.  I'll give that a shot first and see
if that frees up enough RAM for me.

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Aug 2 08:34:42 2010

This archive was generated by hypermail 2.1.8 : 2010-08-02 08:34:44 CEST