Manual - Beta Dos
Manual - Beta Dos
Manual - Beta Dos
– CONTENTS –
INTRODUCTION 1
CAT 2
FORMAT 3
SAVE OVER 3
SERIAL FILES 5
Creating a Serial File 5
Reading a Serial File 6
CLEAR # and Clearing Disc Errors 7
MOVE 7
POINT 9
Random-Access Functions:
File Pointer Function 11
File Length Function 11
End-of-File Function 12
Variable-Length Records 14
POINT with OVER option 14
SYSTEM VARIABLES 17
BACKUP UTILITY 18
COMPRESSION UTILITY 18
Amendments (added 1/7/2004 by spt)
Undocumented Commands 19
CAT 1”””” 19
Useful Poke @`s 19
This PDF was created to preserve the manual for the future.
4. When prompted, press any key to save Beta DOS onto the disc
you have ready, using the name "+sysBeta". The Spectrum
will then NEW itself. RUN to load Beta DOS. In future you
can load Beta DOS as you would G+DOS.
5. You might like to FORMAT some new discs using Beta DOS.
FORMAT gives you the option of creating a larger catalogue,
and the new disc format allows faster data transfer.
The program CANNOT be SAVEd directly from the PLUS D’s RAM
using e.g. SAVE "+sysBeta" CODE, unlike G+DOS.
*****************************************************************
This program tool; me a lot of work to write, and the price is
reasonable - please buy it, don't steal it!
ANDY WRIGHT
BETASOFT, 21 WHYCHE AVENUE, KINGS HEATH, BIRMINGHAM, B14 6LQ
- 2 -
CAT
The CAT command can now be used on its own to give a catalogue
of files on the current, drive. Simple CATs, Such as CAT or CAT
1! or CAT 2! will work much faster than before, and
automatically sort file names into alphabetical order. To be
precise, CAT sorts into order according to the ASCII code, so
e.g. "+" precedes numerals, which precede capitals,' which
precede lower-case letters. Because simple catalogues are
normally printed in 3 columns, you will get something like this
on the screen:
If you do not want a sorted catalogue, you can turn off the
alphabetic sorting without sacrificing the higher speed, using a
POKE explained in the "System Variables" section.
+sysBeta
Snap B
Prog1
prog2
prog3
squash
test
You might want to use e.g. POKE @126,6 when doing CAT #3;1! to a
printer able to print 60 or more characters per line. POKE
@126,3 to restore the normal 3-column output.
At the end of all CATs, you will see an indication of the number
of files in the catalogue, and the number of catalogue "slots"
still available for extra file names.
Note: The improved CAT requires enough free memory to store all
the possible file names temporarily, if this is not available,
the original G+DOS routine will be used instead, giving a
slower, unsorted catalogue and a "file count" of zero. A disc
with a 4-track catalogue holding up to 80 files needs 800 bytes
of free memory for a faster CAT.
- 3 -
FORMAT
The FORMAT command allows you to specify how many tracks are to
be used for the disc catalogue, and thus how many files the disc
will be able to hold. If you do not specify a value, the normal
4-trach catalogue is assumed. Each catalogue track holds 20 file
names. Some examples:
FORMAT dl
FORMAT dl,4 Both allow the normal 80 files and give 7B0K
of disc space free for files on an 800K disc.
Beta DOS can copy any file type, including 48K and 128K
Snapshots, OPENTYPE files and execute files. (If you have a
single-drive system, this may require multiple disc swaps.)
G+DOS overwrites important memory areas while copying, and has
to do a NEW even if it succeeds in copying a file, whereas Beta
DOS uses only free memory. This means that you might decide to
CLEAR a high value (e.g. 65000) and/or NEW if you are copying
files and wish to minimize disc swapping. The SAVE file TO file
command now also tells you the file name it is loading or saving
as copying proceeds - particularly useful when copying multiple
files using wildcards. For convenience, you can press ENTER as
well as SPACE when disc swapping, in response to "Insert TARGET
disc - press SPACE" or "Insert SOURCE disc - press SPACE".
When using two disc drives, SAVE dl"file name" TO d2"file name"
usually stops with drive two running continuously. I have not
been able to correct this problem: as with G+DOS, you need to
use drive two in order to stop it. CAT 2 is an easy method.
SAVE OVER
SAVE @1,10,1,16384,96
LOAD @1,0,1,35000,40
To create a serial file, you must first of all OPEN the file for
output, specifing a stream number and a file name, for example:
10 OPEN #4;dl"testfile"OUT
(Beta DOS allows you to use RND in place of OUT for greater
reliability - see the section "Some Differences From G+DOS".)
The disc operating system will check to see if "testfile"
already exists on drive 1, and ask you whether you want to
overwrite the old copy if It finds one. Stream 4 will be
assigned to the file, unless stream 4 is already in use. (You
can use any stream number from 4 to 15.) Prom now on, PRINT
commands qualified by "#4" will PRINT to the disc file, rather
than the screen. For example:
20 FOR n=l TO 50
30 PRINT n;" abcdefghi"
40 PRINT #4;n;" abcdefghi"
5B NEXT n
You can see what is being sent to the disc file because line 30
prints a copy to the screen. The file will contain 50 strings,
from "1 abcdefghi" to "50 abcdefghi". In many applications these
strings may be referred to as RECORDS.
60 CLOSE #*4
70 STOP
This writes the last buffer to the disc, and also creates an
entry in the disc catalogue. The type is shown as "OPENTYPE".
The "*" is very important! If it is omitted the line will be
accepted, but the computer will crash when the line is executed
because of a bug in the Spectrum ROM, and you will lose your
program.
- 6 –
The example above will show the file contents and then stop with
an "END o-f file" report. To close the file, you should type:
CLOSE #*4
the Spectrum actually sends "o", "n", "e", CHR$ 13, "t", "w",
"o", CHR$ 13 to a ROM routine that puts the normal letters on
the screen but RESPONDS TO the CHR$ 13s by printing on the next
line. Printing to a disc file is similar, but the CHR$ l3s are
actually stored on the disc, instead of being responded to. When
you come to INPUT from the file, the DOS reads characters from
whatever point it has got to in the file until it finds a CHR$
13. It then assigns these characters to the variable specified
in the INPUT command. (The CHR$ 13 itself is thrown away.)
90 CLOSE #*4
The last version will show up the CHR$ l3s explicitly. You can
create other files that contain "control codes" (which cause
actions) other than CHR$ 13. For example, the print comma which
tabulates screen output sends CHR$ 6s to a disc file, and INK,
PAPER, TAB etc. send special character sequences.
- 7 –
INPUT LINE
CLOSE #*
CLEAR # clears all open files, but without doing a CLOSE. This
makes no difference to IN files, but OUT files will be lost.
MOVE
"Testfile" must exist and "copyfile" should not, unless you want
to overwrite it. This is a fairly slow method of copying a file
and SAVE file TO file (which works with Serial files if you use
Beta DOS) is much faster for long files. However, MOVE is more
flexible. For example, if you had two files called "first" and
"second" you could create a single longer file that contained
copies of them both like this:
10 OPEN #5;dl"conibined"OUT
20 MOVE dl"first" TO #5
30 MOVE dl"second" TO #5
40 CLOSE #*5
You can also MOVE files, to stream 2, which is the main part of
The screen, stream 3,which is the printer, and random-access
files (see later).
- 8 -
Although serial files can be very useful they have major this
disadvantage that to locate a particular item in a file you
need to read all the previous items,. To alter an item you have
to read and rewrite the entire file. For some applications, this
can be very inconvenient, and the problem gets worse as the file
gets bigger. Beta DOS provides RANDOM ACCESS filing. This means
you can examine or change any part of a file without having to
load the whole thing. The normal OPENTYPE files are used, but
they are OPENed with the RND extension; e.g.:
Although you can OPEN any existing OPENTYPE file using RND,
explanations will be more straightforward if we create a simple
test file, as shown below. Those who hate typing will be pleased
to learn that the examples are included on their Beta DOS disc.
LOAD dl"prog1" now.
10 CLOSE #*4
20 OPEN #4;dl"test"RND
30 LET a$="abcdefghi"
40 FOR n=l to 200
50 LET a$( TO 3)=STR$ n
6B PRINT AT 10,10;a$
70 PRINT #4;a$
B0 NEXT n
90 CLOSE #*4
100 STOP
Just RUN to create the file on one of the blank discs you
formatted earlier. I have used the first 3 characters of each
string to store a record number so that we can easily check
which one we are looking at in our experiments. The file will
consist of 200 strings or records, from "1 defghi" to
"200defghi". Although the text of each string is 9 characters
long, each one will take up 10 characters of disc space because
they are terminated by carriage return characters (CHR$ 13s).
These strings are an example of FIXED-LENGTH records, and the
advantages of using this system will become apparent later.
25 DIM a$(99)
would ensure each string was 99 characters long and took 100
bytes of disc space. All this should be plain sailing if you
followed the discussion of serial files; if line 20 had ended in
OUT everything would have worked exactly the same way. The disc
file you have created is a normal OPENTYPE file.
-9-
The file pointer used by Beta DOS starts with a value of zero
Before the first character is read, so we can say that the first
character is at position zero in the file. Just before we read
the last character in the file, the pointer mil have a value 1
less than the file length. The file can be thought of as a
sequence of characters numbered from zero to (file length-1).
When the last character has been read, the pointer value will
equal the file length, Any further reads will give an
end-of-file error. The file pointer of a serial IN or OUT file
cannot be changed by the user; it simply increases automatically
during PRINT, INPUT and INKEY$. In contrast, Random-Access files
(OPENTYPE files OPENed using RND) allow the file pointer to be
freely altered using the POINT command.
POINT
POINT #stream,position
The file Pointer for the file associated with the specified
Stream is immediately moved to the specified position. (This
will often cause a new sector to be loaded from disc.)
Note: If you are using 48K mode and have forgotten how to type
POINT, it is Extended/sym-shift 8. The appearance of listings
can be improved by typing a space first, to get the indentation
right.
Notes: POINT with a value less than zero will give an "integer
out of range" error, and POINT with a value greater than the
file length will give an "END of file" error.
- 10 –
10 CLOSE #*4
20 OPEN #4;dl"test"RND
30 DIM a$(9)
40 PRINT "Read, Write or Exit? (R/W/E) "
50 LET c$=INKEY$
60 IF c$="W" OR c$="w" THEN GO SUB 100
70 IF c$="R" OR c$="r" THEN GO SUB 300
80 IF c$<>"E" AND c$<>"e" THEN GO TO 50
90 CLOSE #*4: STOP
I suggest you play with the program, reading and writing records
all over the file. (You might want to add a check to prevent the
use of record numbers greater than the number of records in the
file.) Enter a "record number" of 0 to stop writing or reading.
(In fact the write subroutine at line 100 can serve for reading
as well, since if you press ENTER when prompted for "New text?"
the record will not be altered.) Notice that POINT is used at
line 120 to set the file pointer for an INPUT, and then again at
line 190 for a PRINT to the same record, because the INPUT will
have moved the painter. When you are finished press "E" to exit
and CLOSE the file. The disc may or may not run, depending on
whether you have altered the current sector or not.
- 11 -
RANDOM-ACCESS FUNCTIONS
As well as being able to move the file pointer using POINT, Beta
DOS is able to read the current pointer position using a new
function, FN P. (LOAD dl"rafprog" now.) To use the function you
need to have a line like this somewhere in your programs
1 DEF FN p(x)=USR 8
(You can MERGE d1"line1" to obtain a line with all the new
function definitions in it.) FN p(stream) will tell you the
pointer position for a random-access file associated with the
specified stream; e.g.
10 OPEN #4;dl"test"RND
20 PRINT FN p(4);" ";
30 INPUT #4;a$: PRINT a$
40 GO TO 20
FN L - File LENGTH
Extending a Random-Access File
This will add some data to the end of our much-used "test" file,
printing the current file length as each string is added. If
line 140 had been omitted, the first part of the file would have
been overwritten by 10 "extended "s, because the file pointer
would have started at zero. The file length would have stayed
the same.
The file length is the maximum value you can use with POINT, so
if you want to extend a file, even with blank records, you must
POINT to the end and use PRINT # to increase the file size.
You may wonder why line 140 does not read: 140 POINT #4,FN L(4).
For technical reasons you cannot combine a Beta DOS or G+DOS
command with one of the new functions in a single statement. Use
a temporary variable to avoid this, like "length" in the example
above. Why do I keep using "L" instead of "l"? Because it saves
confusion with "1" in listings.
- 12 –
To use this function you need a line like this somewhere in your
program:
Our "test" file is fairly small and simple. A real example would
probably use longer records, with different parts of the records
dedicated to particular purposes. (These areas are called
"fields".) For example, if each record is created by PRINTing a
100-character string to the file, you might place data in a
record as shown below. (This partial program is not on your
disc.)
(You can also do a direct INPUT d$( TO 40) but the method above
is handier when you come to add error—trapping.)
Having read such a record from a file, you could display the
information like this;
STORING NUMBERS
VARIABLE-LENGTH RECORDS
will start from wherever the current file pointer is, and pass
over 10 carriage returns before setting a new pointer position.
So to point to the 2000th. record in a file, we could use:
This will point to the start of the file, and then pass OVER
1999 carriage returns. Although POINT will have to read the
first 1999 records in order to do this, it reads at about 22.5K
per second, so that for many files the time required is
insignificant. Besides, if you know what record you have just
INPUT, you often do not have to start at the beginning of the
file again. For example, if you have INPUTed record number 200B,
and want to INPUT record 2100 next, POINT #5, OVER 99 will work.
It is even possible to re-define the character POINT OVER
"passes over" as the program runs, using POKE @125, (character
code), so you can separate records by one character (say, CHR$
128) and fields by another, and use POINT OVER to find both the
record and the field you want, very quickly. To illustrate this,
the listing below creates a file of 1000 records, each
terminated by CHR$ 128 and containing 6 random-length fields
ending in CHR$ 13. The semi-colons at the end of lines 60 and 80
prevent carriage returns being sent to the file. You can load
the program from the Beta DOS disc using LOAD dl"prog3". RUN to
create the file. This will take some time, as the file will be
about 150K long. Go for a tea or coffee break!
10 CLOSE #*4
20 OPEN #4;dl "varifile" RND
30 FOR r=l TO 1000
40 PRINT AT 10,10;r
50 FOR f=1 TO 6
60 PRINT #4;"Record;";r;" Fields";f;
70 PRINT #4;" abcdefghijklrnn"( TO RND*14)
80 NEXT f: PRINT #4;CHR« 128;
90 NEXT r
100 CLOSE #*4
110 STOP
- 15 –
When you get back, the program below will let you read any
desired field and record from the files:
Our examples have only dealt with one file being open at a time,
but it is quite possible to have many files open at once in
random-access mode. However, if the files you are using involve
writing to a new file, or extending an old one, then all those
files must be on the same disc and disc drive. (Other files can
use the second drive.) This is similar to the way in which G+DOS
requires all OUT files to be on the same drive.
Open files take almost 800 bytes of RAM so you may run out of
memory when you try to do an OPEN.
There will be no error message if the file exists, and you might
overwrite a file without wanting to. You can check for this
possibility using the file Length function, FN L, which will be
zero if you have just OPENed a new file.
There will be no error message if the file does not exist, until
you try to INPUT from it. (This will give an "END of file"
report.)
This is because the prompt, and less obviously, the print comma,
both try to write to stream 4. When you are using a file OPENed
using RND, Beta DOS presumes you do not really want to write to
a disc file during an INPUT, and ignores any such attempts
without doing any writing.
10 DEF FN s(x)=USR 8
20 INPUT "address?";a
30 PRINT a;" ";FN s(a)
40 LET a=a+l: GO TO 30
SYSTEM VARIABLES
When "squash" has been loaded, any 48K or 128K snapshot you make
will be compressed before saving. With 48K snapshots there will
be brief screen corruption as compression occurs. The files
created in this way appear as normal SNAPSHOTS in the directory,
but of course the size will be less than the normal 97 or 258
sectors.
When you come to reload a compressed snapshot you must use a DOS
which has had "squash" added to it. Both compressed and
uncompressed snapshots can then be loaded, so you can load a
series of normal snapshots and re-SAVE them in compressed form.
You will see brief screen corruption as compressed 4BK snapshots
are loaded.
Undocumented Commands
POKE @3780,((8*paper)+ink)
Resets screen colour for CLS #.
POKE @23755-8192,65535
Merge proof loader. First line must be:-
1 REM
POKE @23757-8192,65535
Before you save makes first line 64K
long, gives Out of Memory error.
For more information about Beta Dos bugs fixer & bugs Fixed see: