[cc65] Re: non-contiguous code

From: Egan Ford <egan1sense.net>
Date: 2012-05-12 18:29:47
NM, I think I figured it out.  However if you have better suggestions
I'd still be interested.

The difference is the CODE1 I added to the cfg file.  Then I added
about 2/3rds down my C program:

#pragma codeseg ("CODE1")

and to my small assembly routines:

 .segment "CODE1"

My new cfg file:

MEMORY {
ZP:     start = $0020, size = $00C0, define = yes;
HEADER: start = $0000, size = $0004, file = %O;
RAM1:    start = $0280, size = $0D80, file = "code.1";
RAM2:    start = $E000, size = $1000, file = "code.2";
}
SEGMENTS {
EXEHDR:   load = HEADER, type = ro;
STARTUP:  load = RAM1,    type = ro, define = yes;
LOWCODE:  load = RAM1,    type = ro,               optional = yes;
INIT:     load = RAM1,    type = ro, define = yes, optional = yes;
CODE1:    load = RAM1,    type = ro;
CODE:     load = RAM2,    type = ro;
RODATA:   load = RAM1,    type = ro;
DATA:     load = RAM1,    type = rw;
BSS:      load = RAM1,    type = bss, define = yes;
HEAP:     load = RAM1,    type = bss, optional = yes;
ZEROPAGE: load = ZP,     type = 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: type = interruptor,
segment = RODATA,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__;
}
SYMBOLS {
__STACKSIZE__ = $800;
}


On Sat, May 12, 2012 at 9:46 AM, Egan Ford <egan@sense.net> wrote:
> Hello all,
>
> I am trying to recompile code that I originally wrote for a 12k or 20k
> Apple-1.  Apple-1s were most commonly 8k with the first 4k assigned to
> $0 and the second assigned to $E000.  The later was used to load BASIC
> from tape.  As RAM prices dropped it was possible to replace the lower
> RAM with 8k or 16k.  Most emulators and replicas support more than 4k
> at $0.  However I would still like to get my code to run on the 4+4
> configuration.
>
> My code segment is 4k + ~600 bytes.  Here is my config file:
>
> MEMORY {
> ZP:     start = $0020, size = $00C0, define = yes;
> HEADER: start = $0000, size = $0004, file = %O;
> RAM1:    start = $0280, size = $0D80, file = %O;
> RAM2:    start = $E000, size = $1000, file = %O;
> }
> SEGMENTS {
> EXEHDR:   load = HEADER, type = ro;
> STARTUP:  load = RAM1,    type = ro, define = yes;
> LOWCODE:  load = RAM1,    type = ro,               optional = yes;
> INIT:     load = RAM1,    type = ro, define = yes, optional = yes;
> CODE:     load = RAM2,    type = ro;
> RODATA:   load = RAM1,    type = ro;
> DATA:     load = RAM1,    type = rw;
> BSS:      load = RAM1,    type = bss, define = yes;
> HEAP:     load = RAM1,    type = bss, optional = yes;
> ZEROPAGE: load = ZP,     type = 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: type = interruptor,
> segment = RODATA,
> label = __INTERRUPTOR_TABLE__,
> count = __INTERRUPTOR_COUNT__;
> }
> SYMBOLS {
> __STACKSIZE__ = $800;
> }
>
> Clearly my code is not going to fit into RAM2.
>
> Suggestions?
>
> Thanks.
>
> BTW, I am still using 2.13.2, I have not had time to check the Apple1
> patches with the latest release.  Thanks again.
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat May 12 18:30:40 2012

This archive was generated by hypermail 2.1.8 : 2012-05-12 18:30:43 CEST