[cc65] Romable configuration / run-time library?

From: Darryl Sokoloski <darryl1sokoloski.ca>
Date: 2013-01-18 18:22:39
Greetings!

Thanks for everyone's hard work!  This is an amazing tool-chain and
worked for me right "out of the box"!  I do have one question however,
and I hope this is the right place to ask.

I recently acquired a fully functional CBM 8032 PET and thought it
would be fun to replace some the ROM data with my own program code.
It comes with basic4 and my plan was replace ROMs UD 8, 9, 10 (0xB000
- 0xDFFF) with my own.  I've built a device that attaches to the
IEEE-488 interface and is essentially a parallel to serial Bluetooth
pipe.  I will use the PET to output text from my home network (email
subject lines, jabber chat, etc...)

I'm now writing the ROM and noticed that something seems wrong with my
CC65 (LD65) configuration perhaps.  I can not use all functions in
conio.h.  Specifically, functions like cprintf.  When I call cprintf
for example, execution jumps to some crazy address(es) eventually
hitting a JAM or looping indefinitely.

I think that perhaps I have not set-up my LD65 configuration properly
and was wondering if any one in the community would be able to have a
quick peek at this:

# Test LD configuration for CBM 8032
# Attempting to replace basic4 with my own romable code...

SYMBOLS {
    # 2K stack
    __STACKSIZE__: type = weak, value = $0800;
}

MEMORY {
    # First 256-bytes is zeropage
    ZP:         file = "", start = $0000, size = $0100, define = yes;
    RAMDATA:    file = "", start = $0100, size = $0200;
    RAM:        file = "", start = $0300,
                size = $8000 - __STACKSIZE__ - 100;
    # All ROM up to $D3B6 entry point
    ROM:        file = %O, start = $B000, size = $23B6, fill = yes;
    # Entry point from kernal, call start-up code
    STARTUP:    file = %O, start = $D3B6, size = $0C4A, fill = yes;
}

SEGMENTS {
    STARTUP:    type = ro,  load = STARTUP;
    LOWCODE:    type = ro,  load = ROM, optional = yes;
    INIT:       type = ro,  load = ROM, optional = yes, define = yes;
    CODE:       type = ro,  load = ROM;
    RODATA:     type = ro,  load = ROM;
    DATA:       type = rw,  load = ROM, run = RAMDATA, define = yes;
    ZPSAVE:     type = bss, load = RAM;
    BSS:        type = bss, load = RAM, define = yes;
    ZEROPAGE:   type = zp,  load = ZP;
}

FEATURES {
    CONDES: segment = INIT,
        type    = constructor,
        label   = __CONSTRUCTOR_TABLE__,
        count   = __CONSTRUCTOR_COUNT__;
    CONDES: segment = RODATA,
        type    = destructor,
        label   = __DESTRUCTOR_TABLE__,
        count   = __DESTRUCTOR_COUNT__;
    CONDES: segment = RODATA,
        type    = interruptor,
        label   = __INTERRUPTOR_TABLE__,
        count   = __INTERRUPTOR_COUNT__,
            import  = __CALLIRQ__;
}

# vi: expandtab shiftwidth=4 softtabstop=4 tabstop=4
Cheers,

Darryl
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Jan 18 18:22:49 2013

This archive was generated by hypermail 2.1.8 : 2013-01-18 18:22:53 CET