Is there a way to position a RAM segment after the C software stack without having to declare an absolute size for it?
If we take this cfg file (ROM and zeropage have been removed since they are not relevant here):
I'd like to declare a code part that comes after the stack, but I don't want to declare a size for it here in the config file. The size shall be dependent on the actual number of bytes that are used for variables in this segment/memory location. (Just like the size of two segments in the same memory location is dependent on their actual use.)
So, the three RAM sections shall be calculated like this:
Post-stack-segment:
Size: The actual number of variables declared for this segment, not more.
Start = RAM end minus post-stack-segment size.
Stack:
Size = Defined by me, for example 256 or 512
Start = RAM end minus post-stack-segment size minus stack size.
Regular RAM:
Size: RAM size minus stack size minus post-stack-segment size as a maximum.
Start: RAM start
Is it possible to declare this in a cfg file?
If we take this cfg file (ROM and zeropage have been removed since they are not relevant here):
Code:
SYMBOLS
{
__STACKSIZE__ = $0100;
__RAMSTART__ = $0200;
__RAMSIZE__ = $0800 - __RAMSTART__ - __STACKSIZE__;
__STACKSTART__ = __RAMSTART__ + __RAMSIZE__;
}
MEMORY
{
RAM: type = rw, start = __RAMSTART__, size = __RAMSIZE__, file = "";
STACK: type = rw, start = __STACKSTART__, size = __STACKSIZE__, file = "", define = yes;
}
SEGMENTS
{
SPRITES: load = RAM, type = bss, align = $0100;
BSS: load = RAM, type = bss;
}
{
__STACKSIZE__ = $0100;
__RAMSTART__ = $0200;
__RAMSIZE__ = $0800 - __RAMSTART__ - __STACKSIZE__;
__STACKSTART__ = __RAMSTART__ + __RAMSIZE__;
}
MEMORY
{
RAM: type = rw, start = __RAMSTART__, size = __RAMSIZE__, file = "";
STACK: type = rw, start = __STACKSTART__, size = __STACKSIZE__, file = "", define = yes;
}
SEGMENTS
{
SPRITES: load = RAM, type = bss, align = $0100;
BSS: load = RAM, type = bss;
}
I'd like to declare a code part that comes after the stack, but I don't want to declare a size for it here in the config file. The size shall be dependent on the actual number of bytes that are used for variables in this segment/memory location. (Just like the size of two segments in the same memory location is dependent on their actual use.)
So, the three RAM sections shall be calculated like this:
Post-stack-segment:
Size: The actual number of variables declared for this segment, not more.
Start = RAM end minus post-stack-segment size.
Stack:
Size = Defined by me, for example 256 or 512
Start = RAM end minus post-stack-segment size minus stack size.
Regular RAM:
Size: RAM size minus stack size minus post-stack-segment size as a maximum.
Start: RAM start
Is it possible to declare this in a cfg file?