<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 21 May 1996 10:54:53 +0100 (BST)
From   : sf4000@... (Steven Flintham)
Subject: Re: Writing sideways ROM software

> >I'm writing a sideways ROM and I'm having trouble with using zero page.
> >Inevitably my code needs a few zero page locations to work with and I
> >don't know where I can use which is 'safe'. Obviously you can mess
> >around stacking the locations you intend to use first, but this is
> >extremely messy, especially when you can have more than one exit from a
> >routine (such as when an error occurs).
> 
> I think it ought to depend on whether or not you wish the information to be
> permanently resident or only for the duration of that *COMMAND.
> In my rom code I've always made use of &70-&8F for temporary stuff, but never
> stored permanent data there as many other people also make use of exactly the
> same memory for there own * commands.

Now you've said this I realise I wasn't entirely clear about what I
meant by 'safe'. I need somewhere I don't need to worry about
corrupting, rather than somewhere I can store data between calls. (The
code I'm writing is specifically designed to run in sideways RAM so any
such data can be stored in the RAM bank itself.)

> You can also consider using the end of the stack - eg &100 onwards or
> something. I've seen a number of things do this and infact I've done it
> myself. It's a particularly useful place to plonk code for reading from
> sideways RAM, which you can't do without an enormous overhead when running
> from a sideways RAM bank yourself. Obviously this can only be done when the
> stack pointer is in a appropriate location (nearly always).

This could be a satisfactory solution, although as you say it's not
guaranteed to be safe.

> I guess if you're _really_ paranoid, the stacking and unstacking is the only
> way. This is trivial and can be stuck in a routine called by all your
> functions if you desire. However you have to consider what happens to those
> other interrupt driven chunks of software... ;-)

Perhaps I'm revealing my ignorance here, and I did notice the smiley,
but I don't quite follow this. Could someone give me a simple example?
- if stacking/unstacking can cause problems I might as well not do it.
I like the idea of using a subroutine to do it - it's so obvious, but
I've always just included code to do it at the point where it's
required before.

Thanks for the advice.

Steven

(I've deliberately sent this to the list rather than privately as it
might be of interest to someone else and/or they may have something to
add.)

P.S. I'm starting my exams in the next day or two, so if anyone sends
me any e-mail they might not get a reply for a few weeks. I'm obviously
happy to receive advice from people, I just thought I should warn you
not to expect a rapid response.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>