Compucolor.org – Virtual Media

Listing of file='HFILEX.BAS;01' on disk='vmedia/nsw_ug_1-sideA-sector.ccvf'

100 REM  --------------------------------
110 REM         HANGMAN DATA FILE
120 REM          CREATED 20/03/81
130 REM         LAST REVISED 20/03/81
140 REM  -------------------------------
150 REM
160 CLEAR 3000
170 DIM W$(300),IT(50)
180 PLOT  12:PRINT "HANGMAN FILE":PRINT :PRINT
190 PRINT "1. CREATE NEW DATA FILE":PRINT
200 PRINT "2. LIST/UPDATE DATA FILE":PRINT
205 PRINT "3. END":PRINT
210 PRINT :INPUT "SELECTION > ";B:PRINT
220 IF  B< 1 OR  B> 3 THEN  210
230 ON  B GOSUB  1000,2000,3000
240 PRINT :INPUT "REPEAT ? > ";A$
250 IF  A$< > "N" THEN  150
260 END
270 REM  ------ END MAIN PROGRAM ----------
1000 REM  ------ CREATE FILE ----------
1020 REM
1040 PLOT  12:PRINT "CREATE NEW FILE ":PRINT :PRINT
1045 GOSUB  4000:INPUT "CORRECT ? > ";A$:IF  A$= "N" THEN  1045
1060 PRINT :INPUT "ENTER FILE NAME > ";F1$:PRINT
1080 PRINT :INPUT "HOW MANY WORDS > ";NW:PRINT ""
1100 IF  NW> 100 OR  NW< 1 THEN  1080
1110 FILE "N",F1$,NW,16,16
1130 FILE "R",1,F1$,8
1150 PRINT :PRINT "INPUTS":PRINT
1170 FOR  K=  1TO  NW
1190 PRINT  K;TAB( 10);:INPUT "> ";W$(K):PLOT  6,3
1210 IF  W$(K)= "+" THEN  NW= K:GOTO  1300
1230 NEXT  K
1300 FOR  K=  1TO  NW
1310 PUT  1,K,1;W$(K)[16]
1320 NEXT  K:FILE "C",1:REM  INPUT COMPLETED
1330 PRINT :PRINT "FILE > ";F1$;"   NOW CREATED ":PRINT
1340 GOSUB  5000
1350 RETURN
1360 REM  ------- END CREATE ----------
2000 REM  ------ LIST/UPDATE --------
2020 GOSUB  4000:REM  DIRECTORY
2040 PRINT :INPUT "CORRECT ? > ";A$:IF  A$= "N" THEN  2000
2060 PRINT :INPUT "ENTER FILE  NAME >  ";F2$
2080 FILE "R",2,F2$,8
2100 FILE "A",2,CR,RC,RS,BF
2120 PLOT  12:PRINT "FILE INFORMATION ":PRINT
2140 PRINT "CURRENT RECORD > ";CR
2160 PRINT "NO. OF RECORDS > ";RC
2180 PRINT "RECORD SIZE  > ";RS
2200 PRINT :INPUT "LIST RECORDS (START,FINISH) > ";X1,X2
2220 IF  X1< 1 OR  X2> RC THEN  2200
2240 FOR  K=  X1 TO  X2
2260 GET  2,K,1;W$(K)[16]
2280 NEXT  K:PRINT :PRINT
2300 FOR  K=  X1 TO  X2
2320 PRINT "#";K;TAB( 6);"> ";W$(K)
2340 NEXT  K
2360 PRINT :INPUT "UPDATE ? > ";A$:IF  A$< > "Y" THEN  RETURN
2380 GOSUB  2800:REM  FIND INDEX
2400 FOR  M=  1TO  NX
2420 PRINT "# ";IT(M);"  ";W$(IT(M));TAB( 15);"CHANGE TO >   ";:INPUT "";W$(IT(M)):PLOT  6,3
2440 NEXT  M
2460 PRINT :INPUT "* EDIT OK ? > ";A$:IF  A$= "N" THEN  2400
2480 PRINT "* END EDIT *":PRINT
2500 FOR  M=  X1 TO  X2
2520 PUT  2,M,1;W$(M)[16]
2540 NEXT  M
2560 FILE "C",2:REM  UPDATE COMPLETE
2580 PRINT :PRINT "FILE > ";F2$;"  NOW UPDATED":PRINT :PRINT
2600 GOSUB  5000:RETURN
2620 REM  ------- END LIST UPDATE ----------
2800 REM  ----- FIND UPDATE INDEX -------
2810 PLOT  12:PRINT "EDIT":PRINT
2820 PRINT :INPUT "HOW MANY RECORDS > ";NX
2830 IF  NX< 1 OR  NX> RC THEN  2820
2840 PRINT :FOR  M=  1 TO  NX:PRINT "# ";:INPUT "> ";IT(M):PRINT :NEXT  M
2850 RETURN
2860 REM  ----- END INDEX --------
3000 PRINT :PRINT "EXIT FILE ":END
4000 REM  ----- DIRECTORY -------
4010 PLOT  12:PRINT "FILE INFORMATION ":PRINT
4020 PRINT "PLEASE INSERT YOU DATAFILE DISKETTE NOW > ":INPUT "";A$
4030 PLOT  27,4:PRINT "DIR":PLOT  27,27:PRINT
4040 RETURN
4050 REM  ------ END DIR ---------
5000 REM  --------- PROMPT ---------
5010 PRINT :PRINT "PRESS RETURN TO CONTINUE > ":INPUT "";A$:PRINT
5020 RETURN
5030 REM  ------ END PROMPT ---------