Text Editor 2000 2.2

Products: Text Editor 2000
Date: 1985
Type: Program
Platform(s): TS 2068

Chris Nystrom’s TEXT EDITOR 2000 version 2.2 merged with with SETYPE by Ron Ruegg.

Related Products

Editor written in BASIC. Printed as a type-in program in T-S Horizons n13. Written to support TS 2040 printer.

Source Code

    1 REM TEXT EDITOR 2000 version 2.2 by C.Nystrom 1985 with SETYPE by RRRuegg all public domain.
    2 REM Meld by M Quintero 1985
   10 REM \''\''\''\''\''\''\''\''\''\''\''\''\''\''\''\'' EDITOR
   20 LET d1=0
   25 LET a=1
   30 GO SUB 9600
   35 LET x1=0
   40 LET x2=0
   45 LET s=1
   50 PRINT AT x1,x2;t$(s)      
   55 LET a$=INKEY$
   60 IF a$="" THEN GO TO 55
   65 IF a$=CHR$ 4 THEN GO TO 320
   70 IF a$=CHR$ 5 THEN GO TO 350
   75 IF a$=CHR$ 8 THEN GO TO 125
   80 IF a$=CHR$ 9 THEN GO TO 275
   85 IF a$=CHR$ 10 THEN GO TO 170
   90 IF a$=CHR$ 11 THEN GO TO 220
   95 IF a$=CHR$ 13 THEN GO TO 380
  100 IF a$=CHR$ 226 THEN GO TO 720
  105 IF s$<>"b" AND s$<>"B" THEN GO TO 55
  110 LET t$(s)=a$
  115 GO TO 275
  120 REM \''\''\''\''\''\''\''\''\''\''\''\'' Cursor Left
  125 PRINT AT x1,x2;t$(s)
  130 IF s=1 THEN GO TO 50
  135 IF x2>0 THEN GO TO 150
  140 LET s=s+32
  145 LET x2=32
  150 LET x2=x2-1
  155 LET s=s-1
  160 GO TO 50
  165 REM \''\''\''\''\''\''\''\''\''\''\'' Cursor Down
  170 PRINT AT x1,x2;t$(s)
  175 IF s+32>LEN t$ THEN GO TO 50
  180 IF x1<21 THEN GO TO 200
  185 LET a=b+1
  190 GO SUB 9600
  195 LET x1=-1
  200 LET x1=x1+1
  205 LET s=s+32
  210 GO TO 50
  215 REM \''\''\''\''\''\''\''\''\''\'' Cursor Up
  220 PRINT AT x1,x2;t$(s)
  225 IF s<32 THEN GO TO 50
  230 IF x1>0 THEN GO TO 255
  235 LET a=a-704
  240 IF a<1 THEN LET a=1
  245 GO SUB 9600
  250 LET x1=22
  255 LET x1=x1-1
  260 LET s=s-32
  265 GO TO 50
  270 REM \''\''\''\''\''\''\''\''\''\'' Cursor Right
  275 PRINT AT x1,x2;t$(s)
  280 IF s=LEN t$ THEN GO TO 50
  285 IF x2<31 THEN GO TO 300
  290 LET s=s-32
  295 LET x2=x2-32
  300 LET x2=x2+1
  305 LET s=s+1
  310 GO TO 50
  315 REM \''\''\''\''\''\''\''\''\''\''\''\'' Page Down
  320 IF s+704>LEN t$ THEN GO TO 50
  325 LET a=b+1
  330 GO SUB 9600
  335 LET s=s+704
  340 GO TO 50
  345 REM \''\''\''\''\''\''\''\''\''\''\''\'' Page Up
  350 IF s-704<1 THEN GO TO 50
  355 LET a=a-704
  360 GO SUB 9600
  365 LET s=s-704
  370 GO TO 50
  375 REM \''\''\''\''\''\''\''\''\''\''\''\''\''\'' Enter
  380 IF s$="B" OR s$="b" THEN GO TO 720
  385 PRINT AT x1,x2; INVERSE 1;     "*"
  390 IF d1>0 THEN GO TO 410
  395 LET d1=s
  400 IF s$<>"4" THEN RETURN 
  405 GO TO 280
  410 IF s<d1 THEN GO TO 630
  415 LET d2=s
  420 RETURN 
  710 REM \''\''\''\''\''\''\''\''\''\''\'' MAIN MENU
  720 CLS 
  730 PRINT AT 3,8;"Text Editor 2000"
  735 PRINT AT 7,8;"0 - Input Text"
  740 PRINT AT 8,8;"1 - Save Text"
  745 PRINT AT 9,8;"2 - Load Text"
  750 PRINT AT 10,8;"3 - Insert Text"
  755 PRINT AT 11,8;"4 - Delete Text"
  760 PRINT AT 12,8;"5 - Justify Text"
  765 PRINT AT 13,8;"6 - Search and Replace"
  770 PRINT AT 14,8;"7 - Text Output"
  775 PRINT AT 15,8;"8 - Clear Text"
  780 PRINT AT 16,8;"9 - Quick Note"
  785 PRINT AT 17,8;"A - Center Text"
  790 PRINT AT 18,8;"B - Type Over"
  795 PRINT AT 19,8;"C - Change Colors"
  800 GO SUB 9100
  805 PRINT #1;AT 1,11;"Selection?"
  810 BEEP .1,10
  815 PAUSE 0
  820 LET s$=INKEY$
  825 IF s$="z" OR s$="Z" THEN COPY 
  830 CLS 
  835 IF s$="w" OR s$="W" THEN GO TO 4500
  840 IF s$="a" OR s$="A" THEN GO TO 5500
  845 IF s$="b" OR s$="B" THEN GO TO 3500
  850 IF s$="c" OR s$="C" THEN GO TO 8500
  855 IF s$="s" OR s$="S" THEN GO TO 9940
  860 IF s$<CHR$ 48 OR s$>CHR$ 58 THEN GO TO 720
  870 BEEP .08,5
  880 IF s$="0" THEN GO TO 900
  890 GO TO VAL s$*1000
  895 REM \''\''\''\''\''\''\''\''\''\''\''\'' INPUT TEXT
  900 IF LEN t$>11040 THEN GO TO 1500
  905 LET b$=""
  910 IF LEN t$<64 THEN GO TO 920
  915 LET b$=t$(LEN t$-63 TO LEN t$)
  920 INPUT AT 21,0;"-------------------------------             INPUT TEXT";AT 0,0;(b$); LINE a$ 
  925 IF a$="" THEN GO TO 800
  930 IF t$=" " THEN GO TO 965
  935 GO SUB 9200
  940 LET d1=LEN u$+1
  945 GO SUB 9300
  950 LET t$(d1 TO d1+LEN a$-1)=a$
  955 DIM u$(1)
  960 GO TO 985
  965 LET d=INT (LEN a$/32-.01)+1
  970 DIM t$(d*32)
  975 LET t$=a$
  985 BEEP .1,7
  990 GO TO 900
  995 REM \''\''\''\''\''\''\''\''\''\''\''\''\'' SAVE TEXT
 1000 INPUT "-------------------------------- Name of Text: ";n$
 1010 IF n$=CHR$ 226 OR n$="" THEN GO TO 800
 1020 IF LEN n$>10 THEN LET n$=n$( TO 10)
 1030 GO SUB 9100
 1040 PRINT #1;AT 1,5;"SAVING AS: ";n$
 1050 SAVE n$ DATA t$()
 1060 BEEP .1,10
 1070 GO SUB 9100
 1080 PRINT #1;AT 1,7;"VERIFY SAVE Y/N)"; FLASH 1;"?"
 1090 PAUSE 0
 1100 LET a$=INKEY$
 1110 IF a$="N" OR a$="n" THEN GO TO 1150
 1120 GO SUB 9100
 1130 PRINT #1;AT 1,5;"VERIFYING : ";n$
 1140 VERIFY n$ DATA t$()
 1150 BEEP .1,7
 1160 GO TO 800
 1490 REM \''\''\''\''\''\''\''\''\''\''\''\''\''\'' Full File
 1500 PRINT AT 7,9;"TEXT FILE FULL"
 1510 PRINT AT 9,10;"SAVE TO TAPE"
 1520 GO TO 800
 1990 REM \''\''\''\''\''\''\''\''\''\''\''\''\'' LOAD TEXT
 2000 INPUT "------------------------------ Name of Text; ";n$
 2010 IF n$=CHR$ 226 THEN GO TO 800
 2020 IF LEN n$>10 THEN LET n$=n$( TO 10)
 2030 GO SUB 9100
 2040 PRINT #1;AT 1,0;"     LOADING: ";n$
 2050 DIM t$(1)
 2060 LOAD n$ DATA t$()
 2070 BEEP .1,7
 2080 GO TO 800
 2990 REM \''\''\''\''\''\''\''\''\''\''\'' INSERT TEXT
 3000 LET b$="INSERT TEXT"
 3010 GO SUB 20
 3020 CLS 
 3030 GO SUB 9100
 3040 PRINT #1;AT 1,2;"TEXT NEED TO BE LOADED (Y/N)";"?"
 3050 PAUSE 0
 3060 LET a$=INKEY$
 3070 IF a$="Y" OR a$="y" THEN GO TO 3200
 3080 INPUT AT 21,0;"------------------------------           INSERT TEXT";AT 0,0; LINE a$
 3100 IF a$="" THEN GO TO 800
 3110 GO SUB 9200
 3120 GO SUB 9300
 3130 LET t$(d1 TO d1+LEN a$-1)=a$
 3140 GO SUB 9500
 3150 GO TO 7030
 3190 REM \''\''\''\''\''\''\''\''\''\''\''\'' Load Insert
 3200 INPUT "------------------------------- Name of Text: ";n$
 3210 IF n$=CHR$ 226 THEN GO TO 800
 3220 IF LEN n$>10 THEN LET n$=n$( TO 10)
 3230 GO SUB 9100
 3240 PRINT #1;AT 1,6;"LOADING: ";n$
 3250 LOAD n$ DATA v$()
 3260 BEEP .1,10
 3270 LET d=INT (LEN v$/32-.01)+1
 3280 GO SUB 9210
 3290 GO SUB 9300
 3300 GO SUB 9400
 3310 LET n=d1-1+LEN v$
 3320 GO SUB 9510
 3330 GO TO 7030
 3490 REM \''\''\''\''\''\''\''\''\''\''\''\''\'' TYPE OVER
 3500 LET b$="TYPE OVER"
 3510 GO TO 25
 3990 REM \''\''\''\''\''\''\''\''\''\'' DELETE TEXT
 4000 LET b$="DELETE TEXT"
 4010 GO SUB 20
 4020 CLS 
 4030 IF d1=1 AND d2=LEN t$ THEN GO TO 8050
 4040 LET d=-(INT ((d2-d1+1)/32))
 4050 GO SUB 9210
 4060 GO SUB 9300
 4070 LET n=d1-1
 4075 LET d=d1
 4080 LET d1=d2+1
 4090 GO SUB 9510
 4100 GO SUB 9100
 4105 LET d1=d
 4110 PRINT #1;AT 1,0;"  INSERT AT SAME PLACE (Y/N) ";"?"
 4120 PAUSE 0
 4130 LET a$=INKEY$
 4140 CLS 
 4150 IF a$="Y" OR a$="y" THEN GO TO 3030
 4160 DIM u$(1)
 4170 GO TO 7030
 4490 REM \''\''\''\''\''\''\''\''\''\''\'' Change Width
 4500 INPUT "------------------------------- NUMBER OF COLUMNS:";w
 4510 GO TO 800
 4990 REM \''\''\''\''\''\''\''\''\''\''\'' JUSTIFICATION
 5000 IF t$="" THEN RETURN 
 5010 FOR i=1 TO INT (LEN t$/w-.01)
 5020 IF t$(i*w)<>" " THEN GO TO 5190
 5030 IF t$(i*w+1)=" " THEN GO TO 5190
 5040 FOR j=0 TO 10
 5050 IF t$(i*w-j)<>" " THEN GO TO 5080
 5060 NEXT j
 5070 GO TO 5190
 5080 LET d=2
 5090 FOR j=3 TO w
 5100 IF t$((i-1)*w+j)<>" " THEN GO TO 5160
 5110 FOR k=0 TO w-j-1
 5120 LET t$(i*w-k)=t$(i*w-k-1)
 5130 NEXT k
 5140 IF t$(i*w)<>" " THEN GO TO 5190
 5150 LET j=j+d
 5160 NEXT j
 5170 LET d=d+1
 5180 GO TO 5090
 5190 IF PEEK 23689=2 THEN CLS 
 5200 PRINT t$((i-1)*w+1 TO i*w)
 5210 NEXT i
 5220 IF PEEK 23689=2 THEN CLS 
 5230 PRINT t$((i-1)*w+1 TO )
 5240 BEEP .1,7
 5250 GO TO 800
 5490 REM \''\''\''\''\''\''\''\''\''CENTER TEXT
 5500 LET b$="CENTER TEXT"
 5510 GO SUB 20
 5520 CLS 
 5530 LET s1=0
 5540 FOR i=d1 TO d1+w-1
 5550 IF t$(i)<>" " THEN GO TO 5590
 5560 LET s1=s1+1
 5570 NEXT i
 5590 IF s1=w THEN GO TO 800
 5600 LET s2=0
 5610 FOR i=d1+w-1 TO d1 STEP -1
 5620 IF t$(i)<>" " THEN GO TO 5650
 5630 LET s2=s2+1
 5640 NEXT i
 5650 IF s1=s2 THEN GO TO 800
 5660 LET s2=w-s2-1
 5670 LET b$=t$(d1+s1 TO d1+s2)
 5680 FOR i=d1 TO d1+w-1
 5690 LET t$(i)=" "
 5700 NEXT i
 5710 LET s=(w/2)-(LEN b$/2)
 5720 LET t$(d1+s TO d1+s+LEN b$)=b$
 5730 GO TO 7030
 5990 REM \''\''\''\''\'' SEARCH AND REPLACE
 6000 INPUT AT 21,0;"--------------------------------    INPUT FIRST STRING";AT 0,0; LINE b$
 6010 IF b$="" THEN GO TO 800
 6020 INPUT AT 21,0;"--------------------------------     INPUT SECOND STRING";AT 0,0; LINE a$
 6030 LET d=0
 6040 LET s2=0
 6050 GO SUB 6500
 6060 IF d=1 THEN GO TO 6200
 6070 LET d=INT ((LEN a$-LEN b$)/32-.01)+1
 6080 GO SUB 9210
 6090 LET d1=s2
 6100 GO SUB 9300
 6110 LET t$(d1 TO d1+LEN a$-1)=a$
 6120 LET n=d1-1+LEN a$
 6130 LET d1=d1+LEN b$
 6140 GO SUB 9510
 6150 GO TO 6050
 6200 IF PEEK 23688=2 AND PEEK 23689=3 THEN CLS 
 6210 PRINT t$(s2 TO )
 6220 BEEP .1,7
 6230 GO TO 800
 6490 REM \''\''\''\''\''\''\''\''\''\''\''\''\''\'' SEARCH
 6500 LET s2=s2+1
 6510 IF s2=1 THEN GO TO 6540
 6520 IF PEEK 23688=2 AND PEEK 23689=3 THEN CLS 
 6530 PRINT t$(s2-1);
 6540 IF s2+LEN b$-1>LEN t$ THEN GO TO 6570
 6550 IF t$(s2 TO s2+LEN b$-1)=b$ THEN RETURN 
 6560 GO TO 6500
 6570 LET d=1
 6580 RETURN 
 6990 REM \''\''\''\''\''\''\''\''\''\''\'' TEXT OUTPUT
 7000 GO SUB 9100
 7005 PRINT #1;AT 1,5;"TO THE PRINTER Y/N)";"?"
 7010 PAUSE 0
 7015 LET a$=INKEY$
 7020 CLS 
 7025 IF a$="Y" OR a$="y" THEN GO TO 7100
 7030 FOR i=1 TO LEN t$ STEP 704
 7035 CLS 
 7040 IF i+703<=LEN t$ THEN GO TO 7055
 7045 PRINT t$(i TO  )
 7050 GO TO 800
 7055 PRINT t$(i TO i+703)
 7060 GO SUB 9100
 7065 PRINT #1;AT 1,8;"NEXT PAGE (Y/N)";"?"
 7070 PAUSE 0
 7075 LET a$=INKEY$
 7080 BEEP .1,7
 7085 IF a$="N" OR a$="n" THEN GO TO 800
 7090 NEXT i
 7095 GO TO 800
 7100 GO SUB 9100
 7110 PRINT #1;AT 1,7;"DOUBLE SPACE (Y/N)";"?"
 7120 LET ds=0
 7130 PAUSE 0
 7140 LET a$=INKEY$
 7150 IF a$="Y" OR a$="y" THEN LET ds=1
 7160 GO SUB 9100
 7170 PRINT #1;AT 1,7;"DOUBLE WIDTH (Y/N)";"?"
 7180 PAUSE 0
 7190 LET a$=INKEY$
 7195 CLS 
 7200 IF a$="Y" OR a$="y" THEN GO TO 7600
 7210 GO SUB 9100
 7220 PRINT #1;AT 1,4;"ARE THERE SCREENS (Y/N)";"?"
 7230 PAUSE 0
 7240 LET a$=INKEY$
 7245 CLS 
 7250 IF a$="Y" OR a$="y" THEN GO TO 7330
 7260 IF w<>32 OR ds=1 THEN GO TO 7290
 7270 PRINT #3;t$
 7275 BEEP .1,7
 7280 GO TO 800
 7290 LET s1=1
 7300 LET s2=LEN t$
 7305 GO SUB 7500
 7310 BEEP .1,7
 7315 GO TO 800
 7320 REM \''\''\''\''\''\''\''\''\'' SCREEN$ Output
 7330 LET b$="SCR$"
 7340 LET s2=0
 7350 LET d=0
 7355 LET s1=s2
 7360 IF s1=0 THEN LET s1=1
 7365 GO SUB 6500
 7370 IF d=1 THEN LET s2=LEN t$
 7375 IF d<>1 THEN LET s2=s2-1
 7377 IF s2<=0 THEN GO TO 7400
 7380 IF w=32 AND ds=0 THEN LPRINT t$(s1 TO s2)
 7390 IF w<>32 OR ds=1 THEN GO SUB 7500
 7400 IF d=1 THEN GO TO 7310
 7405 GO SUB 9100
 7410 PRINT #1;AT 1,8;"START THE TAPE"
 7430 LOAD ""SCREEN$ 
 7450 PRINT #1;AT 1,7;"STOP THE TAPE"
 7460 COPY 
 7470 CLS 
 7480 LET s2=s2+5
 7490 GO TO 7355
 7495 REM \''\''\''\''\''\''\''\''\'' Measured Output
 7500 IF s1+w-1>=s2 THEN GO TO 7550
 7505 OUT 127,15: OUT 127,27: OUT 127,87: OUT 127,1
 7510 LPRINT t$(s1 TO s1+w-1)
 7520 IF ds=1 THEN LPRINT 
 7530 LET s1=s1+w
 7540 GO TO 7500
 7550 LPRINT t$(s1 TO s2)
 7560 IF ds=1 THEN LPRINT 
 7570 RETURN 
 7590 REM \''\''\''\''\''\''\''\''\''\'' Double Width
 7600 LET f=0
 7610 LET s1=1
 7620 IF s1+w-1=LEN t$ THEN GO TO 7680
 7630 LPRINT t$(s1 TO s1+w-1)
 7640 IF ds=1 THEN LPRINT 
 7650 LET s1=s1+(w*2)
 7660 IF s1>LEN t$ THEN GO TO 7700
 7670 GO TO 7620
 7680 LPRINT t$(s1 TO LEN t$)
 7690 IF ds=1 THEN LPRINT 
 7700 IF f=1 THEN GO TO 7310
 7710 LET f=1
 7720 LPRINT 
 7730 LPRINT 
 7740 LET s1=w+1
 7750 GO TO 7620
 7990 REM \''\''\''\''\''\''\''\''\''\''\''\'' CLEAR TEXT
 8000 PRINT #1;AT 0,0;"--------------------------------"
 8010 PRINT #1;AT 1,6;"ARE YOU SURE (Y/N)"; "?"
 8020 PAUSE 0
 8030 LET a$=INKEY$
 8040 IF a$<>"Y" AND a$<>"y" THEN GO TO 800
 8050 DIM t$(1)
 8060 PRINT AT 9,10;"TEXT CLEARED"
 8070 GO TO 800
 8490 REM \''\''\''\''\''\''\''\''\'' CHANGE COLORS
 8500 GO SUB 9100
 8560 PRINT #1;AT 1,5;"PAPER COLOR (0-7)";"?"
 8570 PAUSE 0
 8580 LET b$=INKEY$
 8590 IF b$<CHR$ 48 OR b$>CHR$ 56 THEN GO TO 8550
 8600 BORDER VAL a$: PAPER VAL b$: INK 9: CLS 
 8610 BEEP .1,7
 8620 GO TO 800
 8990 REM \''\''\''\''\''\''\''\''\''\''\''\'' QUICK NOTE
 9000 INPUT AT 21,0;"--------------------------------          QUICK NOTE";AT 0,0; LINE a$
 9010 IF a$="" THEN GO TO 800
 9020 PRINT #3;a$
 9030 BEEP .1,7
 9040 GO TO 9000
 9090 REM \''\''\''\''\''\''\''\''\''\''\''\''\''\'' CLS BOTTOM
 9100 PRINT #1;AT 0,0;"--------------------------------"
 9110 PRINT #1;AT 1,0;"                                "
 9120 RETURN 
 9190 REM \''\''\''\''\''\''\''\''\''\''\''\''\''\'' CLEAR t$
 9200 LET d=INT (LEN a$/32-.01)+1
 9210 DIM u$(LEN t$)
 9220 FOR i=1 TO LEN u$ STEP 704
 9230 IF i+703>LEN u$ THEN GO TO 9260
 9240 LET u$(i TO i+703)=t$(i TO i+703)
 9250 GO TO 9270
 9260 LET u$(i TO  )=t$(i TO  )
 9270 NEXT i
 9280 DIM t$(LEN u$+d*32)
 9290 RETURN 
 9295 REM \''\''\''\''\''\''\''\''\''\''\'' ADD TEXT #1
 9300 FOR i=1 TO d1-1 STEP 704
 9310 IF i+703>d1-1 THEN GO TO 9340
 9320 LET t$(i TO i+703)=u$(i TO i+703)
 9330 GO TO 9350
 9340 LET t$(i TO d1-1)=u$(i TO d1-1)
 9350 NEXT i
 9360 RETURN 
 9390 REM \''\''\''\''\''\''\''\'' ADD TEXT #2
 9400 FOR i=i TO LEN v$ STEP 704
 9410 IF i+703>LEN v$ THEN GO TO 9440
 9420 LET t$(i+d1-1 TO i+d1+702)=v$(i TO i+703)
 9430 GO TO 9450
 9440 LET t$(i+d1-1 TO d1-1+LEN v$)=v$(i TO  )
 9450 NEXT i
 9460 RETURN 
 9490 REM \''\''\''\''\''\''\''\''\''\'' ADD TEXT #3
 9500 LET n=d1-1+LEN a$
 9510 FOR i=1 TO LEN u$-d1 STEP 704
 9520 IF i+703>LEN u$-d1 THEN GO TO 9550
 9530 LET t$(i+n TO i+n+703)=u$(i+d1-1 TO i+d1-1+703)
 9540 GO TO 9560
 9550 LET t$(i+n TO  )=u$(i+d1-1 TO  )
 9560 NEXT i
 9570 DIM u$(1)
 9580 RETURN 
 9590 REM \''\''\''\''\''\''\''\''\''PRINT SCREEN
 9600 CLS 
 9605 GO SUB 9100
 9610 PRINT #1;AT 1,16-(LEN b$/2)     ;b$
 9620 LET b=a+703
 9630 IF b>LEN t$ THEN LET b=LEN t$
 9640 PRINT t$(a TO b)
 9650 RETURN 
 9820 REM \''\''\''\''\''\''\''\''\''\''\''\'' START HERE
 9830 BEEP .5,10
 9840 BORDER 0: PAPER 0: INK 9: CLS 
 9850 PRINT AT 3,12;"Textype"
 9875 DIM t$(1)
 9880 LET w=32
 9890 POKE 23609,5
 9920 GO TO 735
 9930 REM \''\''\''\''\''\''\''\''\'' SAVE PROGRAM
 9940 CLEAR 
 9950 SAVE "Textype" LINE 9830
 9960 BEEP .1,7
 9970 VERIFY "Textype"
 9980 BEEP .1,7
 9990 STOP 
Scroll to Top