80-Bus News

  

May–June 1983 · Volume 2 · Issue 3

Page 16 of 59

[Ed. – My version of MBASIC works differently, in the form of:
SAVE "<[disk drive name:]filename>",[protect or ASCII option]
So SAVE "B:FRED",A means save file FRED to drive B: in ASCII format. This format also holds true for LOAD, KILL, OPEN, NAME – AS, MERGE and CHAIN.]

KILL:

This command erases a specified file from disk; if the file does not exist, an error message is output as is also the case if an attempt is made to erase a file which is in use. The format of the KILL command is:

KILL "<filename>".

NAME:

Renaming of files is achieved by the use of the NAME command which has the following form:

NAME "<old filename>" AS "<new filename>"

If the proposed new file name already exists, an appropriate error message is printed.

MERGE:

The MERGE command is used when it is desired to put part or all of two programs together to form a new program. It should be used with care since the results of merging two programs can be unpredictable (or just plain messy!). It has the following form:

MERGE "<filename>"

The effect of this command is to load <filename> into the program already in RAM. Where the loaded program and the original program have identical line numbers, the loaded line numbers replace the existing line numbers. The file name to be loaded must specify an ASCII format saved program, otherwise a ‘BAD FILE MODE ERROR’ will occur.

FILES:

This command is used to print out the names of ALL files, regardless of type, on the current disk. It is equivalent to the ‘CAT’ or ‘Catalog’ commands in mainframe BASICS, and to the ‘DIR’ command when at disk operating system level.

Naming of files:

In MBASIC, all program and data files have a filename. This is a ‘string’ expression between 1 and 8 characters in length; the first character must not be a null (0) or a byte of 255 (dec.). The format of a filename permits the addition of an extension, which can be used to convey further information about the file. The usual way of naming files is to give the filename, followed by a full stop and a 3 character extension. Thus FUNNYONE is a valid filename and so are FUNNYONE.BAS, FUNNYONE.DAT or FUNNYONE.123 but 0FUNNY is invalid because it has a ‘0’ as its first character. As a matter of sensible programming technique, it is wise to’ name BASIC program files with <filename.ext>, e.g. COUNTER.BAS for the program or COUNTER.DAT if it is a data file. Note that, then loading a BASIC program file with ‘LOAD’, inclusion of the .BAS extension is optional, although it might be wise to include it if you have, for example, a data file as well as a program file under the same filename. The same holds true when SAVEing a program. File names can consist totally of numbers, or have some non-alphanumeric characters – 13579081.BAS is allowed, as is FILE$$1 or PROG£2. Filenames in lower ease are the same as their equivalents in upper case – SHEAR and shear , for example.

[Ed. – Careful!!! If given a lower case file name, MBASIC will save and load it as such. However, if say an ASCII file were saved with a lower case file name for the purpose of loading into an editor for instance, then CP/M would not be able to find it as all CP/M command line input is converted to upper case automatically.]

Page 16 of 59