Re: [stella] DASM 'upgrade' in progress

Subject: Re: [stella] DASM 'upgrade' in progress
From: Erik Eid <eeid@xxxxxxxxx>
Date: Sat, 22 Mar 2003 10:30:57 -0500
On Wednesday 31 December 1969 19:00, Andrew Davie wrote:
> OK, I understand that request.  Essentially you want a local-variable
> scope.  I'll have a think about how this could/should be done.  Perhaps
> there's a good way to do it with existing code, anyway (for eg: defining
> the sections in separate files, and only exporting symbols which should be
> global).

That's close to the idea... but with overlays you may end up sharing 
identifiers across many subroutines that are scattered throughout your code.  
Since you sometimes have to put routines in certain spots, like the start of 
a page, you may not be able to have all the routines that use certain 
identifiers next to each other.

My thought was this...

SCOPE GLOBAL
   MyVar1  ds 1
   MyVar2  ds 1
   MyVar3  ds 1
ENDSCOPE GLOBAL

OVERLAY_START = MyVar3+1

SCOPE OVERLAY1
   org OVERLAY_START
   MyFoo1  ds 1
   MyFoo2  ds 1
ENDSCOPE OVERLAY1

SCOPE OVERLAY2
   org OVERLAY_START
   MyBar1  ds 1
   MyBar2  ds 1
ENDSCOPE OVERLAY2

Then, when you want to work only with variables that are in a certain scope, 
surround the section of code like this:

USING OVERLAY1
   lda MyFoo1
   [...]
   sta MyFoo2
ENDUSING OVERLAY1

Anything in the "GLOBAL" scope would be available anywhere, without a USING 
declaration.  If you reference a variable that isn't allowed (such as 
MyBar1), the compiler would report an error.

Maybe "namespace" would be a better name for this than "scope," but I think 
this gives the basic idea...

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread