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

From: Ullrich von Bassewitz <>
Date: 2011-01-12 21:37:54

On Wed, Jan 12, 2011 at 04:10:07PM +0100, Gábor Lénárt wrote:
> Yes, kiitos [ok my basic level Finnish knowledge is off-topic here I guess]
> :) 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.

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.

I'm currently not able to test the setup, so please account for any errors in
above description. But I'm pretty sure it will work as described.



Ullrich von Bassewitz                        
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:38:01 2011

This archive was generated by hypermail 2.1.8 : 2011-01-12 21:38:04 CET