0GOTO 65000
1 CLEAR
10 DEFINT A-Z:DIM T$(600),T(600):I=0:DD=0:IF K$="" THEN K$=" ":GOTO 1000:ELSE GOTO 1000
98 DD=DD+1:IF DD<500 THEN RETURN:ELSE GOSUB 99:DD=0:RETURN
99 COLOR 7,1:LOCATE 23,1,0:PRINT USING " &  &  Memory=#####  Lines=###";DATE$;TIME$;FRE(0);LL;:COLOR C1,C2:RETURN
100 T=T(Y+OF):IF T>0 THEN RETURN:ELSE T=-1*T:T(Y+OF)=T:LL=LL+1:IF LEN(T$(T))<76 THEN T$(T)=SPACE$(76):GOSUB 99:RETURN:ELSE MID$(T$(T),1)=BLANK$:RETURN
111 X1=0:IF Y>1 THEN Y=Y-1:GOSUB 100:RETURN:ELSE Y=22:WHILE T(OF+Y)<0:Y=Y-1:WEND:GOSUB 100:RETURN'CURSOR UP
112 IF X=1 THEN X=76:GOSUB 111:RETURN:ELSE X=X-1:RETURN'cursor left
113 IF X=76 THEN GOSUB 270:RETURN:ELSE X=X+1:RETURN'CURSOR RIGHT
114 X1=0:IF Y<22 AND T(Y+OF+1)>0 THEN Y=Y+1:GOSUB 100:RETURN:ELSE Y=1:GOSUB 100:RETURN'CURSOR DN
115 MID$(NL$,1)=SPACE$(76):MID$(NL$,1)=T$(T):T$(T)=NL$:GOSUB 99:RETURN'LEN T$(T)NOW=76
116 IF LEN(T$(T))>75 THEN RETURN:ELSE GOSUB 115:RETURN
195 LOCATE Y,1,0:PRINT USING LF$;T$(T);Y+OF;:RETURN'PRINT CURRENT LINE
207 GOSUB 251:X=1:RETURN'..[CNTL][LEFT]
208 GOSUB 251:X=76:RETURN'..[CNTL][RIGHT]
209 X=LEN(T$(T)):IF X<76 THEN RETURN:ELSE WHILE MID$(T$(T),X,1)=" " AND X>1:X=X-1:WEND:X=X+1:IF X<=76 THEN RETURN:ELSE X=76:RETURN'..[END]=LAST CHAR IN LINE +1
210 Y=1:GOSUB 100:X=1:RETURN'[home]=top-left
211 IF OF=0 THEN RETURN:ELSE S=Y+OF:OF=0:BOT=22:GOSUB 400:GOSUB 222:GOSUB 100:RETURN'..[CNTL][HOME]=TOP OF FILE
212 LOCATE 23,1,0:PRINT"mem=";FRE(0);:RETURN' Print mem-left
219 IF OF=0 THEN RETURN:ELSE S=Y+OF:IF OF-22<0 THEN OF=0:GOTO 221:ELSE OF=OF-22:IF OF<0 THEN OF=0:GOTO 221:ELSE GOTO 221'..[CNTL][PgUp]=FULL PAGE UP
220 IF OF=0 THEN RETURN:ELSE S=Y+OF:IF OF-11<0 THEN OF=0:ELSE OF=OF-11:IF OF<0 THEN OF=0'..[PgUp]=HALF PAGE UP
221 BOT=OF+22:GOSUB 400:GOSUB 222:GOSUB 100:RETURN
222 Y=S-OF:IF Y<1 THEN Y=1:RETURN:ELSE IF Y>22 THEN Y=22:RETURN:ELSE RETURN
230 LOCATE 24,1,1:LINE INPUT"COMMAND=>";CMD$:RETURN'..[F0]=COMMAND LINE
239 MID$(T$(T),X,77-X)=STRING$(76," "):GOSUB 195:RETURN'..[CTRL][END]
240 IF LL599 THEN BOT=600:GOTO 242:ELSE GOTO 242'..[CTRL][PgDn]=FULL PgDn
241 IF LL599 THEN BOT=600'..[PgDn]=HALF PAGE DN
242 OF=BOT-22:GOSUB 400:GOSUB 222:GOSUB 100:RETURN
250 INS=-1*(XINS=0):IF INS THEN LOCATE ,,1,4,7:IF LEN(T$(T))=76 THEN RETURN:ELSE GOSUB 115:RETURN
251 XINS=INS:IF INS=0 THEN RETURN:ELSE INS=0:LOCATE,,1,0,7:RETURN'..[INS]
260 GOSUB 116:IF X<76 THEN MID$(T$(T),X,76-X)=MID$(T$(T),X+1,76-X)
261 MID$(T$(T),76,1)=" ":LOCATE Y,X,0:PRINT RIGHT$(T$(T),77-X);:RETURN'..[DEL]
270 GOSUB 271:X1=0:IF Y<22 THEN Y=Y+1:GOSUB 100:GOSUB 195:RETURN:ELSE IF BOT<600 THEN BOT=BOT+1:OF=OF+1:GOSUB 100:LOCATE 24,80,0:PRINT " ";:GOSUB 99:GOSUB 195:RETURN:ELSE LOCATE 23,1,0:PRINT "600 is the maximum line count for this editor.";
271 IF X1>0 THEN X=X1:RETURN:ELSE IF X=1 THEN RETURN:ELSE X=1:Y=Y-1:RETURN
300 GOSUB 903:GOSUB 330:GOSUB 904:IF I=0 THEN RETURN:ELSE GOSUB 3999:II=LL:WHILE II>Y-1+OF:SWAP T(II+I),T(II):II=II-1:WEND:S=Y:FOR II=1 TO I:GOSUB 100:Y=Y+1:NEXT II:Y=S:GOSUB 400'[F5] INSERT LINE
301 LOCATE 25,1,0:COLOR K1,K2:KEY ON:GOSUB 51020:RETURN
310 GOSUB 903:GOSUB 340:GOSUB 904:IF I=0 THEN RETURN:ELSE GOSUB 3999:II=Y+OF:WHILE T(II+I)>0:SWAP T(II),T(II+I):II=II+1:WEND:II=LL:LL=LL-I:WHILE II>LL:T(II)=T(II)*-1:II=II-1:WEND:GOSUB 99:GOSUB 400'[F6] DELETE LINE
311 LOCATE 25,1,0:COLOR K1,K2:KEY ON:GOSUB 51020:RETURN
320 S=Y+OF:KEY OFF:LOCATE 25,1,0:PRINT"TOP LINE NUMBER";S;:LOCATE ,16:LINE INPUT;"?";ANS$:IF ANS$="" THEN OF=S-1:ELSE OF=VAL(ANS$)-1:IF OF<0 THEN OF=0:ELSE IF OF>=LL THEN OF=LL-1
321 GOSUB 221:GOSUB 222:LOCATE 25,1,0:COLOR K1,K2:KEY ON:GOSUB 51020:RETURN
330 I=1:KEY OFF:LOCATE 25,1,0:PRINT" How many lines";I;:LOCATE ,16:LINE INPUT;"?";ANS$:I=VAL(ANS$):IF I<1 THEN I=1:ELSE IF I+LL>600 THEN I=600-LL:IF I<1 THEN I=1
331 RETURN
340 MAX=LL-(OF+Y)+1:KEY OFF:LOCATE 25,1,0:PRINT" How many lines 1";:LOCATE ,16:LINE INPUT;"?";ANS$:I=VAL(ANS$):IF ANS$="" THEN I=1:RETURN ELSE IF I<1 THEN I=0:RETURN:ELSE IF I0 THEN PRINT USING LF$;T$(T);I+OF;:ELSE PRINT STRING$(80,176);
401 NEXT I:WHILE T(Y+OF)<0 AND Y>0:Y=Y-1:WEND:T=T(Y+OF):GOSUB 99:RETURN
900 IF Y+OF>LL THEN Y=Y-1:IF Y<1 THEN OF=OF+1:Y=LL-OF:GOSUB 220:RETURN
901 FOR II=Y TO 22:LOCATE II,1,0:IF T(II+OF)>0 THEN PRINT USING LF$;T$(T(II+OF));II+OF;:ELSE PRINT STRING$(80,176);
902 NEXT II:RETURN
903 COLOR C1+16:LOCATE,77:PRINT CHR$(17);:COLOR C1:RETURN
904 LOCATE,77:PRINT"|";:RETURN
1000 C1= 7:C2=5:C3=1:COLOR C1,C2,C3:RESTORE:LF$="\"+SPACE$(74)+"\_|###":XC$="":READ I:WHILE I<>999:XC$=XC$+CHR$(I):READ I:WEND:BLANK$=STRING$(80," "):BL$=BLANK$:XL$=SPACE$(80):NL$=SPACE$(76):CL$=SPACE$(76):SC$=CHR$(13)+CHR$(8)+CHR$(0)
1020 FOR I=1 TO 600:T(I)=I*-1:NEXT I:T=0:OF=0:BOT=22:LL=0
1100 Y=0:X=1:LOCATE,,0,0,7:IF K$="LOADFILE" THEN GOSUB 3310:ELSE WIDTH 80:CLS:LOCATE 23,1:COLOR,1:PRINT BLANK$;:COLOR,C2
1105 GOSUB 3000:GOSUB 210:LOCATE,,0,0,7:OF=1:Y=0:GOSUB 211
1109 GOSUB 2000:IF INS THEN 1111:ELSE IF LEN(T$(T))0 THEN RETURN:ELSE X1=X:RETURN
2000 GOSUB 98:LOCATE Y,X,1:K$=INKEY$
2010 IF K$="" THEN GOTO 2000:ELSE DD=0:IF LEN(K$)=1 THEN I=INSTR(SC$,K$):IF I=0 THEN RETURN:ELSE ON I GOSUB 2015,112:GOTO 2000
2011 K$=RIGHT$(K$,1):I=INSTR(XC$,K$):IF I=0 THEN 2000:ELSE GOSUB 251:ON I GOSUB 210,111,220,112,113,209,114,241,250,260,207,208,239,240,211,219:GOTO 2000
2015 GOSUB 270:GOSUB 251:RETURN
3000 K1=C1:K2=C2:KEY 1,"TOPLIN":KEY 2,"END":KEY 3,"LOAD":KEY 4,"SAVE":KEY 5,"INSERT":KEY 6,"DELETE":KEY 7,"TOP":KEY 8,"BOTTOM":KEY 9,"PRINT":KEY 10,"KEYS"
3010 ON KEY(1) GOSUB 320 :ON KEY(2) GOSUB 3900:ON KEY(3) GOSUB 3300:ON KEY(4) GOSUB 3400:ON KEY(5) GOSUB 300:ON KEY(6) GOSUB 310:ON KEY(7) GOSUB 211:ON KEY(8) GOSUB 3800:ON KEY(9) GOSUB 3100:ON KEY(10) GOSUB 4000
3020 FOR I=1 TO 10:KEY(I) ON:NEXT:KEY OFF:COLOR K1,K2:LOCATE 25,1,0:PRINT SPACE$(79);:KEY ON:GOSUB 51020:RETURN
3100 '<>
3105 TIME2=0
3110 GOSUB 50010:OUTRCD=0:WHILE ERRSW=0 AND OUTRCD0 OR FILE$="" THEN GOSUB 400:ELSE GOSUB 3999:GOSUB 53000:OF=1:Y=0:GOSUB 211:CLOSE'[F3]=LOAD
3315 CONTIN=0:ON ERROR GOTO 0:GOSUB 3020:RETURN
3390 IF LL>1 THEN KEY OFF:LOCATE 25,1,1:COLOR 14:LINE INPUT;"DO YOU WANT TO SAVE THE CURRENT FILE FIRST?";ANS$:ANS$=LEFT$(ANS$,1):IF ANS$="y" OR ANS$="Y" THEN NOSAVE=-1:GOSUB 3400:NOSAVE=0
3399 RETURN
3400 GOSUB 3610:CONTIN=0:GOSUB 51002:IF CONTIN=0 AND FILE$<>"" THEN GOSUB 3999:GOSUB 54000:CLOSE'[F4]=SAVE
3401 ON ERROR GOTO 0:CONTIN=0:IF NOSAVE THEN GOSUB 3020:RETURN: ELSE GOSUB 400:GOSUB 3020:RETURN
3500 CONTIN=-1:RETURN'[F5]=CONTINUE
3600 GOSUB 3610:MSG$="":GOSUB 3199:GOSUB 400:RETURN
3610 CLS:LOCATE,,0:GOSUB 50010:FILES:IF ERRSW=0 THEN FOR II=13 TO 65 STEP 13:LOCATE 1,II:FOR JI=1 TO 10:PRINT"?";CHR$(31);CHR$(29);:NEXT JI:NEXT II:ELSE LOCATE 23,1:PRINT"DISK ACCESS ERROR OCCURRED!";
3615 ON ERROR GOTO 0:IF ERRSW<>0 THEN RETURN
3620 LOCATE 10,1:PRINT							       "????????????????????????????????????????????????????????????????????????????????";:LOCATE 23,1:COLOR,1:PRINT BLANK$;:COLOR,C2:GOSUB 99:RETURN
3700 ON ERROR GOTO 3710:MID$(XL$,1)=CL$:COLOR C2,C1
3701 MID$(CL$,1)=" enter todays date=>"+DATE$+BLANK$:LOCATE 24,1,0:PRINT CL$;:LOCATE 24,21,1:LINE INPUT;K$:IF K$=""THEN 3703:ELSE ON ERROR GOTO 3710:DATE$=K$:ON ERROR GOTO 0:MID$(CL$,1)=XL$:LOCATE 24,1,0:PRINT CL$;:COLOR C1,C2:GOSUB 99:GOTO 3703
3702 GOTO 3701
3703 MID$(CL$,32)=" time=>"+TIME$+BLANK$:LOCATE 24,1,0:PRINT CL$;:LOCATE 24,39,1:LINE INPUT;K$:IF K$="" THEN 3705:ELSE ON ERROR GOTO 3710:TIME$=K$:ON ERROR GOTO 0:MID$(CL$,1)=XL$:LOCATE 24,1,0:PRINT CL$;:COLOR C1,C2:GOSUB 99:RETURN
3704 GOTO 3703
3705 ON ERROR GOTO 0:MID$(CL$,1)=XL$:LOCATE 24,1,0:PRINT CL$;:COLOR C1,C2:GOSUB 99:RETURN
3710 IF ERR=5 THEN LOCATE 23,1,0:PRINT" Invalid format...";:RESUME NEXT:ELSE ON ERROR GOTO 0
3800 IF LL<23 THEN GOSUB 211:RETURN:ELSE S=Y+OF:BOT=LL:OF=BOT-22:GOSUB 400:GOSUB 222:GOSUB  100:RETURN'..[F8]=BOT
3900 GOSUB 3390:ON ERROR GOTO 3910:KEY OFF:CLS:END"'..<>.... ALLOW SAVE BEFORE EXIT...
3910 SYSTEM
3999 KEY OFF:COLOR 30:LOCATE 25,1,0:PRINT"~~~ compute ~~~";:COLOR C1:RETURN
4000 K1=14:K2=2:KEY 1,"copy":KEY 2,"copy+":KEY 3,"move":KEY 4,"move+":KEY 5,"before":KEY 6,"after":KEY 7,"IMBED ":KEY 8,"     ":KEY 9,"DATE":KEY 10,"KEYS"
4010 ON KEY(1) GOSUB 3198:ON KEY(2) GOSUB 3198:ON KEY(3) GOSUB 3198:ON KEY(4) GOSUB 3198:ON KEY(5) GOSUB 3198:ON KEY(6) GOSUB 3198:ON KEY(7) GOSUB 4700:ON KEY(8) GOSUB 3198:ON KEY(9) GOSUB 3700:ON KEY(10) GOSUB 3000
4020 FOR I=1 TO 10:KEY(I) ON:NEXT:KEY OFF:COLOR K1,K2:LOCATE 25,1,0:PRINT SPACE$(79);:KEY ON:GOSUB 51020:RETURN
4700 GOSUB 3610:IF ERRSW=0 THEN GOSUB 51000:IF ERRSW=0 THEN GOSUB 3999:II=0:WHILE LL-II>OF+Y-1:SWAP T(LL-II),T(600-II):II=II+1:WEND:LL=OF+Y-1:GOSUB 53005:WHILE II>0:II=II-1:LL=LL+1:SWAP T(LL),T(600-II):WEND
4701 GOSUB 99:GOSUB 400:GOSUB 4020:RETURN
50010 ON ERROR GOTO 50060:ERRSW=0:RETURN
50060 ERRSW=-1:LOCATE 23,1,0:RESUME NEXT
51000 MID$(XL$,1)=CL$:MID$(CL$,1)="[Imbed File] Name="+FILE$+BLANK$:GOTO 51003
51001 MID$(XL$,1)=CL$:MID$(CL$,1)=" [Load File] Name="+FILE$+BLANK$:GOTO 51003
51002 MID$(CL$,1)=" [Save File] Name="+FILE$+BLANK$
51003 LOCATE 24,1,0:COLOR C2,C1:PRINT CL$;:LOCATE 24,19,1:LINE INPUT;A$
51010 IF CONTIN THEN MID$(CL$,1)=XL$:LOCATE 24,1,0:PRINT CL$;:RETURN:ELSE IF A$<>"" AND MID$(A$,1)<>BLANK$ THEN FILE$=A$:MID$(CL$,1)=" File Name ="+FILE$+BLANK$:ELSE MID$(CL$,1)=XL$:ERRSW=-1
51020 COLOR C2,C1:LOCATE 24,1,0:PRINT CL$;:COLOR ,C3:LOCATE 23,1:PRINT BLANK$;:GOSUB 99:RETURN
53000 FOR I=1 TO 600:T(I)=-1*I:NEXT I:Y=0:OF=0:LL=0
53005 GOSUB 50010:OPEN FILE$ FOR INPUT AS #1
53010 IF ERRSW<>0 THEN LOCATE 23,1,0:PRINT "OPEN ERROR";:RETURN
53025 ON ERROR GOTO 0
53036 WHILE EOF(1)=0
53040 LL=LL+1:T=T(LL)*-1:T(LL)=T:LINE INPUT #1,T$(T):GOSUB 99
53070 WEND
53080 CLOSE:RETURN
54000 GOSUB 50010:OPEN "O",1,FILE$
54010 IF ERRSW<>0 THEN LOCATE 23,1,0:PRINT "OPEN ERROR";:RETURN
54020 FOR OUTRCD= 1 TO LL:T=T(OUTRCD):GOSUB 209:PRINT#1,MID$(T$(T),1,X)
54025 NEXT OUTRCD
54030 IF ERRSW<>0 THEN LOCATE 23,1,0:PRINT "WRITE ERROR";:RETURN
54035 RETURN
55080 MID$(XL$,1)=INPUT$(128,#1):RETURN
60000 DATA 71,72,73,75,77,79,80,81,82,83,115,116,117,118,119,132,999
65000 REM -*- RV-EDIT	   -*-
65020 KEY(2) ON:ON KEY(2) GOSUB 65200
65030 KEY OFF:SCREEN 0,1:COLOR 15,3,1:WIDTH 40:CLS:LOCATE 5,18:PRINT " IBM "
65040 LOCATE 7,12,0:PRINT "Personal Computer"
65050 COLOR 10,0:LOCATE 10,9,0:PRINT CHR$(213)+STRING$(21,205)+CHR$(184)
65060 LOCATE 11,9,0:PRINT CHR$(179)+" -*-R V - E D I T-*- "+CHR$(179)
65070 LOCATE 12,9,0:PRINT CHR$(179)+STRING$(21,32)+CHR$(179)
65080 LOCATE 13,9,0:PRINT CHR$(179)+"Version 1.2  11/05/82"+CHR$(179)
65090 LOCATE 14,9,0:PRINT CHR$(212)+STRING$(21,205)+CHR$(190)
65100 COLOR 15,0:LOCATE 19,5,0:PRINT "   Author: R. S. Vollmer Sr.   "
65110 COLOR 14,0:LOCATE 23,7,0:PRINT "       INITIALIZING        ";CHR$(7);
65120 COLOR 30:LOCATE 23,5,0:PRINT CHR$(15);:LOCATE 23,35,0:PRINT CHR$(15);
65130 COLOR 7,5
65150 GOTO 1
65200 END