SET NO DOUBLE 
10 REM TERMINAL EMULATOR FOR PRO/BASIC V1.2 OR LATER USING COMMUNICATIONS PORT
20 REM 
30 ESC$=CHR$(27)\CLEAR$=ESC$+"[H"+ESC$+"[J"
40 BIGT$=ESC$+"#3"\BIGB$=ESC$+"#4"
50 SAVE$=ESC$+"7"\UP$=ESC$+"[3A"\REST$=ESC$+"8"
60 INT$=CHR$(171)
70 REM For better performance you can change the values of SPC, MAXLIN & BREAK$
80 SPC=12
90 BREAK$=CHR$(13)+ESC$+" "+CHR$(9)\BRLEN%=LEN(BREAK$)
100 MAXLIN=65
110 CTR=0
120 PRINT CLEAR$
130 PRINT BIGT$;" type ";INT$;" to send a control-C "
140 PRINT BIGB$;" type ";INT$;" to send a control-C "
150 OPEN 'XK:' AS FILE #1
160 LINPUT #1,A$
170 IF LEN(A$)=0 THEN 300
180 A=999
190 FOR LP%=1 TO BRLEN%
200 B=POS(A$,MID$(BREAK$,LP%,1%),SPC)
210 IF B<>0 AND B<A THEN A=B
220 NEXT LP%
230 IF CTR+LEN(MID$(A$,1,A))>MAXLIN THEN A=1\ GOTO 260
240 IF A=999 THEN PRINT A$;\CTR=CTR+LEN(A$)\ GOTO 300
250 PRINT MID$(A$,1,A-1);
260 PRINT SAVE$;UP$\ PRINT REST$;
270 PRINT MID$(A$,A,1);\A$=MID$(A$,A+1,LEN(A$))
280 CTR=0
290 GOTO 170
300 CALL INKEY (A$)
310 IF LEN(A$)=0 THEN 160
320 IF A$=INT$ THEN A$=CHR$(3)
330 IF ASCII(A$)=155 THEN A$=CHR$(27)
340 IF ASCII(A$)=143 THEN A$=CHR$(27)+'['
350 PRINT #1,A$
360 GOTO 300
370 END 
