[stella] Macros to manage memory allocation.
R Mundschau
rmundschau at frontiernet.net
Sun Jun 10 22:54:57 CDT 2007
Hello,
I thought I would share a set of macros that I have been using lately
to help simplify allocating memory. The macros as attached allow you
to allocate RAM for global variables, and RAM for sets of local
variables. All the sets of local variables are overlayed in memory.
It is up to the programmer to handle the issues of sharing RAM
between variables. A general protocol, like local variables are
not valid outside of the routine where they are used is usually
sufficient.
The macros could be expanded to support multiple overlays of local
variables, like layers of scope in a structured language such as C.
Or, include expanded RAM like the SARA chip or the Supercharger, but
right now only the one layer of locals and the original 128 bytes of
RAM are supported. There is no accounting for stack usage, RAM is
simply allocated starting from $80 and growing towards $FF.
The main advantage of these macros is to eliminate clumsy hard-coded
"label EQU address" like statements. DASM is not too happy about how
the macros work right now because it takes many passes for the
variable addresses to all settle down, but I find the macros very
useful in saving time and reducing errors. Does anyone have ideas
for improving on this technique?
Cheers!
Robert M
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allocmacros.inc
Type: application/octet-stream
Size: 4661 bytes
Desc: not available
Url : http://www.atariage.com/pipermail/stella/attachments/20070610/482a2cb0/attachment.obj
More information about the Stella
mailing list