Re: [cc65] Multi-purpose memory layout, ca65, ld65

From: Gábor Lénárt <>
Date: 2011-01-12 21:52:05

On Wed, Jan 12, 2011 at 09:37:54PM +0100, Ullrich von Bassewitz wrote:
> > :) However, my problem that it's a bit uncomfortable to generate the proper
> > linker config file this way, if it's not only an example (or maybe only I am
> > the one who can't understand it too much).  Let me explain the situation a
> > bit.  I have a program which can be loaded&run on C64, with the usual 'basic
> > stub' solution.  So I have got segment called BASICSTUB as the first item
> > inside SEGMENTS.  It's a must, since it must be at the beginning.  But since
> > I don't know the exact size of that segment as a constant value, it's hard
> > to use numbers for "start" inside MEMORY, and I guess I can't use it in a
> > tricky way that I put __SEGXYZ_[SIZE|LOAD|RUN]__ and similar things after
> > "start =" in part "MEMORY" of the linker config file. 
> The development version can do exactly that.

Really? Wow. I will take a look, since (currently) my work is not an open source
project, I am free whatever I want to use (well it can be the same with open
source too, but it can made other people's life harder), so I can use
development version of assembler/linker too :) What do you think, is there
any problem if I use development version? I mean, is it stable enough, and
so on, or is it not recommended to use by others for purposes other than
hacking the assembler/linker/compiler themselves only?

[Btw, it just came into my mind, that at once I told - maybe on this list -
that I want Z80 support into ca65, I am still dreaming on it to do that maybe
with some tons of macros, hehe ...]

> What I would do: Place BASICSTUB, CODE, DATA whatever in one memory area. Lets
> assume this one is called M1. Create another memory area M2 that starts at the
> end of M1. If you use the development version, you can use the defined symbols
> for M1 for this purpose. Place BSS into this memory area. Create a third
> memory area M3 that does also start at the end of M2. Place your graphics data
> into M3. All three memory areas go into the same output file. Since M2 doesn't
> really occupy any space (because it does only contain BSS data), the layout of
> the final output file is exactly as you want it. Be sure to check the startup
> code. You have to move the graphics data to it's proper place before accessing
> any data in the BSS segment, otherwise it gets corrupted.

Ok, it's more or less clear for me already, my problem was the lack of
knowledge about the starting address of those "overlaping" areas. But with
your info (that devel version can do it) everything seems to be clear for me
now. Thanks for the information!


- Gábor
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jan 12 21:52:15 2011

This archive was generated by hypermail 2.1.8 : 2011-01-12 21:52:18 CET