Spectrum Serial Server ====================== Brief Notes The Serial Server runs on a BBC connected to a Spectrum via the serial ports. The Spectrum sends commands to the BBC via the serial port, optionally followed by a LOAD or SAVE command. At the Spectrum end, at some point, open the serial port and attach it to a channel, eg: OPEN#9,"b" Commands are issued along the lines of, (in pseudocode): PRINT #9;CHR$(command)+filename$ :REM Send command INPUT #9;reply$ :REM Get reply IF reply$<>"" THEN errnum=CODE(reply$):errstr$=reply$(2 TO) IF reply$="" THEN perform any extra actions Supported commands are: C Catalog D Change Directory E Erase H Help I Info L Load M Make Directory R Rename S Save X Exit (C)at, (H)elp and (I)nfo are replied to with strings of text to print, terminated with a null string. (L)oad is followed by LOAD *b (S)ave is followed by SAVE *b Examples: Catalog, Help ------------- PRINT #9;"C":INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) PRINT #9;"H":INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) Info, Directory, Erase, MkDir ----------------------------- PRINT #9;"I"+f$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) PRINT #9;"D"+f$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) PRINT #9;"E"+f$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) PRINT #9;"M"+f$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) Rename ------ PRINT #9;"R"+o$+" "+n$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) Load ---- xxxx PRINT #9;"L"+f$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) yyyy IF a$="" THEN LOAD *b/LOAD *b CODE/etc Save ---- xxxx PRINT #9;"S"+f$:INPUT #9;a$:IF a$<>"" THEN PRINT a$(2 TO) yyyy IF a$="" THEN SAVE *b/SAVE *b CODE/etc:RETURN The filename passed to Save can include file addresses in decimal, for example: LET f$=fn$+" "+STR$load+" "+STR$exec+" "+STR$auto+" "+STR$type See also http://mdfs.net/Info/Comp/Spectrum/ProgTips/device.htm for packaged subroutines.