1000 '  PRGM/CRT - Copyright 1978 - The Software Store, Ltd., Marquette, MI


1100 CLEAR: DEFINT A-Z: DEFSNG L
1200 WI=64 '	display width  (must be at least 40)
1300 LM=0 '	horizontal left margin
1400 PG=30 '	total number of lines per screen
1500 PL=29 '	number of print lines per screen
1600 DS$="A:" '	default disk for system programs
1700 DATA "Variable Names","Commands, Statements & Functions"
1800 DATA "Numeric Constants","Line Numbers Referenced","Quoted Strings"
1900 DIM HZ$(4): FOR I=0 TO 4: READ HZ$(I): NEXT
2100 MX=15:WX=127:Z$=DS$+"|Z|"
2200 ON ERROR GOTO 5100: OPEN "I",1,DS$+"PRGM.CTL": OP=0: ZF=0
2300 IF EOF(1) THEN END ELSE LINE INPUT #1,A$
2400 IF A$<>"THE SOFTWARE STORE" THEN 2300 ELSE INPUT #1,NM$,DR$
2500 FI$=DR$+":"+LEFT$(NM$,INSTR(NM$,".")-1)+".MAP"
2550 SX=(WI-23-LEN(NM$))\2: IF SX<2 OR PL>PG THEN STOP
2600 DV$=SPACE$(LM)+STRING$(MX-2,45)+"   "+STRING$(WI-MX-1,45)
2700 CLOSE: OPEN "I",1,FI$
2900 PC=1: GOSUB 4300: PRINT SPC(LM);HZ$(0): PRINT: LI=LI+2
3000 INPUT #1,LN,WD$: GOSUB 4000: X$=WD$
3100 IF X$<>WD$ THEN GOSUB 3800: X$=WD$
3200 IF POS(I)+5>WI+LM THEN GOSUB 3800: PRINT SPC(LM+MX+1-POS(I));
3300 PRINT USING "#####  ";LN;
3400 IF EOF(1) THEN PRINT STRING$(PL-LI-1,10): GOTO 6000
3500 INPUT #1,LN: LINE INPUT #1,WD$: WC=ASC(WD$)
3600 IF WC>127 THEN WD$=MID$(WD$,2): GOSUB 4800
3700 GOTO 3100
3800 PRINT: LI=LI+1: IF LI>PL-1 THEN GOSUB 4200
3900 IF X$=WD$ AND LI-4 THEN RETURN
4000 MQ=MX: IF LEN(WD$)>MX THEN MX=LEN(WD$)
4100 PRINT SPC(LM);WD$;SPC(MX+1-LEN(WD$));: MX=MQ: RETURN
4200 PC=PC+1: IF POS(Z)>1 THEN PRINT: LI=LI+1
4210 IF LI<PL-1 THEN PRINT STRING$(PL-LI-1,10)
4220 PRINT "Push any key for next page ... ";: XW$=INPUT$(1): PRINT
4300 LI=0:PRINT SPC(LM)"PROGRAM MAP"SPC(SX)">> "NM$" <<"SPC(SX)"Page"PC
4400 PRINT: PRINT SPC(LM)"WORD"SPC(MX-3)"LINES CONTAINING WORD": PRINT DV$
4500 IF PC<2 THEN 4700 ELSE IF WC-WX AND WC>126 THEN 4700
4600 PRINT SPC(LM);HZ$(WX-127)" (cont.)": LI=LI+1
4700 LI=LI+4: RETURN
4800 IF WC=WX THEN RETURN ELSE IF LI>PL-5 THEN GOSUB 4200: GOTO 5000
4900 PRINT: PRINT: LI=LI+2
5000 WX=WC: PRINT SPC(LM);HZ$(WX-127): LI=LI+1: RETURN
5100 CLOSE: IF ERR=53 AND ERL=2200 THEN RESUME 6100
5200 IF ERR=53 AND ERL=6100 THEN RESUME 5700
5300 IF ERR=53 AND ERL=2700 THEN RESUME 5500
5400 ON ERROR GOTO 0
5500 PRINT: PRINT "Map file cannot be found.  The FILES available are:"
5600 PRINT: FILES DR$+":*.*": PRINT: PRINT
5700 LINE INPUT "Program file name [ <CR> = end ]? ";NM$:IF LEN(NM$)=0 THEN END
5800 PRINT "Disk drive [ <CR> = "LEFT$(DS$,1)" ]? ";: LINE INPUT DR$
5840 IF INSTR(NM$,".")=0 THEN NM$=NM$+".BAS"
5850 IF LEN(DR$) THEN DR$=CHR$(ASC(DR$) AND 95) ELSE DR$=LEFT$(DS$,1)
5900 OP=-1: ZF=0: GOTO 2500
6000 CLOSE: IF OP THEN 5700 ELSE IF ZF THEN 6100 ELSE 5700
6100 OPEN "I",1,Z$: INPUT #1,NM$,DR$: IF EOF(1) THEN A$="" ELSE LINE INPUT #1,A$
6200 CLOSE 1: IF LEN(A$) THEN OPEN "O",1,Z$ ELSE ZF=0: KILL Z$: GOTO 2500
6300 OP=0: ZF=-1: PRINT #1,A$: CLOSE 1: GOTO 2500

6200 CLOSE 1: IF LEN(A$) THEN OPEN "O",1,Z$ ELSE ZF=0: KILL Z$: GOTO 2500
