<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 11 Nov 2004 13:58:08 +0000
From   : Richard_Talbot-Watkins@...
Subject: Re: SRAM

Andrew W wrote on 11/11/2004 13:18:00:

> 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:

\ 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

\ 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
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.



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
postmaster@...

This footnote also confirms that this email message has been checked
for all known viruses.

**********************************************************************
Sony Computer Entertainment Europe
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>