[cc65] ca65 resolving exported symbols from another project?

From: <rhurst1bidmc.harvard.edu>
Date: 2015-02-15 15:51:41
Hi,

I have a ca65 project that creates a specialty ROM cartridge that is targeted to allow for an application programmer to SYS or JSR to embedded JMP points in it.  For example, the cartridge source might have a module like:

.segment "CART"
.global FOOINIT, FOOANIM, FOOMOVE, FOOQUIT

FOOINIT:  jmp foo::init
FOOANIM:  jmp foo::anim
FOOMOVE:  jmp foo::move
FOOQUIT: jmp foo::quit

.proc "foo"
init:  <code>
anim: <code>
move: <code>
quit: <code>

Now, I want to create another ca65 project that makes an application program binary that uses JSR FOOINIT, etc.  It will link to the "global" addresses in the cartridge space made above.

Without resorting to updating an external symbol source file with the absolute addresses from the cartridge MAP file, I thought I might be able to use "type = bss" and include the cartridge object code in the linker process, i.e.,

MEMORY {
    PRG:  start = $11FE, size = $6E02, type = rw;       # -memory all
    ROM:  start = $A000, size = $2000, type = rw;       # resolve symbols
}

SEGMENTS {
    CODE: load = PRG, type = rw, define = yes, optional = yes;
    DATA: load = PRG, type = rw, define = yes, optional = yes;
    CART: load = ROM, type = bss, define = yes, optional = no;
}

FEATURES {
    STARTADDRESS: default = $11FE;                      # 2-byte load address
}

$ ld65 -C basic+24k.cfg -o test.prg test.o cart.o cart-foo.o
ld65: Warning: basic+24k.cfg(9): Segment with type `bss' contains initialized data

... the resulting test.prg is correctly resolved, but this configuration/process looks kind of ugly and hack.  Is there a proper (or better) way to do this?

This message is intended for the use of the person(s) to whom it may be addressed. It may contain information that is privileged, confidential, or otherwise protected from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution, copying, or use of this information is prohibited. If you have received this message in error, please permanently delete it and immediately notify the sender. Thank you.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Feb 15 16:58:04 2015

This archive was generated by hypermail 2.1.8 : 2015-02-15 16:58:06 CET