Re: [cc65] Loadable overlays

From: Ullrich von Bassewitz <>
Date: 2006-07-27 09:33:46

On Tue, Jul 25, 2006 at 12:59:54PM -0400, Payton Byrd wrote:
> One of the things we've talked about is loading modules in at run time.
> These modules could be written in either CC65, CA65 or our interpreted BASIC.
> I would love specific information on how CC65 sets up the 128 memory map and
> how we can load modules to specific locations.  Also, is it possible to link a
> CC65 object file that was compiled from C so that it always loads at a
> specific spot on a specific bank and doesn't get linked with the CC65 runtime?

From internal.txt:

C128:   The startup code will reprogram the MMU, so that only the kernal ROM
        is enabled. This means, there are 41K of memory available to the

The layout as far as I remember is $2000 (BASIC Start) up to the char ROM and
I/O area.

o65 modules can be loaded to arbitrary addresses. The loader supplied with
cc65 uses memory from the heap, but this can easily change to use other
portions of the available system memory. However, load time linking is not
supported by ld65 per se, so will have to either write o65 modules in
assembler (without using the cc65 runtime), or use the same trick as Contiki
does (link in a symbol tables with the absolute addresses of the runtime
routines in the main program). The latter means that loadable modules do only
run with exactly one version of the main program.

Linking programs for specific addresses is easily possible, but linking
"without the runtime" is not, because this would in most cases leave
unsatisfied external references. There may be solutions, but this depends on
your problem.

I hope this information is at least helpful for a start. If you ask more
detailed questions, I may be able to supply more detailed information.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu, 27 Jul 2006 09:33:46 +0200

This archive was generated by hypermail 2.1.8 : 2006-07-27 09:33:58 CEST