From 100425.3256@compuserve.comMon Mar 18 13:58:29 1996 Date: 15 Mar 96 15:42:33 EST From: Bruce Murray <100425.3256@compuserve.com> To: "M. Ray" Subject: NC100/200 uudecoder Please find in this file a BBC Basic implementation of a simple UUdecoder. It will decode a single UUencoded file and write an output file as named in the "begin" line of the .uue file. It parses the input file for the string "begin" at the beginning of a line, and so is tolerant to accompanying text in the input (provided it does not have any lines starting with a spurious "begin"). It expects to find an 8.3 format output filename (less than 8 chars is permitted). It was written and tested on an NC200, but I'm pretty sure it will run on an NC100 as well. You may wish to make this available for download from your Web/FTP site. It has been tested with the gnu test data file supplied with the gnu uuen/decode implementation, and also some other (larger) files. The output has been compared with that derived from PC-based decoders and appears to match. I place no restrictions on copying or use, except that it should not be sold for profit (in any case, I would think it unlikely anyone could charge anything for such a simple program). Bruce Murray (Southampton UK) ********************************************************************************* ****************************** 1 REM uudecoder for Amstrad NC200/100/other BBC Basic machines 2 REM (C) Bruce Murray 10 CLS 20 INPUT "filename to uudecode....."fin$ 25 PRINT' 30 OSCLI("EXEC "+fin$) 40 REPEAT 50 INPUT LINE A$ 60 B%=INSTR(A$,"begin") 70 UNTIL B%=1 80 : 90 B%=B%+4:REM parse past "begin" 100 REPEAT B%=B%+1:ch$=MID$(A$,B%,1):UNTIL ch$<>" " 110 : 120 B%=B%+2:REM parse past 3 digit octal protection code 130 REPEAT B%=B%+1:ch$=MID$(A$,B%,1):UNTIL ch$<>" " 140 : 150 F%=B%:REM latch pointer to first char of filename 160 REPEAT B%=B%+1:ch$=MID$(A$,B%,1):UNTIL ch$="." 170 : 180 outfile$=MID$(A$,F%,B%+4-F%) 190 fout%=OPENOUT(outfile$) 200 : 210 REPEAT 220 INPUT LINE A$:IF INSTR(A$,"end")<>0 THEN UNTIL TRUE:PROCfinish:END 230 bytes%=(ASC(LEFT$(A$,1))-32) AND &3F:IF bytes%=0 THEN UNTIL FALSE 240 : 250 P%=1 260 : 270 REM four byte "loop" starts here 280 BIN%=0 290 FOR J%=1 TO 4 300 P%=P%+1 310 BIN%=64*BIN%+((ASC(MID$(A$,P%,1))-32)AND &3F) 320 NEXT J% 330 : 340 BPUT#fout%,(BIN% AND &FF0000)DIV&10000:bytes%=bytes%-1:IF bytes%=0 THEN GOTO 380 350 BPUT#fout%,(BIN% AND &00FF00)DIV&100:bytes%=bytes%-1:IF bytes%=0 THEN GOTO 380 360 BPUT#fout%,BIN% AND &0000FF:bytes%=bytes%-1:IF bytes%=0 THEN GOTO 380 370 GOTO 280 380 REM four byte loop ends here 390 : 400 UNTIL FALSE 410 END 420 DEFPROCfinish 425 PRINT' 430 PRINT EXT#fout%;" bytes written to file ";outfile$ 440 CLOSE#fout% 450 ENDPROC