REM > BBC2Arc REM This program is Copyright 1994 Denis Howe. You may REM distribute verbatim or modified copies of this program REM provided each such copy is distributed with a copyright REM notice and distribution conditions identical to these. REM Please send me a copy of any changes you REM make and add the details to the list below. REM Denis Howe REM 48 Anson Road, London, NW2 3UU REM +44 (181) 450 9448 REM Copy files from a BBC micro to an REM Archimedes via the serial (RS423) ports. REM 0.00 04 Apr 1990 DBH REM 0.01 06 Oct 1994 DBH REM Serial connections (sockets viewed from outside): REM REM 1--+ REM | REM 2----- RxD --------- TxD ---- B Top REM | REM 1 2 3 4 5 3----- TxD --------- RxD ---- A E A REM o o o o o | o o REM o o o o 4--+ DTR o C REM 6 7 8 9 | o o REM 5----- Gnd --------- Gnd ---- C D B REM | REM Arc 6----- CTS --------- RTS ---- E BBC REM socket | socket REM 7----- RTS --------- CTS ---- D REM | REM 8--+ REM | REM 9--+ DCD REM OS_Byte I/O args In = 2 Out = 3 ToSerial = 7 ToScreen = 4 FromSerial = 1 FromKeyboard = 0 REM Set Arc to BBC default = 8 bits, 1 stop bit SYS "OS_Byte",156,20 Q$=CHR$34 CLOSE #0 ON ERROR PROCError WHILE FNFile:ENDWHILE END DEF FNFile INPUT "BBC file name ";FILE$ IF FILE$="" THEN=FALSE EXIST=OPENIN(FILE$) IF EXIST THEN CLOSE #EXIST PRINT "Overwrite existing ";FILE$;" ?"; IF GET$<>"Y" =TRUE PRINT ENDIF SYS "OS_Byte",In,FromSerial REPEAT UNTIL INKEY(100)<0 :REM flush input REM Enable Serial output only from BBC REM See what comes back from BBC PROCBBC("*FX3 7") PROCBBC("CLOSE#0:F=OPENIN"+Q$+FILE$+Q$+":*INFO "+FILE$) REM Read length, load ad., exec ad. of BBC file INPUT LINE INF$:Z=GET LO$=MID$(INF$,15,6) EX$=MID$(INF$,22,6) LE$=MID$(INF$,29,6) FLEN=EVAL("&"+LE$) REM Output file from BBC PROCBBC("REPEAT VDU BGET#F:UNTIL EOF#F") DIM BUF FLEN FOR P=BUF TO BUF+FLEN-1 :REM Copy from Serial to Arc buffer ?P=GET NEXT SYS "OS_Byte",In,FromKeyboard REM Save buffer to Arc file OSCLI "Save "+FILE$+" "+STR$~BUF+"+"+LE$+" "+EX$+" "+LO$ OSCLI "FileInfo "+FILE$ =TRUE REM Send a line to the BBC and read back echo DEF PROCBBC(C$) LOCAL G SYS "OS_Byte",Out,ToSerial PRINT C$;:VDU 13 SYS "OS_Byte",Out,ToScreen REM Read all Serial input G=INKEY(100) IF G<0 ERROR -1, "Please type *FX2 1 on BBC and try again" WHILE G>=0 AND G<>13:G=INKEY(100):ENDWHILE ENDPROC DEF PROCError SYS "OS_Byte",In,FromKeyboard SYS "OS_Byte",Out,ToScreen REPORT:IF ERR>=0 PRINT " at ";ERL END