125 DIM ALT$(10),K$(40),SCR.DN(16),SCR.CLR(27),SCR.UP(14),GRAF(33),PARAM(10) 135 BS$=CHR$(8):LF$=CHR$(10):CR$=CHR$(13):ESC$=CHR$(27):ESC=0:WTH=-1:ANSI=-1:LED$=CHR$(27) 140 RCV$="":TRN$="":DIAL$="":STRT$="":SAV$="":GO$="===Proceed..." 170 RESTORE 172:FOR I=1 TO 16:READ SCR.DN(I):NEXT ' Reverse Index routine 172 DATA &H5152,&H5053,&H00B7,&H08B4,&H10CD,&HE788,&H00B9,&HBA00,&H174F,&H01B8,&HCD07,&H5810,&H595B,&HCB5A,&H05CD,&HCBCB 174 FOR I=1 TO 27:READ SCR.CLR(I):NEXT ' Screen clearing routines 176 DATA &H00B0,&H5152,&H5053,&H00B7,&H03B4,&H10CD,&H08B4,&H10CD,&HC389,&HD189,&H4FB2,&H00B8,&HCD06,&H5810,&H003C,&H0875,&H595B,&HCB5A,&HFFB0,&HDAEB,&HC5FE,&H00B1,&H17B6,&H00B8,&HCD06,&HEB10,&HCBEB 180 FOR I=1 TO 14:SCR.UP(I)=SCR.DN(I):NEXT:SCR.UP(11)=&HCD06 'Index routine 182 FOR I=1 TO 33:READ GRAF(I):NEXT ' Pseudo-graphics characters 184 DATA 32,4,177,26,21,27,25,248,241,23,18,217,191,218,192,197,223,205,196,22,220,195,180,193,194,179,243,242,227,247,156,250,32 210 DFNUM=30:DIM DP$(30), D$(30), DT$(30) 560 IF NOT EOF(1) THEN GOSUB 605 565 GOTO 515 640 FOR I=1 TO LEN(A$):C$=MID$(A$,I,1):IF ESC THEN GOSUB 12000:GOTO 655 645 IF C$=CR$ THEN LOCATE ,1:GOTO 655 ELSE IF C$=LF$ THEN GOSUB 12085:GOTO 655 ELSE IF C$=BS$ THEN GOSUB 2650:GOTO 655 ELSE IF C$=ESC$ AND ANSI<>0 THEN ESC=-1:GOTO 655 650 IF GRAPHICS THEN IF C$<"_" THEN PRINT C$; ELSE PRINT CHR$(GRAF(ASC(C$)-94)); ELSE PRINT C$; 655 NEXT 710 B$=INKEY$:IF B$<>"" THEN RETURN 525 730 RETURN 1245 NEXT:IF EXIT THEN EXIT=0:LOCATE ROW,COL:GOTO 560 1520 IF EX=72 THEN B$=LED$+"A":GOTO 535 ELSE IF EX=75 THEN B$=LED$+"D":GOTO 535 1525 IF EX=77 THEN B$=LED$+"C":GOTO 535 ELSE IF EX=80 THEN B$=LED$+"B":GOTO 535 1530 IF EX=71 THEN 2000 ELSE IF EX=83 THEN B$=CHR$(127):GOTO 535 1540 IF EX=47 THEN 3400 ELSE IF EX=24 THEN GOSUB 12140:GOTO 515 1610 IF EX=114 OR EX=132 THEN BEEP:PRINT:IF PR=0 THEN GOSUB 12225:GOTO 515 ELSE GOSUB 12230:GOSUB 2715:GOTO 515 1680 IF EX=30 THEN IF WTH THEN GOSUB 12165:GOTO 515 ELSE GOSUB 12170:GOTO 515 1685 1995 GOTO 515 ' DON'T remove this line! (failsafe to return to terminal) 2007 IF NOT WTH THEN GOSUB 12170:GOSUB 2800 2130 DATA" Alt-W = Margin bell Alt-A = Width" 3035 RC=-1:IF RC$="X" THEN 4500 ELSE 560 4035 PRINT#1,Y$;:IF TR$="B" OR NOT ECH THEN 4050 4050 GOSUB 605:ROW=CSRLIN:COL=POS(0):GOSUB 4070:B$=INKEY$:IF B$="" THEN 4060 5208 IF NOT WTH THEN GOSUB 12170 5435 DATA Comm. port,"COM1:",Comm. init.,",CS,DS",Modem init.,,C/R subst.,"}",Term. type,TTY 5680 IF D$(30)="TTY" OR D$(30)="NONE" THEN ANSI=0 ELSE IF D$(30)="ANSI" OR D$(30)="VT100" THEN ANSI=1 ELSE ANSI=-1 5685 GOSUB 5815:RETURN 9015 IF ERL=225 THEN IF I=30 THEN DP$(30)="Term. type":D$(30)="TTY":GOSUB 5440:RESUME 300 ELSE RESUME 245 12000 ' Cursor Control VT52 (VIDTEX) or VT100 (ANSI) 12005 IF ANSI>0 THEN 12025 ELSE 12010 12010 ESC=0:P=INSTR("CDABFGHIJKWXYZ<=>\]^_jlmrtuvwxy",C$):IF P THEN 12015 ELSE 12055 ' VT52 (Visual 200 or VIDTEX) 12015 ON P GOTO 12100,12100,12100,12100,12155,12160,12090,12220,12210,12190,12020,12230,12120,12240,12135,12145,12150,12020,12235,12225,12230,12180,12170,12165,12175,12195,12180,12180,12180,12190,12180 12020 RETURN ' Function not implemented yet 12025 IF BRAK THEN 12030 ELSE IF PARA THEN 12065 ELSE IF C$="[" THEN 12080 ELSE IF C$="(" OR C$=")" THEN 12060 ELSE P=INSTR("=>78DEMZc",C$):IF P THEN 12070 ELSE 12055 ' VT100 (ANSI) Terminal 12030 P=INSTR("CDABHJKfhilmn",C$):IF P THEN BRAK=0:ESC=0:IF SAV$="" THEN SAV=1:PARAM(1)=0:PARAM(2)=0:GOTO 12050 ELSE 12040 12035 P=INSTR("?0123456789;",C$):IF P THEN SAV$=SAV$+C$:RETURN ELSE 12055 12040 SAV=1:PARAM(1)=0:FOR J=1 TO LEN(SAV$):IF MID$(SAV$,J,1)=";" THEN SAV=SAV+1:PARAM(SAV)=0 ELSE IF C$="?" THEN 12045 ELSE PARAM(SAV)=PARAM(SAV)*10+VAL(C$) 12045 NEXT:SAV$="" 12050 ON P GOTO 12095,12095,12095,12095,12105,12255,12250,12105,12020,12265,12270,12280,12260 12055 PRINT SAV$;C$;:SAV$="":ESC=0:BRAK=0:RETURN 12060 PARA=-1:RETURN 12065 ESC=0:PARA=0:P=INSTR("012AB",C$):IF P THEN ON P GOTO 12155,12020,12020,12160,12160 ELSE 12055 12070 ESC=0:ON P GOTO 12145,12150,12020,12020,12085,12075,12220,12245,12020 12075 LOCATE ,1:GOTO 12085 12080 BRAK=-1:RETURN 12085 GOSUB 12185:IF ROW<24 THEN LOCATE ROW+1,COL,1:RETURN ELSE P=VARPTR(SCR.UP(1)):CALL P:GOTO 12205 ' Index cursor with scroll 12090 LOCATE 1,1,1:RETURN ' Move cursor to Home 12095 IF PARAM(1)=0 THEN 12100 ELSE PRINT STRING$(PARAM(1),P+27);:RETURN 12100 PRINT CHR$(P+27);:RETURN ' Move cursor right,left,up,down 12105 P=40-40*WTH:ROW=PARAM(1):PARAM(1)=0:IF ROW=0 THEN ROW=1 'ANSI H or f codes 12110 COL=PARAM(2):PARAM(2)=0:IF COL=0 THEN COL=1 12115 IF ROW>24 OR ROW<1 OR COL>P OR COL<1 THEN RETURN ELSE 12205 12120 P=40-40*WTH:IF LEN(A$)24 OR ROW<1 OR COL>P OR COL<1 THEN PRINT MID$(A$,I-2,2);:RETURN ELSE 12205 ' Position cursor with error checking for VT52 12130 ANSI=-1:LED$=ESC$:RETURN ' Change to VT52 (VIDTEX) mode 12135 ANSI= 1:LED$=ESC$+"[":RETURN ' Change to VT100 (ANSI) mode 12140 IF ANSI=0 THEN 12135 ELSE IF ANSI=1 THEN 12130 ELSE ANSI=0:LED$="":RETURN 12145 KEYPAD=-1:RETURN ' Enable Keypad codes 12150 KEYPAD= 0:RETURN ' Disable Keypad codes 12155 GRAPHICS=-1:RETURN ' Enable Character graphics 12160 GRAPHICS= 0:RETURN ' Disable Character graphics 12165 WIDTH 40:COLOR FG,BG,BG:CLS:WTH=0:SCR.CLR(11)=&H27B2:SCR.UP(9)=&H1727:SCR.DN(9)=&H1727:RETURN ' Set to 40 Width 12170 WIDTH 80:COLOR FG,BG,BG:CLS:WTH=-1:GOSUB 2800:SCR.CLR(11)=&H4FB2:SCR.UP(9)=&H174F:SCR.DN(9)=&H174F:RETURN ' Set to 80 Width 12175 GOSUB 12185:PRINT#1,STR$(ROW+31);STR$(COL+31);:RETURN 12180 LOCATE 1,1:GOTO 12210 ' Clear screen and Home cursor 12185 ROW=CSRLIN:COL=POS(0):LOCATE ,,0:P=40-40*WTH:RETURN 'Get cursor position 12190 P=VARPTR(SCR.CLR(1)):CALL P:RETURN ' Clear to EOL 12195 LOCATE ,1:GOTO 12190 ' Clear line 12200 GOSUB 12185:LOCATE ,1:PRINT SPACE$(COL);:GOTO 12205 ' Clear to BOL 12205 LOCATE ROW,COL,1:RETURN ' Normal Return 12210 P=VARPTR(SCR.CLR(19)):CALL P:RETURN ' Clear to EOP 12215 GOSUB 12185:FOR J=1 TO ROW-1:LOCATE J,1,0:PRINT SPACE$(P);:NEXT:PRINT SPACE$(COL);:GOTO 12205 ' Clear to BOP 12220 GOSUB 12185:IF ROW>1 THEN LOCATE ROW-1,COL,1:RETURN ELSE P=VARPTR(SCR.DN(1)):CALL P:GOTO 12205 ' Reverse scroll (index) 12225 PR=-1:PRINT"===Printout ON ===":CLOSE#3:OPEN PRNTPORT$ AS #3:PRINT#3,PRNTINIT$;:RETURN ' Turn Printer ON 12230 PR= 0:PRINT"===Printout OFF===":CLOSE#3:RETURN ' Turn Printer OFF 12235 P=VARPTR(SCR.DN(15)):CALL P:RETURN ' Print Screen 12240 PRINT#1,ESC$"/Z";:RETURN ' Terminal ID for DEC VT52 12245 PRINT#1,ESC$"[?1;11c";:RETURN ' Terminal for DEC VT100 12250 IF PARAM(1)=0 THEN 12190 ELSE IF PARAM(1)=1 THEN 12200 ELSE IF PARAM(1)=2 THEN 12195 ELSE RETURN 12255 IF PARAM(1)=0 THEN 12210 ELSE IF PARAM(1)=1 THEN 12215 ELSE IF PARAM(1)=2 THEN GOSUB 12185:LOCATE 1,1:GOSUB 12210:GOTO 12205 ELSE RETURN 12260 IF PARAM(1)=5 THEN PRINT#1,ESC$"[0n";:RETURN ELSE IF PARAM(1)=6 THEN GOSUB 12185:PRINT#1,ESC$"["STR$(ROW)";"STR$(COL)"R";:GOTO 12205 12265 IF PARAM(1)=5 THEN 12225 ELSE IF PARAM(1)=4 THEN 12230 ELSE IF PARAM(1)=0 THEN 12235 ELSE RETURN 12270 FOR J=1 TO SAV:IF PARAM(J)=2 THEN ANSI=-1 12275 NEXT:RETURN 12280 FOR J=1 TO SAV:IF PARAM(J)=0 THEN LOCATE ,,,7,7:COLOR FG,BG ELSE IF PARAM(J)=1 THEN COLOR HI ELSE IF PARAM(J)=4 THEN LOCATE ,,,1,7 ELSE IF PARAM(J)=5 THEN COLOR FG+32 ELSE IF PARAM(J)=7 THEN COLOR BG,FG 12285 NEXT:RETURN