FDC-1 XBAS
==========
This lets you use the FDC-1 from BASIC. The only catch is a very messy-looking LINE 0, using up 91 bytes.

Commands may be entered on the command line or from within a program. Note that the commands sent to the FDC-1 are case-sensitive, as always.

If XBAS is on tape, first load it in, then save it to a formatted disk by typing:
PRINT FN d("SAVE $XBAS")

Make sure that the printed number is 0, otherwise there has been an error.

To start it from DOS, type:
$XBAS

This will take you to BASIC with the aforementioned LINE 0 included.

Examples:
PRINT FN d("DIR")			; Does a DIR and prints the status/error number
LET err=FN d("SAVE SCR 4000 5AFF")	; Saves a screen (called SCR) and returns the status/error in err
LET err=FN d("LOAD SCR")		; Loads SCR
LET err=FN d("LOAD SCR"+STR $x)		; Loads SCR0, SCR1, SCR2, etc. depending on the value of x
RANDOMIZE FN d("GAME")			; Loads (and executes) a file called GAME
PRINT FN d("ERA DATA")			; Erases a file called DATA
PRINT FN d("LOAD $FILE")		; Loads a BASIC file called FILE
PRINT FN d("$FILE")			; Loads (and RUNs) a BASIC file called FILE
PRINT FN d("MERG $FILE")		; Merges a BASIC file called FILE
PRINT FN d("REN OLD NEW")		; Rename a filename from OLD to NEW
PRINT FN d("B:")			; Change default drive to B

Note that loading a BASIC file will overwrite LINE 0. You may wish to use MERG to merge a BASIC file instead. As long as it does not have a LINE 0, then XBAS will remain in the listing. In some cases, it may be simpler to load in the other BASIC program, break into it, modify it a little, then go to DOS ("RANDOMIZE USR 64512"), merge XBAS into the BASIC file "MERG $XBAS", then return to BASIC ("BAS").

NOTE: To access DOS commands from within a BASIC program, it must include this line.


If your BASIC program already uses FN d(), then you can change the FN used. For example, to change it to use FN z :

POKE PEEK 23635 + 256 * PEEK 23636 + 5, CODE "z"

From then on, all the commands will respond to FN z("...") instead. You can use any letter from "a" to "z".

Error numbers:
0 = No error
1 = No files (and, effectively, unrecognised command)
2 = File exists
3 = No space
(There is no error 4!)
5 = Record number overflow (something from LOAD/MERGE?)
6 = User protected
7 = Disc error/Write protected

Error 1 is also shown when doing a DIR and the directory is empty. In this case it isn't an error, although it looks like one.
