Exclude (small) stack from RAM memory area (like on most other targets) to make explicit that the linker may not use all RAM. If the cc65 parameter stack isn't used at all the __STACKSIZE__ symbol may be overridden on the linker command line with -D __STACKSIZE__=0.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4820 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
.import initlib, donelib, copydata
|
.import initlib, donelib, copydata
|
||||||
.import zerobss
|
.import zerobss
|
||||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||||
|
.import __STACKSIZE__ ; Linker generated
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "supervision.inc"
|
.include "supervision.inc"
|
||||||
@@ -30,9 +31,9 @@ reset:
|
|||||||
; initialize data
|
; initialize data
|
||||||
jsr copydata
|
jsr copydata
|
||||||
|
|
||||||
lda #>(__RAM_START__ + __RAM_SIZE__)
|
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||||
sta sp+1 ; Set argument stack ptr
|
sta sp+1 ; Set argument stack ptr
|
||||||
stz sp ; #<(__RAM_START__ + __RAM_SIZE__)
|
stz sp ; #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||||
jsr initlib
|
jsr initlib
|
||||||
jsr _main
|
jsr _main
|
||||||
_exit: jsr donelib
|
_exit: jsr donelib
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
# ld65 config file
|
# ld65 config file
|
||||||
# ld65 --config supervision.cfg -o <prog>.bin <prog>.o
|
# ld65 --config supervision.cfg -o <prog>.bin <prog>.o
|
||||||
|
|
||||||
|
SYMBOLS {
|
||||||
|
__STACKSIZE__: value = $0100, weak = yes; # 1 page stack
|
||||||
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
RAM: start = $0000, size = $2000;
|
RAM: start = $0000, size = $2000 - __STACKSIZE__;
|
||||||
VRAM: start = $4000, size = $2000;
|
VRAM: start = $4000, size = $2000;
|
||||||
BANKROM1: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
BANKROM1: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
||||||
BANKROM2: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
BANKROM2: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
||||||
|
|||||||
@@ -2,14 +2,17 @@
|
|||||||
|
|
||||||
# ld65 config file
|
# ld65 config file
|
||||||
# ld65 --config supervision16.cfg -o <prog>.bin <prog>.o
|
# ld65 --config supervision16.cfg -o <prog>.bin <prog>.o
|
||||||
|
|
||||||
|
SYMBOLS {
|
||||||
|
__STACKSIZE__: value = $0100, weak = yes; # 1 page stack
|
||||||
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: start = $0000, size = $0100;
|
ZP: start = $0000, size = $0100;
|
||||||
CPUSTACK: start = $0100, size = $0100;
|
CPUSTACK: start = $0100, size = $0100;
|
||||||
RAM: start = $0200, size = $1E00;
|
RAM: start = $0200, size = $1E00 - __STACKSIZE__;
|
||||||
VRAM: start = $4000, size = $2000;
|
VRAM: start = $4000, size = $2000;
|
||||||
ROM: start = $C000, size = $4000, fill = yes, fillval = $ff, file=%O, define=yes;
|
ROM: start = $C000, size = $4000, fill = yes, fillval = $ff, file=%O, define=yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
LOWCODE: load = ROM, type = ro, optional = yes;
|
LOWCODE: load = ROM, type = ro, optional = yes;
|
||||||
INIT: load = ROM, type = ro, define = yes, optional = yes;
|
INIT: load = ROM, type = ro, define = yes, optional = yes;
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
# ld65 config file
|
# ld65 config file
|
||||||
# ld65 --config supervision.cfg -o <prog>.bin <prog>.o
|
# ld65 --config supervision.cfg -o <prog>.bin <prog>.o
|
||||||
|
|
||||||
|
SYMBOLS {
|
||||||
|
__STACKSIZE__: value = $0100, weak = yes; # 1 page stack
|
||||||
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
RAM: start = $0000, size = $2000;
|
RAM: start = $0000, size = $2000 - __STACKSIZE__;
|
||||||
VRAM: start = $4000, size = $2000;
|
VRAM: start = $4000, size = $2000;
|
||||||
BANKROM1: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
BANKROM1: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
||||||
BANKROM2: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
BANKROM2: start = $8000, size = $4000, fill = yes, fillval = $FF, file = %O;
|
||||||
|
|||||||
Reference in New Issue
Block a user