Subject: Re: [stella] DASM 'upgrade' in progress From: Christopher Tumber <christophertumber@xxxxxxxxxx> Date: Thu, 20 Mar 2003 23:35:37 -0500 |
Andrew 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). There are a couple ways you could do this, for example require local variables to start with a certain string (ie: LOCAL_variable1 EQU $80) or replace EQU with something similar which does the same thing (ie: variable1 EQU.LOCAL $80) and then keep that association until it's changed later. However, it could become dificult for programmers to keep track of the current status of local variables (ie: If a subroutine is called that happens to be outside the local area, what happens? Are you sure you haven't redifined the variable recently?) So I would suggest borrowing from C and use {}. This has the advantage that just about everyone's familiar with C or something similar which also uses {} and it's visually pretty easy to pick out. Any variables defined within {} are local variables. Any variable defined outside {} are global variables. Subroutine1: { variable0 EQU $80 variable1 EQU $81 variable2 EQU $82 ;code ;code ;code rts } Subroutine2: { variable0 EQU $90 variable1 EQU $91 variable2 EQU $92 ;code ;code ;code rts } Outside the {} a local variable is undefined (unless redifined) so if there's a branch to outside the {} then the variable must be redefined or an error will be generated. Of course, you'd probably want to allow nesting as well... Chris... ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] DASM 'upgrade' in prog, Andrew Davie | Thread | Re: [stella] DASM 'upgrade' in prog, Andrew Davie |
Re: [stella] DASM 'upgrade' in prog, Christopher Tumber | Date | Re: [stella] DASM 'upgrade' in prog, Manuel Polik |
Month |