RamFS Upgrade

By Robert Sprowson

Originally published in EUG #50

Instructions

This file describes the ROM image RAMFS which drives the RAM board connected via a 24 bit latched address bus to the 1MHz port.

The image requires at least one 16k bank of Sideways RAM, or to be put onto a ROM, to work.

At the prompt, type:

On A Master: *SRLOAD U.RAMFS 8000 (socket#)
*INSERT (socket#)
where socket# may be 7, 6, 5 or 4
 
On A Machine With SWRam:*LOAD U.RAMFS 8000

Then press CTRL-BREAK to initialise.

The image will then be installed into the chosen socket where it will wait until selected as the current filing system. To do this, you can either type *RAM (RETURN), press R-BREAK, issue a sideways ROM service call with FS id 23 or, only on the Master series, by the inclusion of "-RAM-" in the filename.

One page (256 bytes) of memory is claimed as private workspace above OSHWM in the BBC or in the hidden RAM on a Master. This contains pointers, etc, that RAMFS uses. It must not be tampered with.

Note that a hard or power on reset has the effect of 'formatting' the disk and all information will be lost.

Looking at performance, a BASIC program using BGETs/BPUTs/OSGbPb noted the following performance increases over DFS 1.20:

      Multiple 411 byte OSGbPb reads ................. x4.05 faster
      Multiple 10 byte BGet sequences ................ x1.32 faster
      Random setting of PTR then OSGbPb .............. x1.72 faster

Plus of course, there is no overhead for waiting to spin the disk up to speed.

Properties

Filenames can be up to ten letters long with a 1 letter directory name. There can be up to 127 files in the catalogue.

The media title can be up to 16 letters long.

The drive number must always be zero where drive numbers are requested.

File attributes are ignored. Attributes are read/writeable via the OSFile call though there is no *ACCESS command. By default access is set to local RW access.

The filing system id is 23 for RAMFS.

The 'cycle number' does not increment with each write to the RAM disk. Instead it is a 'number of files currently open' status byte, taking the value 0-3. Up to three files may be open at once for any mixture of input, output or random access. The SPOOL/EXEC files are not held open over a filing system change.

Supported OS Calls

OSArgs

Y=0 A=0(Read fs id)
Y=0 A=1 (Read address of *RUN parameters)
Y=0 A=255 (Update all files to media)
Y=handle A=0 (Read sequential pointer)
Y=handle A=1 (Write sequential pointer)
Y=handle A=2 (Read file length)
Y=handle A=255 (Update this file to media)

OSBGet
Y=handle, byte returned in A is valid only if C=0

OSBPut
Y=handle, A=byte to write

OSFile

A=0(Save a section of memory)
If this call fails due to lack of disk space and the filename given already existed, this results in the deletion of that file!
A=1(Write cat info)
A=2(Write load address for file)
A=3(Write exec address for file)
A=4(Write attributes for file)
A=5(Read cat info)
A=6(Delete named file)
A=255(Load named file,using stored/given address)

OSGbPb

A=1,2(Put bytes to media)
A=3,4(Get bytes from media)
A=5(Read media title and boot option)
A=6(Read device name and current dir)
A=7(Read device name and current lib)
A=8(Read names from current dir)

OSFind

A=0(Close file, or files)
A=&40(openin an existing file)
A=&80(openout a file,deleting the old if it already exists)
A=&C0(openup an existing file)

OSFSControl

A=0(Set option)
X=0,Y=0 (Reset default OPTions)
X=1,Y=0/1 (Turn off/on extended messages)
X=4,Y=0/1/2/3 (Set boot option)
A=1(test for EOF)
A=2/3/4(Run the given file)
A=5(Produce catalogue)
A=6(Shut down filing system)
A=7(Return handle range)
A=8(Command about to be executed)
A=9(Do a *EX)
A=10(Do a *INFO)

Additional OS Commands

   DIR :drive.directory (Set current directory)
   LIB :drive.directory (Set current library)
   TITLE  (Set media title)
   DRIVE  (Set drive number) 
   CLOSE (Close all files)
   DELETE  (Delete a single file)
   RENAME   (Rename the given file)
   EX  (Extract info about a dir - only on Master series)
   INFO  (Show info on the given file)
   WIPE  (Delete files, prompting for confirmation for each)
   DESTROY  (Delete files, prompting for confirmation of the batch)
   ENABLE (Skip warnings before 'dangerous' commands)

Exit Messages

Escapethe user aborted something waiting for his input
Outside filean attempt was made to move the file pointer past the end of the file
Cat fullno free slots could be found in the disk catalogue, despite there probably being space on the disk for the data itself
Can't extendfiles must be in one contiguous block on the disk, and the file is now too big for its allocated slot
Too many openonly 3 files may be open at once
Read onlythe file involved has only been opened for reading
Openthe file involved is already open
Existsan attempt to rename a file to one that exists was made
Disc fullthere is no free space left
Bad optiononly OPT0,OPT1,OPT4 are allowed
Bad namethe name given contained forbidden characters or was too long
Bad drivea drive number other than zero was used
Bad dirdirectories must be 1 valid letter long maximum
Not foundthe requested file was not present on the disk
Channela call was made with a handle which is either illegal or has already been closed

Known Problems/Future Enhancements

No *COPY (Unsure of which implementation to do) and therefore no *BACKUP
Tube processor acknowledged but ignored
No *ACCESS command as attributes are ignored at present
No other known problems

History

v0.65Initial release to show it works
v0.66OSFile A=4 or A=1 allows only the bottom byte of attributes to be written by the user now. (The other 3 bytes are FS dependant and reserved.)
v0.72If no hardware is found then no attempt will be made to format it on a hard reset (this previously caused the machine to pause for about 10 seconds) and *OPT1,0/*OPT1,1 implemented
v0.77OSFile A=255 left the <override> address in the user's parameter block instead of the stored load address if *LOAD <filename> <override> was used. Support for LIBs added to the *RUN handler.
v0.82Added wildcard handler and hence *INFO, *EX, *WIPE, *DESTROY too
v0.83RAMFS calls that print out information can now be used while *SPOOLing the OSbput routine preserves everything it uses. *WIPE and * DESTROY will no longer allow you to delete open files. Issuing a *CLOSE or *SHUT or swapping between filing systems will will close the SPOOL/EXEC files too.
v0.84Wildcard matching algorithm altered to search in a different order. Default attributes are set to 3 instead of 7 to ensure the file isn't executed only if moved to ADFS.
v0.85Reintroduced temporary filing system support for Master series, ensuring the correct FS is left selected at the finish.
v0.86Fixed bug in BBC B version to ensure workspace was claimed on soft resets.

Manual (C) 1998 Robert Sprowson
Software (C) 1998 SPROW