[cc65] mirror code in linker scripts

From: Sven Oliver Moll <cc651svol.li>
Date: 2013-05-01 19:06:12
Hello,

I'm using ca65 to write code for the Atari 2600 VCS. Now I ran in trouble
defining a linker script that enables me to use bankswitching. For this, I
require to have the same code at the exact same position in different banks.

Here's the linker script I'm using so far for this case:

MEMORY {
    ROM0:      start = $7000, size=$0FF8, type = ro, define = yes, file = %O, fill = yes;
    HOTSPOTS0: start = $FFF8, size=$04,   type = ro, define = yes, file = %O, fill = yes;
    VECTORS0:  start = $FFFC, size=$04,   type = ro, define = yes, file = %O, fill = yes;
    ROM1:      start = $F000, size=$0FF8, type = ro, define = yes, file = %O, fill = yes;
    HOTSPOTS1: start = $FFF8, size=$04,   type = ro, define = yes, file = %O, fill = yes;
    VECTORS1:  start = $FFFC, size=$04,   type = ro, define = yes, file = %O, fill = yes;
    TIA:       start = $00,   size=$40,   type = rw, define = yes;
    RAM:       start = $80,   size=$80,   type = rw, define = yes;
    RIOT:      start = $280,  size=$20,   type = rw, define = yes;
}

SEGMENTS {
    CODE0:     load=ROM0, type=ro, define = yes;
    CODE1:     load=ROM1, type=ro, define = yes;
    RODATA0:   load=ROM0, type=ro, align = $100, optional = yes;
    RODATA1:   load=ROM1, type=ro, align = $100, optional = yes;
    HOTSPOTS0: load=HOTSPOTS0, type=ro;
    HOTSPOTS1: load=HOTSPOTS1, type=ro;
    VECTORS0:  load=VECTORS0, type=ro;
    VECTORS1:  load=VECTORS1, type=ro;
    ZEROPAGE:  load=RAM,  type=zp;
    TIA:       load=TIA,  type=rw, define = yes, optional = yes;
    RIOT:      load=RIOT, type=rw, define = yes, optional = yes;
}

It works, but has some redundancy in it this will make things very 
complicated when going for 4 or 8 banks. Let me use "VECTORS0" and 
"VECTORS1" as an example of my problems. These contain the reset and irq 
vectors and should be the same on every bank. Right now I need to specify 
the same vectors for every bank, but I just want to load them from the same 
segment "VECTORS" to every bank. Any way I tried, somewhere on the road it
got a "defined twice"-error.


And I've got another problem, this time concerning the RAM segment. I need 
two different RAM segments: one that can be shared amount all source code, 
as it is now, but I also need a second one for temporary data, that will be 
reset when the source file changes. Any ideas on how to accompish that?


Thanks in advance,
SvOlli
-- 
|  _______       |
| (  /\          | "Kermit, I thought you were the only person in this show
|__)v\/lli a.k.a.| who wasn't crazy." - "Me not crazy? I hired the others."
|Sven Oliver Moll|   -- Leslie Ann Warren & Kermit The Frog, "The Muppet Show"
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed May 1 19:47:08 2013

This archive was generated by hypermail 2.1.8 : 2013-06-15 17:37:38 CEST