11 ZTEMP$=INKEY$:ZRANDOM=(ZRANDOM MOD 2000)+1:IF LEN(ZTEMP$)=0 THEN 11'Wait for Char
12 IF ASC(ZTEMP$)=127 OR ASC(ZTEMP$)=8 THEN 17 ELSE IF ASC(ZTEMP$)=21 THEN PRINT ZREST$+ZBACKER$;:ZLENGTH=ZORGL:GOTO 10 ELSE PRINT ZTEMP$;'RUBOUT
13 IF ASC(ZTEMP$)=3 THEN GOTO 9999 ELSE IF ZTEMP$ >= "a" THEN ZTEMP$=CHR$(ASC(ZTEMP$)-32)'Uppercase Modify GOTO xx to Control-C intercept <=====================
14 IF ASC(ZTEMP$)=13 THEN PRINT:GOTO 16'RETURN finishes
15 ZSTRING$=ZSTRING$+ZTEMP$:ZLENGTH=ZLENGTH-1:IF ZLENGTH >0 THEN 11
17 IF LEN(ZSTRING$)>0 THEN ZLENGTH=ZLENGTH +1:ZSTRING$=LEFT$(ZSTRING$,(LEN(ZSTRING$)-1)):PRINT ZRUBOUT$;:GOTO 11 ELSE PRINT ZBELL$;: GOTO 11'Cleanup after RUBOUT
18 'End of VT100 definitions *****
19 'Use this BASIC program on the CP/M side of the Rainbow (with
20 'Microsoft MBasic-86) to translate the MSRB100.BOO file on
21 'your CP/M disk to binary .EXE format, then from the MS-DOS
22 'side use RDCPM to transfer the result to the MS-DOS file
23 'system. This program takes about 30 minutes to run on a Rainbow
24 'with floppy disks.
25 '- Bill Catchings, CU; modified for Rainbow by Bernie Eiben, DEC.
26 PRINT ZHOME$+ZCLEAR$;"Rainbow 4for3 Code Expander Version 1"
30 PRINT:PRINT: N$ = CHR$(0)
40 Z = ASC("0")
50 T = ASC("~")-Z
60 DEF FNUCHR%(A$)=ASC(A$)-Z
61 PRINT "FILE-NAME to Expand : ";:ZLENGTH=13:GOSUB 10:'Get Input
70 OPEN "I",1,ZSTRING$
100 INPUT#1,F$ ' Is this the right file?
110 IF LEN(F$) > 20 THEN GOTO 900
120 OPEN "O",2,F$ ' Ouput-name from file
130 PRINT "Outputting to "+F$
200 IF EOF(1) THEN GOTO 800 ' Exit nicely on end of file.
210 INPUT#1,X$ ' Get a line.
220 Y$ = "" ' Clear the output buffer.
230 GOTO 400
300 PRINT#2,Y$; ' Print output buffer to file.
310 GOTO 200 ' Get another line.
400 IF LEN(X$) < 2 GOTO 300 ' Input buffer empty? (* 6 Feb 85 *)
410 A = FNUCHR%(X$)
420 IF A = T THEN GOTO 700 ' Null repeat character?
425 IF LEN(X$) < 3 GOTO 300 ' (* 6 Feb 85 *)
430 Q$=MID$(X$,2,3) ' Get the quadruplet to decode.
440 X$=MID$(X$,5)
450 B = FNUCHR%(Q$)
460 Q$ = MID$(Q$,2)
470 C = FNUCHR%(Q$)
480 Q$ = MID$(Q$,2)
490 D = FNUCHR%(Q$)
500 Y$ = Y$ + CHR$(((A * 4) + (B \ 16)) AND 255) ' Decode the quad.
510 Y$ = Y$ + CHR$(((B * 16) + (C \ 4)) AND 255)
520 Y$ = Y$ + CHR$(((C * 64) + D) AND 255)
530 GOTO 400 ' Get another quad.
700 X$ = MID$(X$,2) ' Expand the nulls.
710 R = FNUCHR%(X$) ' Get the number of nulls.
715 PRINT FNXY$(6,5)+ZCLRLIN$;" Null: ",R
720 X$ = MID$(X$,2)
730 FOR I=1 TO R ' Loop, adding nulls to string.
740 Y$ = Y$ + N$
750 NEXT
760 PRINT#2,Y$; ' Output the nulls to the file.
770 Y$ = "" ' Clear the output buffer.
780 GOTO 400
800 PRINT "Processing complete"
810 PRINT "Output in "+F$
820 CLOSE #1,#2
830 GOTO 9999
900 PRINT "?The FORMAT of the ",ZSTRING$," file is incorrect"