Date : Sat, 30 Apr 2011 19:24:04 +0100
From : jgh@... (J.G.Harston)
Subject: *LOAD/*SAVE shadow screen
On the BBC Master shadow screen memory can be saved and loaded
at FFFExxxx, eg *SAVE scrn FFFE3000+5000 to save a MODE 128
screen. Documentation and common sense suggests that this works
on all Master filing systems, but testing shows that this is
not the case for DFS.
A quick test shows:
> MODE 128:!&3000=-1
> *SAVE FFFF FFFF3000+8
> *SAVE FFFE FFFE3000+8
> *DUMP FFFF
000000 FF FF FF FF 0C 18 30 00 ......0.
> *DUMP FFFE
000000 FF FF FF FF 0C 18 30 00 ......0.
indicating that both SAVEs saved main memory, the -1 poked in at &3000.
However, doing:
> OSCLI"FX108,1":OSCLI"SAVE FFFE FFFE3000+8":*FX108
> *DUMP FFFE
000000 30 18 0C 06 0C 18 30 00 ......0.
shows that screen memory has been saved.
So, enclosing the save command in *FX108,1 and *FX108 will ensure
that screen memory is saved. Also, using FFFExxxx will ensure
that compliant filing systems will save the screen memory where
they support it natively.
If running in the I/O processor, you must make sure the calls to
FX108/SAVE/FX108 are below &3000 in memory, otherwise the program
code will get paged out as the screen is paged in! The easiest way
to ensure this in a BASIC program is to make it a subroutine near
the start of the program. Also, you will have to ensure the error
handler restores the memory paging by including *FX108, as otherwise
if the SAVE command causes an error (eg disk full, etc), the screen
will be left paged in.
Also, if you make calls to OSBYTE instead of using *FX then on
systems without shadow memory the calls will be transparently
ignored.
DEFPROCscnsave(A$)
A%=FNfx(108,1):OSCLI "SAVE "+A$+" FFFE3000+5000":A%=FNfx(108,0)
ENDPROC
:
DEFFNfx(A%,X%):LOCAL Y%:Y%=X%DIV256:=((USR&FFF4)AND&FFFF00)DIV256
:
DEFFNerr:A%=FNfx(108,0)
REM Continue error handler
--
J.G.Harston - jgh@...