Compucolor.org – Virtual Media

Listing of file='LISTER.BAS;01' on disk='vmedia/taylor_4-sector.ccvf'

0 REM  *** BASIC FILE LISTING PROGRAM ***
1 REM
2 REM  USER SPECIFIES LINE LENGTH, PAGE LENGTH AND RANGE OF
3 REM  LINE NUMBERS TO BE PRINTED. DEFAULT VALUES ARE SET IN
4 REM  LINE 80. THE BAUD RATE CAN ALSO BE CHANGED BY CHANGING
5 REM  "BR" IN LINE 80. "BREAK" KEY SUSPENDS PRINTING.
6 REM  "HOME" KEY ABORTS PROGRAM --- DO NOT USE LINEFEED!!!
7 PLOT  6,1,12,14:PRINT  "BASIC FILE LISTER"
8 POKE 32940,255:POKE 32941,159
9 CLEAR  2000:REM  NOW COMES THE BASIC KEYWORDS
10 DATA END,FOR,NEXT,DATA,INPUT,DIM,READ,FILE,GOTO,RUN,IF,RESTORE
15 DATA GOSUB,RETURN,REM,GET,OUT,PUT,PLOT,SAVE,LOAD,POKE,PRINT
20 DATA LIST,CONT,CLEAR,DEF,WAIT,ON,TAB(,TO,FN,SPC(,THEN,NOT,STEP
25 DATA +,-,*,/,^,AND,OR,>,=,<,SGN,INT,ABS,CALL,FRE,INP,POS,SQR
30 DATA RND,LOG,EXP,COS,SIN,TAN,ATN,PEEK,LEN,STR$,VAL,ASC,CHR$
35 DATA LEFT$,RIGHT$,MID$
40 DATA  0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1
45 DATA  1,1,1,1,1,1,0,1,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0
50 DATA  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
60 DIM  TK$(69),SP(69)
65 FOR  I= 0 TO  69:READ  TK$(I):NEXT
70 FOR  I= 0 TO  69:READ  SP(I):NEXT
80 BR= 7:LL= 80:PL= 60:REM  DEFAULT VALUES
82 SK= 6:REM  NUMBER OF LINES FOR PERFORATION SKIP
85 KR= 33279:REM  KEYBOARD READY FLAG
87 KB= 33278:REM  KEYBOARD CHARACTER
89 REM  *** BEGINNING OF PROGRAM PROPER ***
90 PLOT  15,6,2,12
91 INPUT "LINE LENGTH (0=DEFAULT): ";AN:IF  AN< 10 THEN  AN= LL
92 LL= AN:POKE  33289,LL
93 INPUT  "LINES PER PAGE (0=AUTO PERFORATION SKIP, 1-9=DEFAULT): ";AN
94 IF  AN< 1 THEN  AN= 0:GOTO  96
95 IF  AN< 10 THEN  AN= PL
96 PL =  AN
97 PLOT  6,3:PRINT :INPUT  "DRIVE NUMBER : ";DR
98 IF  DR < >  0 AND  DR < >  1 GOTO  97
99 CD$ =  "CD"+ CHR$ (DR+ 48)+ ": "
100 INPUT "NAME OF BASIC FILE TO LIST (WITHOUT THE .BAS) : ";F$
105 F$= LEFT$ (F$+ "     ",6)+ ".BAS"
110 INPUT  "VERSION NUMBER (0=LATEST) : ";V$
111 IF  LEN (V$)> 2 GOTO  110
112 VR =  ASC (RIGHT$ (V$,1))- 48
113 IF  VR >  9 THEN  VR =  VR- 7
114 IF  VR< 0 OR  VR> 15 GOTO  110
115 IF  LEN (V$)= 1 GOTO  130
116 A =  ASC (LEFT$ (V$,1))- 48
117 IF  A >  9 THEN  A =  A- 7
118 IF  A< 0 OR  A> 15 GOTO  110
119 VR =  A* 16+ VR
130 PLOT  6,6:INPUT "LOAD DISKETTE AND HIT RETURN";A:PLOT  6,2
135 REM  *** READ THE DIRECTORY ***
140 PLOT  27,4:PRINT "READ ";CD$;" 0 A000-A2FF":PLOT  27,27
150 BLKS= (PEEK (40961)+ 1)* 6- 2
155 PT= 24:LP= 0:LV= 0
157 REM  *** SEARCH FOR THE FILE NAME ***
160 FOR I= 1TO BLKS
170 B$= ""
180 FOR  K= 0 TO  8
185 J =  40960+ PT+ K:IF  K= 6 THEN  B$= B$+ "."
190 B$= B$+ CHR$ (PEEK (J))
195 NEXT
200 IF F$= B$THEN 260
210 PT= PT+ 21
220 IF (PT- 1)/ 128= INT ((PT- 1)/ 128)THEN PT= PT+ 2
230 NEXT
235 IF  LV< > 0 THEN  PT= LP:GOTO  300
240 PLOT  29,17:PRINT F$;" NOT FOUND ":PLOT  29,18
245 PRINT  "INSERT NEW DISKETTE OR TRY NEW NAME"
250 GOTO 90
260 J =  PEEK (40960+ PT+ 9):IF  J= VR GOTO  300
270 IF  VR< > 0 GOTO  210
280 IF  J> LV THEN  LV= J:LP= PT
290 GOTO  210
300 TT= 40960+ PT+ 10
310 C$= "":IF PEEK (TT+ 1)= 1THEN C$= "1"
320 ZX= PEEK (TT):GOSUB 400:C$= C$+ ZX$
330 Z1= (PEEK (TT+ 2)+ 256* PEEK (TT+ 3))* 128
335 ZX= INT (Z1/ 256):GOSUB 400:D$= ZX$
340 ZX= Z1- ZX* 256:GOSUB 400:D$= D$+ ZX$
345 MY= PEEK (TT+ 7)+ 256* PEEK (TT+ 8)- PEEK (TT+ 5)- 256* PEEK (TT+ 6)+ 40960
350 POKE 40960,0:PLOT 27,4
355 REM  *** READ THE FILE ***
360 PRINT "READ ";CD$;" ";C$;" A001 ";D$
370 PLOT 27,27
375 TMP= PEEK (33265)
376 INPUT "START WITH LINE # ? ";M6:IF M6< 0THEN M6= 0
377 INPUT " END  WITH LINE # ? ";M7:IF M7= 0OR M7< M6THEN M7= 65535
380 GOTO 500
400 ZA= INT (ZX/ 16):ZB= ZA+ 48:IF ZB> 57THEN ZB= ZB+ 7
410 ZX$= CHR$ (ZB):ZB= ZX- 16* ZA+ 48:IF ZB> 57THEN ZB= ZB+ 7
420 ZX$= ZX$+ CHR$ (ZB):RETURN
500 OO= 7527:R= 40961:PLOT 15,27,18,BR,27,13
502 CN= 3
505 PRINT :PRINT  "          FILE NAME: ";F$
507 IF PEEK (R)= 0THEN GOSUB 620
509 REM  *** MAIN LOOP - CHECK LINE NUMBER ON OUTPUT PAGE ***
510 IF  PL < =  0 GOTO  525:REM  PRINTER DOES AUTOMATIC PERF-SKIP
515 IF CN= > PLTHEN  FOR  I= 1 TO  SK:PRINT :NEXT  I:CN= - 1:REM  SKIP PERF
520 CN= CN+ 1
525 M8= PEEK (R+ 2)+ 256* PEEK (R+ 3)
530 IF  M8> M7 GOTO  610:REM  PAST THE ENDING LINE NUMBER?
532 REM  *** MOVE TO NEXT LINE IF STILL NOT AT STARTING LINE ***
535 IF  M8< M6 THEN  R= PEEK (R)+ 256* PEEK (R+ 1)+ OO:GOTO 525
540 S= PEEK (R)+ 256* PEEK (R+ 1):IF S= 0GOTO 600
545 S= S+ OO:PRINT :REM  NEW LINE - PRINT LINE NUMBER
550 WW$= STR$ (PEEK (R+ 2)+ 256* PEEK (R+ 3)):GOSUB 62010:PRINT  " ";
570 FOR E= R+ 4TO S- 2
575 Y= PEEK (E):IF  Y> = 32 GOTO  577
576 WW$= "^"+ CHR$ (Y+ 64):GOSUB 62010:GOTO 588
577 IF Y> 197THEN WW$= "^(";STR$ (Y);")":GOSUB 62010:GOTO 588
580 IF  Y< = 127 GOTO  585
581 WW$= TK$(Y- 128):GOSUB 62010:REM  PRINT THE TOKEN
582 IF  PEEK (E+ 1)= 32 GOTO  588:REM  FOLLOW IT BY A SPACE IF NEEDED
583 IF  SP(Y- 128)< > 0 THEN  PRINT  " ";
584 GOTO  588
585 PRINT CHR$ (Y);:REM  PRINT A SINGLE CHARACTER
588 NEXT
589 IF S= > R+ MYGOTO 610
590 R= S:GOTO 510
600 POKE 33265,TMP:PLOT 6,7:PRINT "DOUBLE ZERO ENCOUNTERED":GOTO 900
610 POKE 33265,TMP:PLOT 6,7:PRINT "END OF PROGRAM":GOTO 900
620 POKE 33265,TMP:PLOT 6,1:INPUT "EXTRA LEADING ZERO. PROCEED? (Y/N) ";Q$
623 IF LEFT$ (Q$,1)= "Y"THEN R= R+ 1:PLOT 27,13,6,2:RETURN
900 PLOT  15,27,18,BR,27,13:PRINT  CHR$ (12);
910 POKE  33265,TMP:INPUT  "LIST ANOTHER FILE ? (Y/N) ";AN$
915 PLOT  6,2
920 IF  AN$ =  "Y" GOTO  90
930 END
62000 REM  FAST OUTPUT SUBROUTINE
62010 IF  PEEK (KR)= 80 GOTO  62010:REM  WAIT ON "BREAK" KEY
62020 PRINT WW$;
62030 IF  PEEK (KB)= 8 GOTO  900:REM  "HOME" KEY ABORTS PROGRAM
62040 RETURN