The way we want to use the INITBSS segment - and especially the fact that it won't have the type bss on all ROM based targets - means that the name INITBSS is misleading. After all INIT is the best name from my perspective as it serves several purposes and therefore needs a rather generic name.
Unfortunately this means that the current INIT segment needs to be renamed too. Looking for a short (ideally 4 letter) name I came up with ONCE as it contains all code (and data) accessed only once during initialization.
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
- __LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
+ __LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
}
MEMORY {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, define = yes;
+ INIT: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
- INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
- __LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
+ __LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
}
MEMORY {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, define = yes;
+ INIT: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
- INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
- __LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
+ __LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
}
MEMORY {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, define = yes;
+ INIT: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
- INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
- __LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
+ __LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
}
MEMORY {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, define = yes;
+ INIT: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
- INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
- __LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
+ __LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
}
MEMORY {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, define = yes;
+ INIT: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
- INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
- __LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
+ __LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
}
MEMORY {
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, define = yes;
+ INIT: load = RAM, type = bss, define = yes;
BSS: load = RAM, type = bss, define = yes;
- INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
CARTID: file = %O, start = $BFFA, size = $0006;
}
SEGMENTS {
- STARTUP: load = ROM, type = ro, define = yes, optional = yes;
- LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
- INIT: load = ROM, type = ro, optional = yes;
- CODE: load = ROM, type = ro, define = yes;
- RODATA: load = ROM, type = ro, optional = yes;
- DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes;
- INITBSS: load = RAM, type = bss, optional = yes;
- BSS: load = RAM, type = bss, define = yes, optional = yes;
- CARTHDR: load = CARTID, type = ro;
- ZEROPAGE: load = ZP, type = zp, optional = yes;
- EXTZP: load = ZP, type = zp, optional = yes;
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ EXTZP: load = ZP, type = zp, optional = yes;
+ STARTUP: load = ROM, type = ro, define = yes, optional = yes;
+ LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
+ ONCE: load = ROM, type = ro, optional = yes;
+ CODE: load = ROM, type = ro, define = yes;
+ RODATA: load = ROM, type = ro, optional = yes;
+ DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
+ BSS: load = RAM, type = bss, define = yes, optional = yes;
+ CARTHDR: load = CARTID, type = ro;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
}
SEGMENTS {
- CASHDR: load = RAM, type = ro;
- STARTUP: load = RAM, type = ro, define = yes, optional = yes;
- LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, optional = yes;
- CODE: load = RAM, type = ro, define = yes;
- RODATA: load = RAM, type = ro, optional = yes;
- DATA: load = RAM, type = rw, optional = yes;
- INITBSS: load = RAM, type = bss, optional = yes;
- BSS: load = RAM, type = bss, define = yes, optional = yes;
- ZEROPAGE: load = ZP, type = zp, optional = yes;
- EXTZP: load = ZP, type = zp, optional = yes;
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ EXTZP: load = ZP, type = zp, optional = yes;
+ CASHDR: load = RAM, type = ro;
+ STARTUP: load = RAM, type = ro, define = yes, optional = yes;
+ LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
+ CODE: load = RAM, type = ro, define = yes;
+ RODATA: load = RAM, type = ro, optional = yes;
+ DATA: load = RAM, type = rw, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
+ BSS: load = RAM, type = bss, define = yes, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes;
MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
TRAILER: file = %O, start = $0000, size = $0006;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes;
MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
CARTENTRY: file = %O, start = $BFFE, size = $0002;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, optional = yes;
+ EXTZP: load = ZP, type = zp, optional = yes;
STARTUP: load = ROM, type = ro, define = yes, optional = yes;
LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
- INIT: load = ROM, type = ro, optional = yes;
+ ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro, define = yes;
RODATA: load = ROM, type = ro, optional = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes;
CARTNAME: load = CARTNAME, type = ro, define = yes;
CARTYEAR: load = CARTYEAR, type = ro, define = yes;
CARTENTRY: load = CARTENTRY, type = ro, define = yes;
- ZEROPAGE: load = ZP, type = zp, optional = yes;
- EXTZP: load = ZP, type = zp, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+
EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+
EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+
EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss, optional = yes;
+ INIT: load = RAM, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
LOWCODE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
DATA: load = RAM, type = rw;
ZPSAVE1: load = RAM, type = rw, define = yes; # ZPSAVE1, ZPSAVE2 must be together
ZPSAVE2: load = RAM, type = bss; # see "libsrc/atmos/crt0.s"
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, start = $0E00, size = $7200 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
OVL9: file = "%O.9", start = $C000 - __OVERLAYSIZE__, size = __OVERLAYSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
OVL1ADDR: load = OVL1ADDR, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVL2ADDR: load = OVL2ADDR, type = ro;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = $1C0D, size = $A3F3 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, start = $100D, size = $6FF3 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INITBSS: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes;
- INIT: load = INIT, type = ro;
+ ONCE: load = INIT, type = ro;
OVL1ADDR: load = OVL1ADDR, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVL2ADDR: load = OVL2ADDR, type = ro;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
- INITBSS: load = MAIN, type = rw;
+ INIT: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes;
- INIT: load = INIT, type = ro, define = yes;
+ ONCE: load = INIT, type = ro, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
PAGE2: load = PAGE2, type = rw;
PAGE3: load = PAGE3, type = rw;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = rw, define = yes;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
PAGE2: load = PAGE2, type = rw;
PAGE3: load = PAGE3, type = rw;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = rw, define = yes;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
# linker config to produce simple Gamate cartridge (.bin)
SYMBOLS {
- __STARTUP__: type = import;
- __STACKSIZE__: type = weak, value = $0080; # 1 page stack
+ __STARTUP__: type = import;
+ __STACKSIZE__: type = weak, value = $0080; # 1 page stack
}
MEMORY {
- # 0000-03ff is RAM
- # FIXME: what zp range can we actually use?
- # $0a-$11 is used by IRQ/NMI, $e8 is used by NMI
- ZP: start = $0012, size = $e8 - $12;
- CPUSTACK: start = $0100, size =$100;
- RAM: start = $0200, size = $200 - __STACKSIZE__, define = yes;
+ # 0000-03ff is RAM
+ # FIXME: what zp range can we actually use?
+ # $0a-$11 is used by IRQ/NMI, $e8 is used by NMI
+ ZP: start = $0012, size = $e8 - $12;
+ CPUSTACK: start = $0100, size =$100;
+ RAM: start = $0200, size = $200 - __STACKSIZE__, define = yes;
- CARTHEADER: file = %O, define = yes, start = %S, size = $0029;
- # 6000-e000 can be (Cartridge) ROM
- # WARNING: fill value must be $00 else it will no more work
- #ROM: start = $6000, size = $1000, fill = yes, fillval = $00, file = %O, define = yes;
- #ROMFILL: start = $7000, size = $7000, fill = yes, fillval = $00, file = %O, define = yes;
- # for images that have code >$6fff we must calculate the checksum!
- ROM: start = $6000 + $29, size = $8000 - $29, fill = yes, fillval = $00, file = %O, define = yes;
+ CARTHEADER: file = %O, define = yes, start = %S, size = $0029;
+ # 6000-e000 can be (Cartridge) ROM
+ # WARNING: fill value must be $00 else it will no more work
+ #ROM: start = $6000, size = $1000, fill = yes, fillval = $00, file = %O, define = yes;
+ #ROMFILL: start = $7000, size = $7000, fill = yes, fillval = $00, file = %O, define = yes;
+ # for images that have code >$6fff we must calculate the checksum!
+ ROM: start = $6000 + $29, size = $8000 - $29, fill = yes, fillval = $00, file = %O, define = yes;
}
SEGMENTS {
- ZEROPAGE: load = ZP, type = zp, define = yes;
- EXTZP: load = ZP, type = zp, define = yes, optional = yes;
- APPZP: load = ZP, type = zp, define = yes, optional = yes;
- STARTUP: load = CARTHEADER, type = ro, define=yes;
- INIT: load = ROM, type = ro, define = yes, optional = yes;
- CODE: load = ROM, type = ro, define=yes;
- RODATA: load = ROM, type = ro, define=yes;
- DATA: load = ROM, run=RAM, type = rw, define = yes;
- BSS: load = RAM, type = bss, define = yes;
+ ZEROPAGE: load = ZP, type = zp, define = yes;
+ EXTZP: load = ZP, type = zp, define = yes, optional = yes;
+ APPZP: load = ZP, type = zp, define = yes, optional = yes;
+ STARTUP: load = CARTHEADER, type = ro, define = yes;
+ ONCE: load = ROM, type = ro, define = yes, optional = yes;
+ CODE: load = ROM, type = ro, define = yes;
+ RODATA: load = ROM, type = ro, define = yes;
+ DATA: load = ROM, run = RAM, type = rw, define = yes;
+ BSS: load = RAM, type = bss, define = yes;
}
FEATURES {
- CONDES: segment = RODATA, 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__;
+ CONDES: type = constructor,
+ label = __CONSTRUCTOR_TABLE__,
+ count = __CONSTRUCTOR_COUNT__,
+ segment = ONCE;
+ CONDES: type = destructor,
+ label = __DESTRUCTOR_TABLE__,
+ count = __DESTRUCTOR_COUNT__,
+ segment = RODATA;
+ CONDES: type = interruptor,
+ label = __INTERRUPTOR_TABLE__,
+ count = __INTERRUPTOR_COUNT__,
+ segment = RODATA,
+ import = __CALLIRQ__;
}
VLIRIDX0: type = ro, load = CVT, align = $200, optional = yes;
STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $200, define = yes;
LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes;
- INIT: type = ro, run = VLIR0, load = CVT, define = yes, optional = yes;
+ ONCE: type = ro, run = VLIR0, load = CVT, define = yes, optional = yes;
CODE: type = ro, run = VLIR0, load = CVT;
RODATA: type = ro, run = VLIR0, load = CVT;
DATA: type = rw, run = VLIR0, load = CVT;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RECORDS: type = ro, load = CVT, align = $FE, optional = yes;
STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $FE, define = yes;
LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes;
- INIT: type = ro, run = VLIR0, load = CVT, define = yes, optional = yes;
+ ONCE: type = ro, run = VLIR0, load = CVT, define = yes, optional = yes;
CODE: type = ro, run = VLIR0, load = CVT;
RODATA: type = ro, run = VLIR0, load = CVT;
DATA: type = rw, run = VLIR0, load = CVT;
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
ZEROPAGE: load = ZP, type = zp, define = yes; # Pseudo-registers
STARTUP: load = RAM, type = ro; # First initialization code
LOWCODE: load = RAM, type = ro, optional = yes; # Legacy from other platforms
- INIT: load = RAM, type = ro, define = yes, optional = yes; # Library initialization code
+ ONCE: load = RAM, type = ro, define = yes, optional = yes; # Library initialization code
CODE: load = RAM, type = ro; # Program
RODATA: load = RAM, type = ro; # Literals, constants
DATA: load = RAM, type = rw; # Initialized variables
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = $0400, size = $BC38 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+ APPZP: load = ZP, type = zp, optional = yes;
BLLHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
- APPZP: load = ZP, type = zp, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = $0200, size = $9E58 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+ APPZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
- APPZP: load = ZP, type = zp, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
UPLDR: file = %O, define = yes, start = $BFDC, size = $005C;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+ APPZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY:load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
UPCODE: load = UPLDR, type = ro, define = yes;
UPDATA: load = UPLDR, type = rw, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
- APPZP: load = ZP, type = zp, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = $0200, size = $BE38 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, optional = yes;
+ APPZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, optional = yes;
- APPZP: load = ZP, type = zp, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
HEADER: load = COMBINED, type = ro;
- INIT: load = COMBINED, type = ro, optional = yes;
+ ONCE: load = COMBINED, type = ro, optional = yes;
CODE: load = COMBINED, type = ro;
RODATA: load = COMBINED, type = ro;
DATA: load = COMBINED, type = rw;
RAM: file = "", start = $6000, size = $2000, define = yes;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
HEADER: load = HEADER, type = ro;
STARTUP: load = ROM0, type = ro, define = yes;
LOWCODE: load = ROM0, type = ro, optional = yes;
- INIT: load = ROM0, type = ro, define = yes, optional = yes;
+ ONCE: load = ROM0, type = ro, define = yes, optional = yes;
CODE: load = ROM0, type = ro, define = yes;
RODATA: load = ROM0, type = ro, define = yes;
DATA: load = ROM0, run = RAM, type = rw, define = yes;
VECTORS: load = ROMV, type = rw;
CHARS: load = ROM2, type = rw;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, start = %S, size = $10000 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = rw;
RODATA: load = RAM, type = rw;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
BOOT: load = HEAD, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = rw;
RODATA: load = RAM, type = rw;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
+ EXTZP: load = ZP, type = zp, define = yes, optional = yes;
BOOT: load = HEAD, type = ro, optional = yes;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = rw;
RODATA: load = RAM, type = rw;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
- EXTZP: load = ZP, type = zp, define = yes, optional = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
# linker config to produce simple NEC PC-Engine cartridge (.pce)
SYMBOLS {
- __STACKSIZE__: type = weak, value = $0300; # 3 pages stack
+ __STACKSIZE__: type = weak, value = $0300; # 3 pages stack
}
MEMORY {
- # FIXME: is this correct? the first 3? bytes cant be used?
- ZP: start = $03, size = $fd, type = rw, define = yes;
+ # FIXME: is this correct? the first 3? bytes cant be used?
+ ZP: file = "", start = $0003, size = $00FD, type = rw, define = yes;
- # reset-bank and hardware vectors
- ROM0: start = $e000, size = $1ff6, file = %O ,fill = yes, define = yes;
- ROMV: start = $fff6, size = $a, file = %O,fill = yes;
+ # reset-bank and hardware vectors
+ ROM0: file = %O, start = $E000, size = $1FF6, fill = yes, define = yes;
+ ROMV: file = %O, start = $FFF6, size = $000A, fill = yes;
- # first RAM page (also contains stack and zeropage)
- RAM: start = $2200, size = $1e00, define = yes;
+ # first RAM page (also contains stack and zeropage)
+ RAM: file = "", start = $2200, size = $1e00, define = yes;
}
SEGMENTS {
- STARTUP: load = ROM0, type = ro, define = yes;
- INIT: load = ROM0, type = ro, define = yes, optional = yes;
- CODE: load = ROM0, type = ro, define = yes;
- RODATA: load = ROM0, type = ro, define = yes;
- DATA: load = ROM0, run= RAM, type = rw, define = yes;
- BSS: load = RAM, type = bss, define = yes;
- VECTORS: load = ROMV, type = rw, define = yes;
- ZEROPAGE: load = ZP, type = zp, define = yes;
- EXTZP: load = ZP, type = zp, define = yes, optional = yes;
- APPZP: load = ZP, type = zp, define = yes, optional = yes;
+ ZEROPAGE: load = ZP, type = zp, define = yes;
+ EXTZP: load = ZP, type = zp, define = yes, optional = yes;
+ APPZP: load = ZP, type = zp, define = yes, optional = yes;
+ STARTUP: load = ROM0, type = ro, define = yes;
+ ONCE: load = ROM0, type = ro, define = yes, optional = yes;
+ CODE: load = ROM0, type = ro, define = yes;
+ RODATA: load = ROM0, type = ro, define = yes;
+ DATA: load = ROM0, run = RAM, type = rw, define = yes;
+ BSS: load = RAM, type = bss, define = yes;
+ VECTORS: load = ROMV, type = rw, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, start = $040D, size = $7BF3 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = $100D, size = $ECF3 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__STACKSIZE__: type = weak, value = $0800; # 2k stack
}
MEMORY {
- ZP: file = "", start = $0000, size = $001A;
- HEADER: file = %O, start = $0000, size = $0001;
- RAM: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
+ ZP: file = "", start = $0000, size = $001A;
+ HEADER: file = %O, start = $0000, size = $0001;
+ RAM: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
}
SEGMENTS {
- EXEHDR: load = HEADER, type = ro;
- STARTUP: load = RAM, type = ro;
- LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
- CODE: load = RAM, type = ro;
- RODATA: load = RAM, type = ro;
- DATA: load = RAM, type = rw;
- BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
+ ZEROPAGE: load = ZP, type = zp;
+ EXEHDR: load = HEADER, type = ro;
+ STARTUP: load = RAM, type = ro;
+ LOWCODE: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
+ CODE: load = RAM, type = ro;
+ RODATA: load = RAM, type = ro;
+ DATA: load = RAM, type = rw;
+ BSS: load = RAM, type = bss, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
__STACKSIZE__: type = weak, value = $0800; # 2k stack
}
MEMORY {
- ZP: file = "", start = $0000, size = $001A;
- HEADER: file = %O, start = $0000, size = $0001;
- RAM: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
+ ZP: file = "", start = $0000, size = $001A;
+ HEADER: file = %O, start = $0000, size = $0001;
+ RAM: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
}
SEGMENTS {
- EXEHDR: load = HEADER, type = ro;
- STARTUP: load = RAM, type = ro;
- LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
- CODE: load = RAM, type = ro;
- RODATA: load = RAM, type = ro;
- DATA: load = RAM, type = rw;
- BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
+ ZEROPAGE: load = ZP, type = zp;
+ EXEHDR: load = HEADER, type = ro;
+ STARTUP: load = RAM, type = ro;
+ LOWCODE: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
+ CODE: load = RAM, type = ro;
+ RODATA: load = RAM, type = ro;
+ DATA: load = RAM, type = rw;
+ BSS: load = RAM, type = bss, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
}
SEGMENTS {
LOWCODE: load = ROM, type = ro, optional = yes;
- INIT: load = ROM, type = ro, define = yes, optional = yes;
+ ONCE: load = ROM, type = ro, define = yes, optional = yes;
CODE: load = ROM, type = ro;
BANK1: load = BANKROM1, type = ro;
BANK2: load = BANKROM2, type = ro;
ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $ff, define=yes;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, define = yes;
LOWCODE: load = ROM, type = ro, optional = yes;
- INIT: load = ROM, type = ro, define = yes, optional = yes;
+ ONCE: load = ROM, type = ro, define = yes, optional = yes;
CODE: load = ROM, type = ro, define = yes;
RODATA: load = ROM, type = ro, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes;
FFF0: load = ROM, type = ro, offset = $3FF0;
VECTOR: load = ROM, type = ro, offset = $3FFA;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
}
SEGMENTS {
LOWCODE: load = ROM, type = ro, optional = yes;
- INIT: load = ROM, type = ro, define = yes, optional = yes;
+ ONCE: load = ROM, type = ro, define = yes, optional = yes;
CODE: load = ROM, type = ro;
RODATA: load = ROM, type = ro;
BANK1: load = BANKROM1, type = ro;
ROM: file = %O, start = $8000, size = $8000, fill = yes, fillval = $FF, define = yes;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp, define = yes;
LOWCODE: load = ROM, type = ro, optional = yes;
- INIT: load = ROM, type = ro, define = yes, optional = yes;
+ ONCE: load = ROM, type = ro, define = yes, optional = yes;
CODE: load = ROM, type = ro, define = yes;
RODATA: load = ROM, type = ro, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes;
FFF0: load = ROM, type = ro, offset = $7FF0;
VECTOR: load = ROM, type = ro, offset = $7FFA;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
RAM: file = %O, define = yes, start = $100D, size = $0DF3 - __STACKSIZE__;
}
SEGMENTS {
+ ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
- INIT: load = RAM, type = ro, define = yes, optional = yes;
+ ONCE: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
- INITBSS: load = RAM, type = bss;
+ INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes;
- ZEROPAGE: load = ZP, type = zp;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
- segment = INIT;
+ segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
<p>
The main problem is that the EXE header generated by the cc65 runtime
lib is wrong. It defines a single load chunk with the sizes/addresses
-of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in
+of the STARTUP, LOWCODE, ONCE, CODE, RODATA, and DATA segments, in
fact, the whole user program (we're disregarding the "system check"
load chunk here).
<p>
NEXEHDR: load = FSTHDR, type = ro; # first load chunk
STARTUP: load = RAMLO, type = ro, define = yes;
LOWCODE: load = RAMLO, type = ro, define = yes, optional = yes;
- INIT: load = RAMLO, type = ro, optional = yes;
+ ONCE: load = RAMLO, type = ro, optional = yes;
CODE: load = RAMLO, type = ro, define = yes;
CHKHDR: load = SECHDR, type = ro; # second load chunk
AUTOSTRT: load = RAM, type = ro; # defines program entry point
}
FEATURES {
- CONDES: segment = RODATA,
+ CONDES: segment = ONCE,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
<p>
The newly added NEXEHDR segment defines the correct chunk header for the
first intended load chunk. It
-puts the STARTUP, LOWCODE, INIT, and CODE segments, which are the
+puts the STARTUP, LOWCODE, ONCE, and CODE segments, which are the
segments containing only code, into load chunk #1 (RAMLO memory area).
<p>
The header for the second load chunk comes from the new CHKHDR
<sect2>Low data and high code example<p>
-Goal: Put RODATA and DATA into low memory and STARTUP, LOWCODE, INIT,
+Goal: Put RODATA and DATA into low memory and STARTUP, LOWCODE, ONCE,
CODE, BSS, ZPSAVE into high memory (split2.cfg):
<tscreen><verb>
CHKHDR: load = SECHDR, type = ro; # second load chunk
STARTUP: load = RAM, type = ro, define = yes;
- INIT: load = RAM, type = ro, optional = yes;
+ ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes;
BSS: load = RAM, type = bss, define = yes;
AUTOSTRT: load = RAM, type = ro; # defines program entry point
}
FEATURES {
- CONDES: segment = RODATA,
+ CONDES: segment = ONCE,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
<tscreen><code>
SEGMENTS {
- ZEROPAGE: load = ZP, type = zp, define = yes;
- DATA: load = ROM, type = rw, define = yes, run = RAM;
- BSS: load = RAM, type = bss, define = yes;
- HEAP: load = RAM, type = bss, optional = yes;
- STARTUP: load = ROM, type = ro;
- INIT: load = ROM, type = ro, optional = yes;
- CODE: load = ROM, type = ro;
- RODATA: load = ROM, type = ro;
- VECTORS: load = ROM, type = ro, start = $FFFA;
+ ZEROPAGE: load = ZP, type = zp, define = yes;
+ DATA: load = ROM, type = rw, define = yes, run = RAM;
+ BSS: load = RAM, type = bss, define = yes;
+ HEAP: load = RAM, type = bss, optional = yes;
+ STARTUP: load = ROM, type = ro;
+ ONCE: load = ROM, type = ro, optional = yes;
+ CODE: load = ROM, type = ro;
+ RODATA: load = ROM, type = ro;
+ VECTORS: load = ROM, type = ro, start = $FFFA;
}
</code></tscreen>
<p><tt> BSS: </tt>Uninitialized data stored in RAM (used for variable storage)
<p><tt> HEAP: </tt>Uninitialized C-level heap storage in RAM, optional
<p><tt> STARTUP: </tt>The program initialization code, stored in ROM
-<p><tt> INIT: </tt>The code needed to initialize the system, stored in ROM
+<p><tt> ONCE: </tt>The code run once to initialize the system, stored in ROM
<p><tt> CODE: </tt>The program code, stored in ROM
<p><tt> RODATA: </tt>Initialized data that cannot be modified by the program, stored in ROM
<p><tt> VECTORS: </tt>The interrupt vector table, stored in ROM at location $FFFA
the compiler and the libraries that come with it. If you replace the builtin
config files, you will need the following information.
-<sect1>INIT<p>
+<sect1>ONCE<p>
-The INIT segment is used for initialization code that may be reused once
+The ONCE segment is used for initialization code run only once before
execution reaches main() - provided that the program runs in RAM. You
-may for example add the INIT segment to the heap in really memory
+may for example add the ONCE segment to the heap in really memory
constrained systems.
<sect1>LOWCODE<p>
.include "apple2.inc"
- .segment "INIT"
+ .segment "ONCE"
.ifdef __APPLE2ENH__
initconio:
.import initlib, donelib
.import callmain
.import __LC_START__, __LC_LAST__ ; Linker generated
- .import __INIT_RUN__, __INIT_SIZE__ ; Linker generated
- .import __INITBSS_RUN__ ; Linker generated
+ .import __ONCE_RUN__, __ONCE_SIZE__ ; Linker generated
+ .import __INIT_RUN__ ; Linker generated
.include "zeropage.inc"
.include "apple2.inc"
bit $C081
; Set the source start address.
- lda #<(__INITBSS_RUN__ + __INIT_SIZE__)
- ldy #>(__INITBSS_RUN__ + __INIT_SIZE__)
+ lda #<(__INIT_RUN__ + __ONCE_SIZE__)
+ ldy #>(__INIT_RUN__ + __ONCE_SIZE__)
sta $9B
sty $9C
; Set the source last address.
- lda #<(__INITBSS_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
- ldy #>(__INITBSS_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
+ lda #<(__INIT_RUN__ + __ONCE_SIZE__ + __LC_LAST__ - __LC_START__)
+ ldy #>(__INIT_RUN__ + __ONCE_SIZE__ + __LC_LAST__ - __LC_START__)
sta $96
sty $97
jsr $D39A ; BLTU2
; Set the source start address.
- lda #<__INITBSS_RUN__
- ldy #>__INITBSS_RUN__
+ lda #<__INIT_RUN__
+ ldy #>__INIT_RUN__
sta $9B
sty $9C
; Set the source last address.
- lda #<(__INITBSS_RUN__ + __INIT_SIZE__)
- ldy #>(__INITBSS_RUN__ + __INIT_SIZE__)
+ lda #<(__INIT_RUN__ + __ONCE_SIZE__)
+ ldy #>(__INIT_RUN__ + __ONCE_SIZE__)
sta $96
sty $97
; Set the destination last address.
- lda #<(__INIT_RUN__ + __INIT_SIZE__)
- ldy #>(__INIT_RUN__ + __INIT_SIZE__)
+ lda #<(__ONCE_RUN__ + __ONCE_SIZE__)
+ ldy #>(__ONCE_RUN__ + __ONCE_SIZE__)
sta $94
sty $95
; Call into Applesoft Block Transfer Up -- which handles moving
- ; overlapping blocks upwards well -- to move the INIT segment.
+ ; overlapping blocks upwards well -- to move the ONCE segment.
jsr $D39A ; BLTU2
; Delegate all further processing, to keep the STARTUP segment small.
; We're done
jmp done
- .segment "INIT"
+ .segment "ONCE"
; Save the zero-page locations that we need.
init: ldx #zpspace-1
; Final jump when we're done
done: jmp DOSWARM ; Potentially patched at runtime
- .segment "INITBSS"
+ .segment "INIT"
zpsave: .res zpspace
; - Apple II ProDOS 8 TechNote #23, ProDOS 8 Changes and Minutia
; - ProDOS TechRefMan, chapter 5.2.4
- .segment "INIT"
+ .segment "ONCE"
initdostype:
lda $BF00
.include "errno.inc"
.include "../filedes.inc"
- .segment "INIT"
+ .segment "ONCE"
initiobuf:
; Convert end address highbyte to table index
; Identify machine according to:
; Apple II Miscellaneous TechNote #7, Apple II Family Identification
- .segment "INIT"
+ .segment "ONCE"
initostype:
sec
.include "apple2.inc"
- .segment "INIT"
+ .segment "ONCE"
initirq:
; Check for ProDOS
FNAM = $281
REM = $B2 ; BASIC token-code
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run.
- .segment "INIT"
+ .segment "ONCE"
initmainargs:
.include "mli.inc"
.include "filedes.inc"
- .segment "INIT"
+ .segment "ONCE"
raisefilelevel:
; Raise file level
.include "filedes.inc"
.include "apple2.inc"
- .segment "INIT"
+ .segment "ONCE"
initprompt:
; Set prompt <> ']' to let DOS 3.3 know that we're
_rebootafterexit := return
- .segment "INIT"
+ .segment "ONCE"
initreboot:
; Quit to PWRUP
.import start
.export _cas_init
-.segment "INIT"
+.segment "ONCE"
_cas_init:
.ifdef DEBUG
; ------------------------------------------------------------------------
; DOS type detection
-.segment "INIT"
+.segment "ONCE"
detect: lda DOS
cmp #'S' ; SpartaDOS
; --------------------------------------------------------------------------
; Get command line
-.segment "INIT"
+.segment "ONCE"
initmainargs:
lda #0
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda VVBLKD
; ------------------------------------------------------------------------
- .segment "INIT"
+ .segment "ONCE"
pm_init:
lda #0
BUFSZ = 128 ; bounce buffer size
BUFSZ_SIO = 256
-.segment "INIT"
+.segment "ONCE"
; Turn off ROMs, install system and interrupt wrappers, set new chargen pointer
.export screen_setup_20x24
- .segment "INIT"
+ .segment "ONCE"
screen_setup_20x24:
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda VVBLKD
;--------------------------------------------------------------------------
; Put this constructor into a segment that can be re-used by programs.
;
-.segment "INIT"
+.segment "ONCE"
; Turn the capitals lock off.
.endproc
; ------------------------------------------------------------------------
-; Switch the cursor off. Code goes into the INIT segment
+; Switch the cursor off. Code goes into the ONCE segment
; which may be reused after it is run.
-.segment "INIT"
+.segment "ONCE"
initcgetc:
lsr STATUS
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda IRQVec
;---------------------------------------------------------------------------
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
.proc initmainargs
;--------------------------------------------------------------------------
; initstdin: Reset the stdin console.
-.segment "INIT"
+.segment "ONCE"
initstdin:
ldx #<-1
.bss
keyvec: .res 2
-.segment "INIT"
+.segment "ONCE"
initcgetc:
; Save the old vector
; ------------------------------------------------------------------------
; Data
-.segment "INITBSS"
+.segment "INIT"
zpsave: .res zpspace
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda IRQVec
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
; --------------------------------------------------------------------------
; Initialize the mouse sprite.
-.segment "INIT"
+.segment "ONCE"
initmcb:
; Constructor that writes to the 1/10 sec register of the TOD to kick it
; into action. If this is not done, the clock hangs. We will read the register
; and write it again, ignoring a possible change in between.
-.segment "INIT"
+.segment "ONCE"
.proc initsystime
.constructor initkbd
.destructor donekbd
-.segment "INIT"
+.segment "ONCE"
.proc initkbd
; ------------------------------------------------------------------------
-.segment "INITBSS"
+.segment "INIT"
zpsave: .res zpspace
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda IRQVec
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
tsx
stx spsave ; Save the system stack ptr
-; Save space by putting some of the start-up code in the INIT segment,
+; Save space by putting some of the start-up code in the ONCE segment,
; which can be re-used by the BSS segment, the heap and the C stack.
jsr init
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
init:
; ------------------------------------------------------------------------
; Data
-.segment "INITBSS"
+.segment "INIT"
mmusave:.res 1
spsave: .res 1
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda IRQVec
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
; --------------------------------------------------------------------------
; Initialize the mouse sprite.
-.segment "INIT"
+.segment "ONCE"
initmcb:
.export soft80_charset
- .segment "INIT"
+ .segment "ONCE"
soft80_charset:
.byte $0f,$03,$0f,$00,$0f,$07,$05,$0e
.byte $0f,$05,$0e,$0b,$0f,$0b,$0f,$0f
sta CIA2_PRA
jmp $FF5B ; Initialize video I/O
- .segment "INIT"
+ .segment "ONCE"
firstinit:
; copy charset to RAM under I/O
sei
soft80_tables_data_end:
;-------------------------------------------------------------------------------
- .segment "INITBSS"
+ .segment "INIT"
soft80_internal_cellcolor:
.res 1
soft80_internal_bgcolor:
sta VIC_VIDEO_ADR
rts
- .segment "INIT"
+ .segment "ONCE"
firstinit:
; copy charset to RAM under I/O
sei
soft80_tables_data_end:
;-------------------------------------------------------------------------------
- .segment "INITBSS"
+ .segment "INIT"
soft80mono_internal_cellcolor:
.res 1
soft80mono_internal_bgcolor:
; Constructor that writes to the 1/10 sec register of the TOD to kick it
; into action. If this is not done, the clock hangs. We will read the register
; and write it again, ignoring a possible change in between.
-.segment "INIT"
+.segment "ONCE"
.proc initsystime
.importzp devnum
-.segment "INITBSS"
+.segment "INIT"
curunit:
.res 1
-.segment "INIT"
+.segment "ONCE"
.proc initcurunit
.export _mouse_def_pointercolor
-.segment "INIT"
+.segment "ONCE"
_mouse_def_pointercolor:
.export _mouse_def_pointershape
-.segment "INIT"
+.segment "ONCE"
_mouse_def_pointershape:
;--------------------------------------------------------------------------
; initstdin: Open the stdin file descriptors for the keyboard
-.segment "INIT"
+.segment "ONCE"
.proc initstdin
;--------------------------------------------------------------------------
; initstdout: Open the stdout and stderr file descriptors for the screen.
-.segment "INIT"
+.segment "ONCE"
.proc initstdout
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run.
;
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
; --------------------------------------------------------------------------
; Initialize the mouse sprite.
-.segment "INIT"
+.segment "ONCE"
initmcb:
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run.
;
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
cwd_init := initcwd
-.segment "INITBSS"
+.segment "INIT"
__cwd: .res __cwd_buf_size
; Initialization. Will be called from startup!
-.segment "INIT"
+.segment "ONCE"
initheap:
sec
.endproc
- .segment "INIT"
+ .segment "ONCE"
initclock:
lda #0
ldx #3
.macpack longbranch
- .segment "INIT"
+ .segment "ONCE"
initconio:
lda #0
sta LCD_XPOS
.include "extzp.inc"
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
; a constructor
;
;
.export NMIStub
- .segment "INIT"
+ .segment "ONCE"
NMIStub:
; A is saved by the BIOS
.include "geossym.inc"
-.segment "INIT"
+.segment "ONCE"
initscrsize:
.ifdef __GEOS_CBM__
.include "const.inc"
.include "geossym.inc"
-.segment "INIT"
+.segment "ONCE"
; Setup arguments for main
;-----------------------------------------------------------------------------
; Enable the interrupt that update_clock needs.
;
- .segment "INIT"
+ .segment "ONCE"
init_clock:
lda #%10000000
tsb VTIMCTLA
.include "lynx.inc"
.import __STARTOFDIRECTORY__
.import __RAM_START__
- .import __CODE_SIZE__,__DATA_SIZE__,__RODATA_SIZE__
- .import __STARTUP_SIZE__,__INIT_SIZE__,__LOWCODE_SIZE__
+ .import __CODE_SIZE__, __DATA_SIZE__, __RODATA_SIZE__
+ .import __STARTUP_SIZE__, __ONCE_SIZE__, __LOWCODE_SIZE__
.import __BLOCKSIZE__
.export __DEFDIR__: absolute = 1
.segment "DIRECTORY"
__DIRECTORY_START__:
-off0=__STARTOFDIRECTORY__+(__DIRECTORY_END__-__DIRECTORY_START__)
-blocka=off0/__BLOCKSIZE__
+off0 = __STARTOFDIRECTORY__ + (__DIRECTORY_END__ - __DIRECTORY_START__)
+blocka = off0 / __BLOCKSIZE__
; Entry 0 - first executable
-block0=off0/__BLOCKSIZE__
-len0=__STARTUP_SIZE__+__INIT_SIZE__+__CODE_SIZE__+__DATA_SIZE__+__RODATA_SIZE__+__LOWCODE_SIZE__
+block0 = off0 / __BLOCKSIZE__
+len0 = __STARTUP_SIZE__ + __ONCE_SIZE__ + __CODE_SIZE__ + __DATA_SIZE__ + __RODATA_SIZE__ + __LOWCODE_SIZE__
.byte <block0
.word off0 & (__BLOCKSIZE__ - 1)
.byte $88
.word __RAM_START__
.word len0
__DIRECTORY_END__:
-
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda #<IRQStub
;---------------------------------------------------------------------------
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
.proc initmainargs
jmp ppubuf_put
;-----------------------------------------------------------------------------
-; Initialize the conio subsystem. Code goes into the INIT segment, which may
+; Initialize the conio subsystem. Code goes into the ONCE segment, which may
; be reused after startup.
-.segment "INIT"
+.segment "ONCE"
initconio:
jsr ppuinit
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
rts
;---------------------------------------------------------------------------
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
.proc initmainargs
.include "zeropage.inc"\r
\r
; Initialize one-character buffer that is filled by kbhit()\r
- .segment "INIT"\r
+ .segment "ONCE"\r
initcgetc:\r
lda #$00\r
sta CHARBUF ; No character in buffer initially\r
.endproc
- .segment "INIT"
+ .segment "ONCE"
initclock:
lda #0
ldx #3
.macpack longbranch
- .segment "INIT"
+ .segment "ONCE"
initconio:
jsr vce_init
jsr psg_init
.include "extzp.inc"
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
; a constructor
;
.export psg_init
- .segment "INIT"
+ .segment "ONCE"
psg_init:
clx
stz PSG_GLOBAL_PAN ; Clear global balance
.export vce_init
- .segment "INIT"
+ .segment "ONCE"
vce_init:
; Set CTA to zero
stz VCE_ADDR_LO
; ------------------------------------------------------------------------
-.segment "INITBSS"
+.segment "INIT"
zpsave: .res zpspace
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda IRQVec
;---------------------------------------------------------------------------
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
.proc initmainargs
.endproc
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
.constructor initkbd
.destructor donekbd
-.segment "INIT" ; Special init code segment may get overwritten
+.segment "ONCE" ; Special init code segment may get overwritten
.proc initkbd
irqcount: .byte 0
-.segment "INITBSS"
+.segment "INIT"
zpsave: .res zpspace
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1
; --------------------------------------------------------------------------
; Initialize library modules
-.segment "INIT"
+.segment "ONCE"
.proc initlib
; Initialization code. This is a constructor, so it is called on startup if
; the linker has detected references to this module.
-.segment "INIT"
+.segment "ONCE"
.proc initstkchk
; ----------------------------------------------------------------------------
; Data
-.segment "INITBSS"
+.segment "INIT"
; Initial stack pointer value. Stack is reset to this in case of overflows to
; allow program exit processing.
.constructor initmainargs, 24
.import __argc, __argv, args
- .segment "INIT"
+ .segment "ONCE"
initmainargs:
lda #<__argv
; ------------------------------------------------------------------------
-.segment "INITBSS"
+.segment "INIT"
zpsave: .res zpspace
; ------------------------------------------------------------------------
-.segment "INIT"
+.segment "ONCE"
initirq:
lda IRQVec
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; Maximum length of command-name
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
; which may be reused after the startup code is run
-.segment "INIT"
+.segment "ONCE"
initmainargs:
stx __argv + 1
rts
-.segment "INITBSS"
+.segment "INIT"
term: .res 1
name: .res NAME_LEN + 1