<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 11 Nov 2004 16:37:33 +0000 (GMT)
From   : Andrew W <a.weston2@...>
Subject: Re: SRAM

In <URL:news:local.misc> on Thu 11 Nov, Richard_Talbot-Watkins@... wrote:

> > Thanks, I'll  make a note of all that and the URL. I think this is what
> > BFS on Beebit must be implementing - the 1770DFS routines. In this case
> > how does a game like Exile manage to use SRAM on an otherwise
> > unexpanded BBC Micro? The only routine I know of in the OS is to read a
> > byte from paged ROM.
> 
> It just sidesteps the OS completely, and accesses the hardware directly:
>
I see. That's a nicer way of doing it!

> \ initialise
> LDA &F4     \ Take copy of currently paged ROM bank
> STA old           \ put it somewhere safe
> LDA #4            \ RAM bank 4
> STA &F4     \ store OS copy of current paged ROM bank
> STA &FE30   \ actually select bank 4
>
So I assume Exile would prior to this somehow test 'sockets' 0-D(?) to
see where the SRAM was located?

> \ now accesses to locations &8000...&BFFF will address sideways RAM bank 4.
> \ e.g. let's write 256 bytes from main RAM to sideways RAM
> 
> LDY #0
> ..loop
> LDA &3000,Y
> STA &8000,Y
> INY
Do you need a CPY #256 here?
> BNE loop
> 
> \ finalise
> LDA old
> STA &F4
> STA &FE30   \ reinstate previously active bank
> RTS
> 
> Remember, Exile used absolutely *no* OS routines at all in its main game
> code - everything was done directly, as above.  In fact, because Exile
> shuts out the OS completely, it is able to leave its sideways RAM bank
> paged in permanently, and gets to treat it like any other 16k of memory.
>
I see, this is what I was beginning to suspect. So it can use virtually
all of the 32K for the game/screen including much of below PAGE?
Fascinating stuff :-)



A.Weston
-- 
Staffordshire, UK of GB&NI. 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>