Re: [cc65] Relocating the stack?

From: Ullrich von Bassewitz <>
Date: 2010-08-02 08:27:46
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

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



Ullrich von Bassewitz                        
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:27:51 2010

This archive was generated by hypermail 2.1.8 : 2010-08-02 08:27:55 CEST