[stella] Macros to manage memory allocation.
Lee Fastenau
stella at leefastenau.com
Mon Jun 11 12:52:23 CDT 2007
Hey Robert,
I like the notion of working with discreet "local" and "global" variables in Stella. I think there are lots of opportunities, as you've stated, to extend this to support various RAM schemes, stack considerations, and even handling of the "mostly global" variable (where a location is used for an odd purpose just prior to being updated).
If the macro expected all globals to be defined first, as we typically do, it could just take one pass to evaluate all the expressions, right?
-Lee
p.s.: Please don't take this list away. I promise to be more active.
-------- Original Message --------
> From: R Mundschau <rmundschau at frontiernet.net>
> Sent: Sunday, June 10, 2007 8:56 PM
> To: Atari 2600 programming list <Stella at atari2600.org>
> Subject: [stella] Macros to manage memory allocation.
>
> 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
>
>
> _______________________________________________
> Stella mailing list
> Stella at atari2600.org
> http://atari2600.org/mailman/listinfo/stella
More information about the Stella
mailing list