1 REM LETWRT
5 CLS
10 PRINT TAB(10); "TEXTEDIT AND LETTER WRITING SYSTEM":PRINT
20 PRINT
30 PRINT"THIS MINI TEXT EDITOR MAKES IT POSSIBLE TO WRITE SOME TEXT,
40 PRINT"TO ADD TO IT,TO CHANGE IT,TO SAVE IT ON CASSETTE OR  DISKETTE
45 PRINT"AND TO READ IT BACK FROM SAME.
50 PRINT"THE TEXT MAY ALSO BE PRINTED ON THE LINE PRINTER.
60 PRINT"THIS IS A LINE ORIENTED EDITOR.ONLY ENTIRE LINES MAY BE
63 PRINT"INSERTED,DELETED OR CHANGED.FOR LONGER TEXT CLEAR MORE THAN
65 PRINT"4000 IN LINE 1000.
70 PRINT"THE FILES GENERATED BY THE EDITOR MAY BE LINKED TO THE NAMES
75 PRINT"ON THE MAIL PAC. THE NAME AND ADDRESS OF THE MAILPAC NAME
77 PRINT"IS PUT AT THE HEAD OF THE FILE(LETTER) GENERATED BY THIS
80 PRINT"EDITOR.
90 INPUT"TO BEGIN PRESS ENTER";Z9
100 CLS:PRINT:PRINT:
1000 CLEAR 4000
1002 INPUT"ARE DISK DRIVES ATTACHED(Y/N)";DZ$
1003 IF DZ$<>"Y" AND DZ$<>"N" THEN PRINT"INPUT ERROR":GOTO 110
1005 DIM A$(100)
1007 CLS:PRINT"         MENU"
1010 PRINT
1015 PRINT "0.QUIT"
1020 PRINT "1.DISPLAY TEXT FILE WITH LINE NUMBERS"
1030 PRINT "2.PRINT TEXT FILE WITHOUT NUMBERS"
1040 PRINT "3.SAVE TEXT FILE ON CASSETTE."
1045 PRINT "4.SAVE A TEXTFILE ON DISKETTE
1050 PRINT "5.READ TEXT FILE FROM CASSETTE."
1055 PRINT "6.READ TEXTFILE FROM DISKETTE
1060 PRINT "7.CHANGE A LINE."
1070 PRINT "8.DELETE A LINE.
1075 PRINT"9.INSERT A LINE
1080 PRINT "10.ADD TO OR START TEXT FILE
1082 PRINT "11. PRINT FILE OUT ONTO LINE PRINTER
1084 PRINT "12. MERGE WITH MAILPAC
1090 PRINT:INPUT"ENTER NUMBER OF YOUR CHOICE";Z
1092 IF Z = 0 THEN END
1095 ON Z GOSUB 2100,2200,2300,2350,2400,2450,2500,2600,2700,2800,2900,6000
1100 CLS:GOTO 1007
2100 REM ROUTINE FOR DISPLAYING TEXTFILE WITH NUMBERS
2105 CLS
2107 IF K=0 GOTO 2150
2110 FOR I=1 TO K:ZZ$=RIGHT$("0"+STR$(I)+".",3)
2120 PRINT ZZ$;A$(I)
2130 IF I/10 = INT(I/10) THEN GOSUB 4000:PRINT
2140 NEXT I
2150 PRINT:GOSUB 4100:RETURN
2200 REM ROUTINE FOR DISPLAYING TEXTFILE WITH NUMBERS
2205 CLS
2210 FOR I=1 TO K
2220 PRINT A$(I)
2230 IF I/10=INT(I/10) THEN GOSUB 4000:PRINT
2240 NEXT I
2250 PRINT:GOSUB 4100:RETURN
2300 REM SAVE TEXTFILE ON CASSETTE
2310 CLS:INPUT"PRESS ENTER WHEN CASSETTE RECORDER IS READY TO RECORD";Z9
2315 ' IF DZ$="Y" THEN CMD"T"
2320 WRITE #-1,K
2330 FOR I=1 TO K:WRITE #-1,A$(I):NEXT I
2340 RETURN
2350 REM SAVE TEXTFILE ON DISKETTE
2355 CLS:PRINT"TEXTFILE TO BE SAVED ON DISKETTE"
2360 PRINT"PRESENT TEXFILE NAME IS ";ZD$
2362 INPUT"ENTER NEW TEXTFILE NAME(<ENTER> FOR NO CHANGE)";ZD$
2365 INPUT"PRESS ENTER WHEN DISKETTE IS READY ";Z9
2370 OPEN"O",1,ZD$
2375 WRITE # 1,K:PRINT:PRINT K;" LINES TO BE SAVED."
2380 FOR I=1 TO K: WRITE # 1,A$(I):NEXT
2385 CLOSE #1
2390 RETURN
2400 REM READ TEXTFILE FROM CASSETTE
2410 CLS:INPUT"PRESS ENTER WHEN CASSETTE RECORDER IS READY";Z9
2415 ' IF DZ$="Y" THEN CMD"T"
2420 INPUT #-1,K
2430 FOR I=1 TO K:INPUT #-1,A$(I):NEXT I
2440 RETURN
2450 REM READ TEXTFILE FROM DISKETTE
2455 CLS:PRINT"TEXTFILE TO BE READ FROM DISKETTE":PRINT
2460 INPUT"INPUT NAME OF DISK FILE TO BE READ";ZD$
2465 INPUT"PRESS ENTER WHEN DISKETTE IS READY ";Z9
2470 OPEN "I",1,ZD$
2475 INPUT # 1,K:PRINT:PRINT K;" TEXT LINES TO BE READ":PRINT
2477 FOR II=1 TO 200:NEXT
2480 FOR I=1 TO K:INPUT # 1,A$(I):NEXT I
2485 CLOSE #1
2490 RETURN
2500 REM CHANGE A LINE SUBROUTINE
2510 CLS
2520 INPUT"WHAT LINE NUMBER DO YOU WANT TO CHANGE(0 TO RETURN)";LN
2523 IF LN=0 THEN RETURN
2525 IF LN<0 OR LN<>INT(LN) OR LN>K THEN PRINT"NO SUCH LINE":GOSUB 4400:GOTO 2510
2530 GOSUB 4500
2540 PRINT:PRINT"ARE YOU SURE YOU WANT TO CHANGE LINE ";LN;"(Y/N)";:INPUT Z9$
2550 IF Z9$="N" GOTO 2510
2555 IF Z9$<>"Y" THEN GOSUB 4300:GOTO 2540
2560 PRINT:PRINT"ENTER NEW LINE ";LN
2570 PRINT:PRINT LN;".";:INPUT A$(LN)
2580 CLS:GOSUB 4500
2585 INPUT"PRESS 1 IF OK,ELSE 0";Z9
2587 IF Z9=1 THEN RETURN
2590 IF Z9=0 THEN CLS:GOTO 2530
2592 GOSUB 4300:GOTO 2580
2600 REM DELETE A LINE SUBROUTINE
2610 CLS:INPUT"WHAT LINE NUMBER DO YOU WANT TO DELETE(0 TO RETURN)";LN
2612 IF LN=0 THEN RETURN
2614 IF LN<>INT(LN) OR LN <1 THEN GOSUB 4300:GOTO 2610
2616 IF LN>K THEN PRINT"LINE";LN;" NOT IN TEXT":GOSUB 4400:GOTO 2610
2620 GOSUB 4500
2630 PRINT"ARE YOU SURE YOU WANT TO DELETE LINE";LN;"(Y/N)";:INPUT Z9$
2640 IF Z9$="N" GOTO 2710
2650 IF Z9$<>"Y" THEN GOSUB 4300:GOTO 2630
2655 FOR I=LN+1 TO K:A$(I-1)=A$(I):NEXT I
2657 K=K-1
2660 PRINT:PRINT"DELETE COMPLETE":GOSUB 4400:GOTO 2610
2700 REM INSERT A LINE SUBROUTINE
2710 CLS:INPUT"WHAT LINE NUMBER DO YOU WISH TO INSERT(0 TO RETURN)";LN
2712 IF LN=0 THEN RETURN
2714 IF LN<>INT(LN) OR LN<1 THEN GOSUB 4300:GOTO 2710
2716 IF LN>K THEN PRINT"ONLY ";K;" LINES EXIST IN TEXT.INSERT LINE MUST  BE <= ";K:GOSUB 4400:GOTO 2710
2720  GOSUB 4500
2730 PRINT"ARE YOU SURE YOU WANT TO INSERT LINE";LN;"(Y/N)";:INPUT Z9$
2740 IF Z9$="N" GOTO 2710
2750 IF Z9$<>"Y" THEN GOSUB 4300:GOTO 2730
2755 FOR I=K+1 TO LN+1 STEP-1:A$(I)=A$(I-1):NEXT I
2757 K=K+1
2760 PRINT:PRINT"INSERT BELOW :"
2765 A$(LN)=" "
2770 PRINT:PRINT LN;".";:INPUT A$(LN)
2780 PRINT:PRINT"INSERT COMPLETE":GOSUB 4400:GOTO 2710
2800 REM ADD OR START FILE SUBROUTINE
2805 CLS
2810 PRINT"INPUT LINES END WITH ENTER.FOR INDENTED LINES,OR LINES
2812 PRINT"CONTAINING COMMAS OR COLONS BEGIN WITH A ";CHR$(34)
2815 PRINT"INPUT @ TO RETURN TO MENU"
2817 GOSUB 4400
2820 IF K<1 THEN K=0:GOTO 2830
2825 FOR I=1 TO K:PRINT I;".";A$(I):NEXT I
2830 K=K+1
2840 PRINT K;".";:INPUT A$(K)
2850 IF A$(K)="@" THEN A$(K)="":K=K-1:RETURN
2860 GOTO 2830
2900 REM LINE PRINTER SUBROUTINE
2910 CLS
2920 PRINT"IF PRINTING WITH LINE #'S PRESS 1,ELSE PRESS 0";:INPUT Z
2930 IF Z<>1 AND Z<>0 THEN GOSUB 4300:GOTO 2910
2940 PRINT:INPUT"PRESS ENTER WHEN LINE PRINTER READY";Z9
2950 FOR I=1 TO K
2960 IF Z=1 THEN LPRINT I;".";
2970 LPRINT A$(I)
2980 NEXT I
2990 RETURN
4000 REM PRESS ENTER SUBROUTINE
4010 PRINT:INPUT"PRESS ENTER TO CONTINUE";Z9
4020 RETURN
4100 REM RETURN TO MENU SUBROUTINE
4110 INPUT"PRESS ENTER TO RETURN TO MENU";Z9
4120 RETURN
4300 REM INPUT ERROR SUBROUTINE
4310 PRINT:PRINT"INPUT ERROR.TRY AGAIN"
4320 FOR Z9=1 TO 400:NEXT Z9
4330 RETURN
4400 REM DELAY SUBROUTINE
4410 FOR Z8=1 TO 400:NEXT Z8
4420 RETURN
4500 REM PRINT LINE BEFORE,LINE, LINE AFTER
4510 PRINT:FOR I=LN-1 TO LN+1:PRINT I;".";A$(I):NEXT I
4520 RETURN
6000 REM MERGE WITH MAILPAC PROGRAM
6005 CLS
6010 IF DZ$="N" THEN PRINT"PREPARE FILE ON CASSETTE":GOSUB 10100:INPUT #-1,P1:GOTO 6050
6020 PRINT"FILE TO BE READ IN FROM DISKETTE":PRINT
6030 INPUT"ENTER NAME OF FILE TO BE READ";ND$
6040 OPEN"I",1,ND$:INPUT # 1,P1
6050 PRINT P1;" NAMES TO BE READ"
6060 PRINT"PREPARE PRINTER FOR LETTER":GOSUB 10100
6070 FOR J=1 TO P1
6080 IF DZ$="N" THEN INPUT #-1,NL$,N1$,N2$,CO$,A1$,A2$,A$
6090 IF DZ$="Y" THEN INPUT # 1,NL$,N1$,N2$,CO$,A1$,A2$,A$
6100 CLS:PRINT NL$
6110 PRINT N1$;"  ",N2$
6120 PRINT CO$
6130 PRINT A1$
6140 PRINT A2$
6145 PRINT:PRINT"NAME ";J;"OF";P1
6150 PRINT:PRINT
6160 INPUT"PRESS 1 TO PRINT LETTER FOR NAME, 0 TO SKIP";Z1$
6170 IF Z1$<>"1" AND Z1$<>"0" THEN GOSUB 4300:GOTO 6160
6180 IF Z1$="0" THEN GOTO 7050
7000 LPRINT NL$
7005 LPRINT N1$;"  ";N2$
7010 LPRINT CO$
7015 LPRINT A1$
7020 LPRINT A2$
7025 LPRINT " "
7030 GOSUB 2950
7040 FOR IL=1 TO 60-K:LPRINT" ":NEXT
7050 NEXT J
7060 RETURN
10100 INPUT"PRESS ENTER TO CONTINUE";Z9$:RETURN
