SYMBOLS {
- __CARTSIZE__: type = weak, value = $4000; # possible values: $4000 and $8000
- __CART_ENTRY__: type = import;
- __STACKSIZE__: type = weak, value = $0300; # 3 pages stack
+ __CARTSIZE__: type = weak, value = $4000; # possible values: $4000 and $8000
+ __CART_ENTRY__: type = import;
+ __STACKSIZE__: type = weak, value = $0400; # 4 pages stack
+ __RESERVED_MEMORY__: type = export, value = $0200; # space for display list and 20x24 screen buffer
}
MEMORY {
- ZP: file = "", start = $0019, size = $00E7, define = yes;
- RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - $021C, define = yes;
- ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF;
- CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40;
- CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59;
+ ZP: file = "", start = $0019, size = $00E7, define = yes;
+ RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes;
+ ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF;
+ CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40;
+ CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59;
CARTENTRY: file = %O, start = $BFFE, size = $0002;
}
SEGMENTS {
.export _exit, start
.export __STARTUP__ : absolute = 1 ; Mark as startup
- .import __RAM_START__, __RAM_SIZE__
- .import __RESERVED_MEMORY__
+ .import __RAM_START__, __RAM_SIZE__
+ .import __RESERVED_MEMORY__
.import initlib, donelib, callmain
.import zerobss, copydata
; setup the stack
- lda #<(__RAM_START__ + __RAM_SIZE__)
+ lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
sta sp
- lda #>(__RAM_START__ + __RAM_SIZE__)
+ lda #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
sta sp+1 ; Set argument stack ptr
; Call module constructors