Moved run location of ONCE segment.
Make the same changes to the Apple II that were done with 0ee9b2e446
to the C64.
Notes:
- The startup code deliberately doesn't make use of symbols defined for the LC segment as that segment is optional.
- The <...>-asm.cfg configs move the segment BSS to an own memory area BSS although this doesn't seem necessary. However the benefit is that the size of the memeory area MAIN is identical to the number of bytes loaded from disk into RAM. To keep this an invariant for all Apple II configs allows to simplify the EXEHDR to just refer to the symbols defined for MAIN.
This commit is contained in:
parent
1d1ba3ed3b
commit
e3cbc7e8b8
10 changed files with 196 additions and 227 deletions
|
@ -3,20 +3,17 @@
|
||||||
FEATURES {
|
FEATURES {
|
||||||
STARTADDRESS: default = $0803;
|
STARTADDRESS: default = $0803;
|
||||||
}
|
}
|
||||||
SYMBOLS {
|
|
||||||
__LOADADDR__: type = weak, value = __CODE_RUN__;
|
|
||||||
__LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__;
|
|
||||||
}
|
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: start = $0080, size = $001A, define = yes;
|
ZP: file = "", start = $0000, size = $00FF;
|
||||||
HEADER: file = %O, start = $0000, size = $0004;
|
HEADER: file = %O, start = %S - 4, size = $0004;
|
||||||
MAIN: file = %O, start = %S, size = $C000 - %S;
|
MAIN: file = %O, define = yes, start = %S, size = $C000 - %S;
|
||||||
|
BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
||||||
EXEHDR: load = HEADER, type = ro, optional = yes;
|
EXEHDR: load = HEADER, type = ro, optional = yes;
|
||||||
CODE: load = MAIN, type = rw, optional = yes, define = yes;
|
CODE: load = MAIN, type = rw, optional = yes;
|
||||||
RODATA: load = MAIN, type = ro, optional = yes;
|
RODATA: load = MAIN, type = ro, optional = yes;
|
||||||
DATA: load = MAIN, type = rw, optional = yes;
|
DATA: load = MAIN, type = rw, optional = yes;
|
||||||
BSS: load = MAIN, type = bss, optional = yes, define = yes;
|
BSS: load = BSS, type = bss, optional = yes, define = yes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,18 @@ FEATURES {
|
||||||
}
|
}
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__EXEHDR__: type = import;
|
__EXEHDR__: type = import;
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
||||||
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
||||||
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
||||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
|
||||||
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
|
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
|
||||||
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
|
|
||||||
__LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
|
|
||||||
__MOVE_LAST__ - __MOVE_START__;
|
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: define = yes, start = $0080, size = $001A;
|
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||||
HEADER: file = %O, start = $0000, size = $0004;
|
HEADER: file = %O, start = %S - 4, size = $0004;
|
||||||
MAIN: file = %O, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __STACKSIZE__ - __OVERLAYSIZE__ - %S;
|
MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S;
|
||||||
MOVE: file = %O, define = yes, start = $0000, size = $FFFF;
|
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||||
LC: define = yes, start = __LCADDR__, size = __LCSIZE__;
|
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
|
||||||
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
|
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
|
||||||
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
|
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
|
||||||
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
|
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
@ -45,10 +42,10 @@ SEGMENTS {
|
||||||
CODE: load = MAIN, type = ro;
|
CODE: load = MAIN, type = ro;
|
||||||
RODATA: load = MAIN, type = ro;
|
RODATA: load = MAIN, type = ro;
|
||||||
DATA: load = MAIN, type = rw;
|
DATA: load = MAIN, type = rw;
|
||||||
INIT: load = MAIN, type = bss, define = yes;
|
INIT: load = MAIN, type = rw;
|
||||||
BSS: load = MAIN, type = bss, define = yes;
|
ONCE: load = MAIN, type = ro, define = yes;
|
||||||
ONCE: load = MOVE, run = MAIN, type = ro, define = yes, optional = yes;
|
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||||
LC: load = MOVE, run = LC, type = ro, optional = yes;
|
BSS: load = BSS, type = bss, define = yes;
|
||||||
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
|
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
|
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
|
||||||
|
|
|
@ -1,30 +1,27 @@
|
||||||
# Configuration for ProDOS 8 system programs (without the header)
|
# Configuration for ProDOS 8 system programs (without the header)
|
||||||
|
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
||||||
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
__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 = __INIT_RUN__ - __STARTUP_RUN__ +
|
|
||||||
__MOVE_LAST__ - __MOVE_START__;
|
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: define = yes, start = $0080, size = $001A;
|
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||||
MAIN: file = %O, start = $2000, size = $9F00 - __STACKSIZE__;
|
MAIN: file = %O, start = $2000, size = $BF00 - $2000;
|
||||||
MOVE: file = %O, define = yes, start = $0000, size = $FFFF;
|
BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__;
|
||||||
LC: define = yes, start = __LCADDR__, size = __LCSIZE__;
|
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
STARTUP: load = MAIN, type = ro, define = yes;
|
STARTUP: load = MAIN, type = ro;
|
||||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||||
CODE: load = MAIN, type = ro;
|
CODE: load = MAIN, type = ro;
|
||||||
RODATA: load = MAIN, type = ro;
|
RODATA: load = MAIN, type = ro;
|
||||||
DATA: load = MAIN, type = rw;
|
DATA: load = MAIN, type = rw;
|
||||||
INIT: load = MAIN, type = bss, define = yes;
|
INIT: load = MAIN, type = rw;
|
||||||
BSS: load = MAIN, type = bss, define = yes;
|
ONCE: load = MAIN, type = ro, define = yes;
|
||||||
ONCE: load = MOVE, run = RAM, type = ro, define = yes, optional = yes;
|
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||||
LC: load = MOVE, run = LC, type = ro, optional = yes;
|
BSS: load = BSS, type = bss, define = yes;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
CONDES: type = constructor,
|
CONDES: type = constructor,
|
||||||
|
|
|
@ -5,33 +5,30 @@ FEATURES {
|
||||||
}
|
}
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__EXEHDR__: type = import;
|
__EXEHDR__: type = import;
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
||||||
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
||||||
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
__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 = __INIT_RUN__ - __STARTUP_RUN__ +
|
|
||||||
__MOVE_LAST__ - __MOVE_START__;
|
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: define = yes, start = $0080, size = $001A;
|
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||||
HEADER: file = %O, start = $0000, size = $0004;
|
HEADER: file = %O, start = %S - 4, size = $0004;
|
||||||
MAIN: file = %O, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
|
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
|
||||||
MOVE: file = %O, define = yes, start = $0000, size = $FFFF;
|
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||||
LC: define = yes, start = __LCADDR__, size = __LCSIZE__;
|
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
EXEHDR: load = HEADER, type = ro;
|
EXEHDR: load = HEADER, type = ro;
|
||||||
STARTUP: load = MAIN, type = ro, define = yes;
|
STARTUP: load = MAIN, type = ro;
|
||||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||||
CODE: load = MAIN, type = ro;
|
CODE: load = MAIN, type = ro;
|
||||||
RODATA: load = MAIN, type = ro;
|
RODATA: load = MAIN, type = ro;
|
||||||
DATA: load = MAIN, type = rw;
|
DATA: load = MAIN, type = rw;
|
||||||
INIT: load = MAIN, type = bss, define = yes;
|
INIT: load = MAIN, type = rw;
|
||||||
BSS: load = MAIN, type = bss, define = yes;
|
ONCE: load = MAIN, type = ro, define = yes;
|
||||||
ONCE: load = MOVE, run = MAIN, type = ro, define = yes, optional = yes;
|
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||||
LC: load = MOVE, run = LC, type = ro, optional = yes;
|
BSS: load = BSS, type = bss, define = yes;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
CONDES: type = constructor,
|
CONDES: type = constructor,
|
||||||
|
|
|
@ -3,18 +3,17 @@
|
||||||
FEATURES {
|
FEATURES {
|
||||||
STARTADDRESS: default = $0803;
|
STARTADDRESS: default = $0803;
|
||||||
}
|
}
|
||||||
SYMBOLS {
|
|
||||||
__LOADADDR__: type = weak, value = __CODE_RUN__;
|
|
||||||
__LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__;
|
|
||||||
}
|
|
||||||
MEMORY {
|
MEMORY {
|
||||||
HEADER: file = %O, start = $0000, size = $0004;
|
ZP: file = "", start = $0000, size = $00FF;
|
||||||
MAIN: file = %O, start = %S, size = $C000 - %S;
|
HEADER: file = %O, start = %S - 4, size = $0004;
|
||||||
|
MAIN: file = %O, define = yes, start = %S, size = $C000 - %S;
|
||||||
|
BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
|
ZEROPAGE: load = ZP, type = zp, optional = yes;
|
||||||
EXEHDR: load = HEADER, type = ro, optional = yes;
|
EXEHDR: load = HEADER, type = ro, optional = yes;
|
||||||
CODE: load = MAIN, type = rw, optional = yes, define = yes;
|
CODE: load = MAIN, type = rw, optional = yes;
|
||||||
RODATA: load = MAIN, type = ro, optional = yes;
|
RODATA: load = MAIN, type = ro, optional = yes;
|
||||||
DATA: load = MAIN, type = rw, optional = yes;
|
DATA: load = MAIN, type = rw, optional = yes;
|
||||||
BSS: load = MAIN, type = bss, optional = yes, define = yes;
|
BSS: load = BSS, type = bss, optional = yes, define = yes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,21 +12,18 @@ FEATURES {
|
||||||
}
|
}
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__EXEHDR__: type = import;
|
__EXEHDR__: type = import;
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
||||||
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
||||||
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
||||||
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
|
||||||
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
|
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
|
||||||
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
|
|
||||||
__LOADSIZE__: type = weak, value = __INIT_RUN__ - __STARTUP_RUN__ +
|
|
||||||
__MOVE_LAST__ - __MOVE_START__;
|
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: define = yes, start = $0080, size = $001A;
|
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||||
HEADER: file = %O, start = $0000, size = $0004;
|
HEADER: file = %O, start = %S - 4, size = $0004;
|
||||||
MAIN: file = %O, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __STACKSIZE__ - __OVERLAYSIZE__ - %S;
|
MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S;
|
||||||
MOVE: file = %O, define = yes, start = $0000, size = $FFFF;
|
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||||
LC: define = yes, start = __LCADDR__, size = __LCSIZE__;
|
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
|
||||||
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
|
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
|
||||||
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
|
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
|
||||||
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
|
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
|
||||||
|
@ -45,10 +42,10 @@ SEGMENTS {
|
||||||
CODE: load = MAIN, type = ro;
|
CODE: load = MAIN, type = ro;
|
||||||
RODATA: load = MAIN, type = ro;
|
RODATA: load = MAIN, type = ro;
|
||||||
DATA: load = MAIN, type = rw;
|
DATA: load = MAIN, type = rw;
|
||||||
INIT: load = MAIN, type = bss, define = yes;
|
INIT: load = MAIN, type = rw;
|
||||||
BSS: load = MAIN, type = bss, define = yes;
|
ONCE: load = MAIN, type = ro, define = yes;
|
||||||
ONCE: load = MOVE, run = MAIN, type = ro, define = yes, optional = yes;
|
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||||
LC: load = MOVE, run = LC, type = ro, optional = yes;
|
BSS: load = BSS, type = bss, define = yes;
|
||||||
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
|
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
|
||||||
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
|
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
|
||||||
|
|
|
@ -1,30 +1,27 @@
|
||||||
# Configuration for ProDOS 8 system programs (without the header)
|
# Configuration for ProDOS 8 system programs (without the header)
|
||||||
|
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
||||||
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
__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 = __INIT_RUN__ - __STARTUP_RUN__ +
|
|
||||||
__MOVE_LAST__ - __MOVE_START__;
|
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: define = yes, start = $0080, size = $001A;
|
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||||
MAIN: file = %O, start = $2000, size = $9F00 - __STACKSIZE__;
|
MAIN: file = %O, start = $2000, size = $BF00 - $2000;
|
||||||
MOVE: file = %O, define = yes, start = $0000, size = $FFFF;
|
BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__;
|
||||||
LC: define = yes, start = __LCADDR__, size = __LCSIZE__;
|
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
STARTUP: load = MAIN, type = ro, define = yes;
|
STARTUP: load = MAIN, type = ro;
|
||||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||||
CODE: load = MAIN, type = ro;
|
CODE: load = MAIN, type = ro;
|
||||||
RODATA: load = MAIN, type = ro;
|
RODATA: load = MAIN, type = ro;
|
||||||
DATA: load = MAIN, type = rw;
|
DATA: load = MAIN, type = rw;
|
||||||
INIT: load = MAIN, type = bss, define = yes;
|
INIT: load = MAIN, type = rw;
|
||||||
BSS: load = MAIN, type = bss, define = yes;
|
ONCE: load = MAIN, type = ro, define = yes;
|
||||||
ONCE: load = MOVE, run = MAIN, type = ro, define = yes, optional = yes;
|
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||||
LC: load = MOVE, run = LC, type = ro, optional = yes;
|
BSS: load = BSS, type = bss, define = yes;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
CONDES: type = constructor,
|
CONDES: type = constructor,
|
||||||
|
|
|
@ -5,33 +5,30 @@ FEATURES {
|
||||||
}
|
}
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__EXEHDR__: type = import;
|
__EXEHDR__: type = import;
|
||||||
|
__STACKSIZE__: type = weak, value = $0800; # 2k stack
|
||||||
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
__HIMEM__: type = weak, value = $9600; # Presumed RAM end
|
||||||
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
__LCADDR__: type = weak, value = $D400; # Behind quit code
|
||||||
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two
|
__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 = __INIT_RUN__ - __STARTUP_RUN__ +
|
|
||||||
__MOVE_LAST__ - __MOVE_START__;
|
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: define = yes, start = $0080, size = $001A;
|
ZP: file = "", define = yes, start = $0080, size = $001A;
|
||||||
HEADER: file = %O, start = $0000, size = $0004;
|
HEADER: file = %O, start = %S - 4, size = $0004;
|
||||||
MAIN: file = %O, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
|
MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
|
||||||
MOVE: file = %O, define = yes, start = $0000, size = $FFFF;
|
BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
|
||||||
LC: define = yes, start = __LCADDR__, size = __LCSIZE__;
|
LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
EXEHDR: load = HEADER, type = ro;
|
EXEHDR: load = HEADER, type = ro;
|
||||||
STARTUP: load = MAIN, type = ro, define = yes;
|
STARTUP: load = MAIN, type = ro;
|
||||||
LOWCODE: load = MAIN, type = ro, optional = yes;
|
LOWCODE: load = MAIN, type = ro, optional = yes;
|
||||||
CODE: load = MAIN, type = ro;
|
CODE: load = MAIN, type = ro;
|
||||||
RODATA: load = MAIN, type = ro;
|
RODATA: load = MAIN, type = ro;
|
||||||
DATA: load = MAIN, type = rw;
|
DATA: load = MAIN, type = rw;
|
||||||
INIT: load = MAIN, type = bss, define = yes;
|
INIT: load = MAIN, type = rw;
|
||||||
BSS: load = MAIN, type = bss, define = yes;
|
ONCE: load = MAIN, type = ro, define = yes;
|
||||||
ONCE: load = MOVE, run = MAIN, type = ro, define = yes, optional = yes;
|
LC: load = MAIN, run = LC, type = ro, optional = yes;
|
||||||
LC: load = MOVE, run = LC, type = ro, optional = yes;
|
BSS: load = BSS, type = bss, define = yes;
|
||||||
}
|
}
|
||||||
FEATURES {
|
FEATURES {
|
||||||
CONDES: type = constructor,
|
CONDES: type = constructor,
|
||||||
|
|
|
@ -6,16 +6,17 @@
|
||||||
|
|
||||||
.export _exit, done, return
|
.export _exit, done, return
|
||||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||||
.import zerobss
|
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import callmain
|
.import zerobss, callmain
|
||||||
|
.import __ONCE_LOAD__, __ONCE_SIZE__ ; Linker generated
|
||||||
.import __LC_START__, __LC_LAST__ ; Linker generated
|
.import __LC_START__, __LC_LAST__ ; Linker generated
|
||||||
.import __ONCE_RUN__, __ONCE_SIZE__ ; Linker generated
|
|
||||||
.import __INIT_RUN__ ; Linker generated
|
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "apple2.inc"
|
.include "apple2.inc"
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "STARTUP"
|
.segment "STARTUP"
|
||||||
|
|
||||||
; ProDOS TechRefMan, chapter 5.2.1:
|
; ProDOS TechRefMan, chapter 5.2.1:
|
||||||
|
@ -24,57 +25,16 @@
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
txs ; Init stack pointer
|
txs ; Init stack pointer
|
||||||
|
|
||||||
; Switch in LC bank 2 for W/O.
|
; Save space by putting some of the start-up code in the ONCE segment,
|
||||||
bit $C081
|
; which can be re-used by the BSS segment, the heap and the C stack.
|
||||||
bit $C081
|
|
||||||
|
|
||||||
; Set the source start address.
|
|
||||||
lda #<(__INIT_RUN__ + __ONCE_SIZE__)
|
|
||||||
ldy #>(__INIT_RUN__ + __ONCE_SIZE__)
|
|
||||||
sta $9B
|
|
||||||
sty $9C
|
|
||||||
|
|
||||||
; Set the source last address.
|
|
||||||
lda #<(__INIT_RUN__ + __ONCE_SIZE__ + __LC_LAST__ - __LC_START__)
|
|
||||||
ldy #>(__INIT_RUN__ + __ONCE_SIZE__ + __LC_LAST__ - __LC_START__)
|
|
||||||
sta $96
|
|
||||||
sty $97
|
|
||||||
|
|
||||||
; Set the destination last address.
|
|
||||||
lda #<__LC_LAST__
|
|
||||||
ldy #>__LC_LAST__
|
|
||||||
sta $94
|
|
||||||
sty $95
|
|
||||||
|
|
||||||
; Call into Applesoft Block Transfer Up -- which handles zero-
|
|
||||||
; sized blocks well -- to move the content of the LC memory area.
|
|
||||||
jsr $D39A ; BLTU2
|
|
||||||
|
|
||||||
; Set the source start address.
|
|
||||||
lda #<__INIT_RUN__
|
|
||||||
ldy #>__INIT_RUN__
|
|
||||||
sta $9B
|
|
||||||
sty $9C
|
|
||||||
|
|
||||||
; Set the source last address.
|
|
||||||
lda #<(__INIT_RUN__ + __ONCE_SIZE__)
|
|
||||||
ldy #>(__INIT_RUN__ + __ONCE_SIZE__)
|
|
||||||
sta $96
|
|
||||||
sty $97
|
|
||||||
|
|
||||||
; Set the destination last address.
|
|
||||||
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 ONCE segment.
|
|
||||||
jsr $D39A ; BLTU2
|
|
||||||
|
|
||||||
; Delegate all further processing, to keep the STARTUP segment small.
|
|
||||||
jsr init
|
jsr init
|
||||||
|
|
||||||
|
; Clear the BSS data.
|
||||||
|
jsr zerobss
|
||||||
|
|
||||||
|
; Push the command-line arguments; and, call main().
|
||||||
|
jsr callmain
|
||||||
|
|
||||||
; Avoid a re-entrance of donelib. This is also the exit() entry.
|
; Avoid a re-entrance of donelib. This is also the exit() entry.
|
||||||
_exit: ldx #<exit
|
_exit: ldx #<exit
|
||||||
lda #>exit
|
lda #>exit
|
||||||
|
@ -109,6 +69,8 @@ exit: ldx #$02
|
||||||
; We're done
|
; We're done
|
||||||
jmp done
|
jmp done
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
|
|
||||||
; Save the zero-page locations that we need.
|
; Save the zero-page locations that we need.
|
||||||
|
@ -118,9 +80,6 @@ init: ldx #zpspace-1
|
||||||
dex
|
dex
|
||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
; Clear the BSS data.
|
|
||||||
jsr zerobss
|
|
||||||
|
|
||||||
; Save the original RESET vector.
|
; Save the original RESET vector.
|
||||||
ldx #$02
|
ldx #$02
|
||||||
: lda SOFTEV,x
|
: lda SOFTEV,x
|
||||||
|
@ -128,13 +87,6 @@ init: ldx #zpspace-1
|
||||||
dex
|
dex
|
||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
; ProDOS TechRefMan, chapter 5.3.5:
|
|
||||||
; "Your system program should place in the RESET vector the
|
|
||||||
; address of a routine that ... closes the files."
|
|
||||||
ldx #<_exit
|
|
||||||
lda #>_exit
|
|
||||||
jsr reset ; Setup RESET vector
|
|
||||||
|
|
||||||
; Check for ProDOS.
|
; Check for ProDOS.
|
||||||
ldy $BF00 ; MLI call entry point
|
ldy $BF00 ; MLI call entry point
|
||||||
cpy #$4C ; Is MLI present? (JMP opcode)
|
cpy #$4C ; Is MLI present? (JMP opcode)
|
||||||
|
@ -164,14 +116,50 @@ basic: lda HIMEM
|
||||||
: sta sp
|
: sta sp
|
||||||
stx sp+1
|
stx sp+1
|
||||||
|
|
||||||
|
; ProDOS TechRefMan, chapter 5.3.5:
|
||||||
|
; "Your system program should place in the RESET vector the
|
||||||
|
; address of a routine that ... closes the files."
|
||||||
|
ldx #<_exit
|
||||||
|
lda #>_exit
|
||||||
|
jsr reset ; Setup RESET vector
|
||||||
|
|
||||||
; Call the module constructors.
|
; Call the module constructors.
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Switch in LC bank 2 for R/O.
|
; Switch in LC bank 2 for W/O.
|
||||||
bit $C080
|
bit $C081
|
||||||
|
bit $C081
|
||||||
|
|
||||||
; Push the command-line arguments; and, call main().
|
; Set the source start address.
|
||||||
jmp callmain
|
; Aka __LC_LOAD__ iff segment LC exists.
|
||||||
|
lda #<(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||||
|
ldy #>(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||||
|
sta $9B
|
||||||
|
sty $9C
|
||||||
|
|
||||||
|
; Set the source last address.
|
||||||
|
; Aka __LC_LOAD__ + __LC_SIZE__ iff segment LC exists.
|
||||||
|
lda #<((__ONCE_LOAD__ + __ONCE_SIZE__) + (__LC_LAST__ - __LC_START__))
|
||||||
|
ldy #>((__ONCE_LOAD__ + __ONCE_SIZE__) + (__LC_LAST__ - __LC_START__))
|
||||||
|
sta $96
|
||||||
|
sty $97
|
||||||
|
|
||||||
|
; Set the destination last address.
|
||||||
|
; Aka __LC_RUN__ + __LC_SIZE__ iff segment LC exists.
|
||||||
|
lda #<__LC_LAST__
|
||||||
|
ldy #>__LC_LAST__
|
||||||
|
sta $94
|
||||||
|
sty $95
|
||||||
|
|
||||||
|
; Call into Applesoft Block Transfer Up -- which handles zero-
|
||||||
|
; sized blocks well -- to move the content of the LC memory area.
|
||||||
|
jsr $D39A ; BLTU2
|
||||||
|
|
||||||
|
; Switch in LC bank 2 for R/O and return.
|
||||||
|
bit $C080
|
||||||
|
rts
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
|
@ -187,6 +175,8 @@ quit: jsr $BF00 ; MLI call entry point
|
||||||
.byte $65 ; Quit
|
.byte $65 ; Quit
|
||||||
.word q_param
|
.word q_param
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
; MLI parameter list for quit
|
; MLI parameter list for quit
|
||||||
|
@ -196,15 +186,16 @@ q_param:.byte $04 ; param_count
|
||||||
.byte $00 ; reserved
|
.byte $00 ; reserved
|
||||||
.word $0000 ; reserved
|
.word $0000 ; reserved
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.data
|
.data
|
||||||
|
|
||||||
; Final jump when we're done
|
; Final jump when we're done
|
||||||
done: jmp DOSWARM ; Potentially patched at runtime
|
done: jmp DOSWARM ; Potentially patched at runtime
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "INIT"
|
.segment "INIT"
|
||||||
|
|
||||||
zpsave: .res zpspace
|
zpsave: .res zpspace
|
||||||
|
|
||||||
.bss
|
|
||||||
|
|
||||||
rvsave: .res 3
|
rvsave: .res 3
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export __EXEHDR__ : absolute = 1 ; Linker referenced
|
.export __EXEHDR__ : absolute = 1 ; Linker referenced
|
||||||
.import __LOADADDR__, __LOADSIZE__ ; Linker generated
|
.import __MAIN_START__, __MAIN_LAST__ ; Linker generated
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "EXEHDR"
|
.segment "EXEHDR"
|
||||||
|
|
||||||
.addr __LOADADDR__ ; Load address
|
.addr __MAIN_START__ ; Load address
|
||||||
.word __LOADSIZE__ ; Load length
|
.word __MAIN_LAST__ - __MAIN_START__ ; Load length
|
||||||
|
|
Loading…
Add table
Reference in a new issue