Now onto XBASIC. For sixty odd quid you get a disk with the ordinary
interpreter plus the GXBASIC, the graphics version for the AVC. With AVCTXT
sitting at the top of ram to give the 80 column screen (55K System size), the
former gives you 35122 bytes of ram, the latter only 27105 bytes ! I won’t
retramp the areas covered by Roger Dowling, just get straight into the disk
handling stuff. Well, it’s really a bit of a mess, but somehow Lucas Logic
came out with some twists to almost make up for it. I think they’ve gone down
the road of – wait for it – BBC BASIC (sorry, quick, drink a glass of water,
or something a bit stonger). I’ve used MBASIC on a Superbrain and it was quite
nice. XBASIC lost me three days figuring out how to use the random access
files without screwing up. The relevant commands are –
DRIVE <letter> – selects which drive to be logged in, -A’ is drive 0.
CREATE <F>,<SV>,<I> – creates a file with name ‘F’, -SV’ sets up buffer space
and system variables, -I determines how long the random record length
is. The range of -I’ is 0-65535. If -I” is not specified or 0, then the
file is deemed for sequential access only. Any existing file with the
same name is first deleted and an empty one then created.
OPEN <F>,<SV>,<I> – this is the same as for CREATE, If the file doesn’t exist
then you get a -No File error’.
CLOSE <SVl..n> – closes the named files. CLOSE alone will close ALL open
APPEND <F>,<SV> – this is useful for sticking data onto the end of sequential
files without having to read to the end first, so saving a lot of time.
It doesn’t work with random files as you can specify which record you
want to go to any way.
Now comes the daft bit, or B**b method. To get data in and out of files you
have to direct the computer with the following –
PRINT £ <SV>,<I>;<variable(s)> – the variable(s) are output to the opened file
with system variable name -SV*. ANY output from now on until otherwise
redefined will go to that file. So if you forget the drive purrs away
quite oblivious to the fact that it’s just ruined an evenings work.
INPUT £ <SV>,<I>;<variable(s)> – this is the opposite of PRINT £ (why they
couldn’t have used DISCIN and DISCOUT or similar is beyond my logical
brain). Like PRINT £ if you forget to redefine the input you get one hell
of a mess. To redefine you can CLOSE <SV>, or do another PRINT £ <SV>,<I>
(or INPUT £ <SV>,<I>) or PRINT £0 (or INPUT £0) so that the file(s)
remain open. To backtrack a bit, the “SV” has to be a string variable and
Lucas Logic claim it to be a wonderful idea as you can have lots of files
open at the same time and because it’s a string variable, when not in use
the memory is a available for use by something else. Sounds good doesn’t
it ? So, what took me three days to work out ? Well, for one thing I had
to learn to redefine the output and input. Secondly, when using random
files the record length is not what you tell the computer. The manual
doesn’t make it clear that the end of record marker (two bytes) is
INCLUDED in the record length. So if you specify a record length of 50
bytes and output 50 bytes, two bytes are stuck on the end. When you then
input the file you run out of string space as the whole file is dragged