home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
catlog
/
printlst.lbr
/
KPPRTLST.BQS
/
KPPRTLST.BAS
Wrap
BASIC Source File
|
1985-02-09
|
9KB
|
430 lines
REM -------------[ PRINTLST.BAS (Prints MAST.LST files) ]-----------------\
\
Program written and (C) 1984 by Steven L. Sanders\
\
Date written - November 24, 1984\
\
Version 1, revision 2\
\
Language - CBASIC Compiler (CB80)\
\
Designed for use with a video-able Kaypro computer or\
ADM3-A terminal.\
\
This program will output the contents of the MAST.LST file\
generated by XCATxx.COM into a 3-across format either to the\
CRT, printer, or diskfile. I found all the other listing programs\
to be big space-wasters when it came to the number of sheets\
needed to print-out a big catalog. PRINTLST ignores all other\
disk numbers except for the first one generated by XCAT, if you\
need a cross-ref listing then use XCAT's list output function.\
\
To use, run XCATxx on your MAST.CAT file first and choose the\
diskfile output option and generate the needed MAST.LST file.\
PRINTLST will look for MAST.LST on the logged du:, read it in\
and then generate the 3-across format to CRT, printer, or disk.\
\
----------------------------[ (C)opyrights ]---------------------------------\
copyright1$ =\
"Portions of this program (C)1983, 1984 by Digital Research "
copyright2$ =\
" The rest is (C) 1984 by Steven L. Sanders"
REM ------------------------[ DEFINE CONSTANTS ]-----------------------------\
false% = 0 REM true and false used for
true% = NOT false% REM while/wend loops
bell$ = CHR$(07h) REM console bell
cr$ = CHR$(0dh) REM carriage return
clr$ = CHR$(1ah) REM clear screen
esc$ = CHR$(1bh) REM ESCape
eos$ = CHR$(017h) REM clear to end of screen
formfeed$ = CHR$(0ch) REM printer formfeed
REM ----------------------[ KAYPRO VIDEO CODES ]-----------------------------\
inv.on$ = esc$ + "B0" REM inverse video ON
inv.off$ = esc$ + "C0" REM inverse video OFF
half.on$ = esc$ + "B1" REM half intensity ON
half.off$ = esc$ + "C1" REM half intensity OFF
blink.on$ = esc$ + "B2" REM blink ON
blink.off$ = esc$ + "C2" REM blink OFF
REM --------------------[ DEFINE FUNCTIONS ]----------------------------------\
REM position cursor
DEF fn.cursor$(v%,h%)
PRINT esc$ + "=" + CHR$(v%+32) + CHR$(h%+32);
RETURN
FEND
REM turns up a clean page under title header
DEF fn.new.screen%
PRINT FN.CURSOR$(4,0);eos$;
RETURN
FEND
DEF fn.screen.two%
PRINT FN.CURSOR$(2,0);eos$;
RETURN
FEND
file.mast$ = "mast.lst" REM source MAST.LST
sep$ = " | " REM file seperator
fil.sep$ = " | " REM output file seperator
REM -------------------[ program code begins ]--------------------------\
begin:
ON ERROR GOTO error.handler REM take care of problems
PRINT clr$ + inv.on$ + \
" PRINTLST v1.2 - Formats the MAST.LST file (C)1984 Steven L. Sanders " +\
inv.off$
PRINT:PRINT:PRINT:PRINT\
" Output to: <P>rinter, <C>RT, or <D>iskfile? (P, C, or D): ";
well:
PRINT bell$;
answer% = INKEY
IF UCASE$(CHR$(answer%)) = "P" THEN\
PRINT "Printer":\
GOTO list.it
IF UCASE$(CHR$(answer%)) = "D" THEN\
PRINT "Diskfile":\
GOTO create.it
IF UCASE$(CHR$(answer%)) <> "C" THEN GOTO well
PRINT "CRT"
REM -----------------------[ output to crt ]----------------------------------\
IF NOT SIZE(file.mast$) THEN \
PRINT:PRINT:PRINT "Unable to open MAST.LST on current du:" + bell$:\
STOP \
ELSE \
OPEN file.mast$ AS 1
IF END #1 THEN thats.all
count% = 1
line% = 1
dummy% = fn.screen.two%
PRINT\
"filename.typ - dsk | filename.typ - dsk | filename.typ - dsk"
PRINT\
"----------------------------------------------------------------------"
PRINT
WHILE true%
do.it:
IF count% > 3 THEN\
count% = 1:\
PRINT
READ #1;LINE input.line$
IF MID$(input.line$,4,5) = "DONE:" THEN\
PRINT input.line$:\
GOTO do.it
IF LEFT$(input.line$,9) = " " THEN\
PRINT input.line$:\
GOTO thats.all
PRINT LEFT$(input.line$,20);
IF count% = 1 OR count% = 2 THEN \
PRINT sep$;
line% = line% + 1
count% = count% + 1
IF line% <= 45 THEN GOTO do.it
line% = 1
PRINT:PRINT blink.on$ + " [ any key or <Q>uit ] " +\
blink.off$;
go.or.no:
dummy% = INKEY
IF UCASE$(CHR$(dummy%)) = "Q" THEN\
PRINT cr$;" ";cr$;:\
CLOSE 1:\
STOP\
ELSE\
dummy% = fn.new.screen%:\
GOTO do.it
WEND
thats.all:
PRINT
PRINT "All done." + bell$
STOP
REM ------------------------[ output to printer ]----------------------------\
list.it:
IF NOT SIZE(file.mast$) THEN \
PRINT:PRINT:PRINT "Unable to open MAST.LST on current du:" + bell$:\
STOP \
ELSE \
OPEN file.mast$ AS 1
enter.date:
dummy% = fn.new.screen%
PRINT bell$:INPUT\
" Enter today's date (MM/DD/YY): ";LINE todays.date$
IF LEN(todays.date$) <> 8 THEN GOTO enter.date
dummy% = fn.new.screen%
PRINT:PRINT:PRINT\
" ++ Outputting MAST.LST to the printer ++";
IF END #1 THEN all.printed
count% = 1
line% = 1
page% = 1
LPRINTER WIDTH 80
new.page:
PRINT\
"MAST.LST - Master CP/M Catalog as of " + todays.date$ + \
" page";page%
PRINT:PRINT\
"filename.typ - dsk | filename.typ - dsk | filename.typ - dsk"
PRINT\
"----------------------------------------------------------------------"
IF page% = 1 THEN PRINT
WHILE true%
doing.it:
IF count% > 3 THEN\
count% = 1:\
PRINT
READ #1;LINE input.line$
IF MID$(input.line$,4,5) = "DONE:" THEN\
PRINT input.line$:\
GOTO doing.it
IF LEFT$(input.line$,9) = " " THEN\
PRINT input.line$:\
GOTO all.printed
PRINT LEFT$(input.line$,20);
IF count% = 1 OR count% = 2 THEN \
PRINT sep$;
line% = line% + 1
count% = count% + 1
IF line% <= 171 THEN GOTO doing.it
line% = 1
PRINT formfeed$
page% = page% + 1
GOTO new.page
WEND
all.printed:
CONSOLE
CLOSE 1
dummy% = fn.new.screen%
PRINT:PRINT "All done." + bell$
STOP
REM ------------------------[ output to diskfile ]----------------------------\
create.it:
IF NOT SIZE(file.mast$) THEN \
PRINT:PRINT:PRINT "Unable to open MAST.LST on current du:" + bell$:\
STOP \
ELSE \
OPEN file.mast$ AS 1
enter.the.date:
dummy% = fn.new.screen%
PRINT bell$:INPUT\
" Enter today's date (MM/DD/YY): ";LINE todays.date$
IF LEN(todays.date$) <> 8 THEN GOTO enter.the.date
dummy% = fn.new.screen%
PRINT:PRINT:PRINT\
"Enter drive to create MASTER.LST on (A,B,C,or c/r for default): ";
which.drive:
PRINT bell$;
answer% = INKEY
IF answer% = 0dh THEN\
PRINT "Default":\
file.form$ = "MASTER.LST":\
GOTO get.on.with.it
IF UCASE$(CHR$(answer%)) = "A" THEN\
PRINT "A":\
file.form$ = "A:MASTER.LST":\
GOTO get.on.with.it
IF UCASE$(CHR$(answer%)) = "B" THEN\
PRINT "B":\
file.form$ = "B:MASTER.LST":\
GOTO get.on.with.it
IF UCASE$(CHR$(answer%)) = "C" THEN\
PRINT "C":\
file.form$ = "C:MASTER.LST":\
GOTO get.on.with.it
GOTO which.drive
get.on.with.it:
IF SIZE(file.form$) THEN\
dummy% = fn.new.screen%:\
PRINT:PRINT:PRINT:PRINT bell$ +\
" Program ABORTED! MASTER.LST file already exists!":\
STOP\
ELSE\
CREATE file.form$ AS 2
PRINT:PRINT:PRINT:PRINT blink.on$ +\
" ++ Creating " + blink.off$ + file.form$ + " file ++";
IF END #1 THEN all.formatted
count% = 1
PRINT USING "&";#2;\
"MASTER.LST - Master CP/M Catalog as of " + todays.date$
PRINT USING "&";#2;" "
PRINT USING "&";#2;\
"filename.typ - dsk | filename.typ - dsk | filename.typ - dsk"
PRINT USING "&";#2;\
"----------------------------------------------------------------------"
WHILE true%
formatting.it:
IF count% = 4 THEN\
count% = 1:\
GOSUB output.the.line
READ #1;LINE input.line$
IF MID$(input.line$,4,5) = "DONE:" THEN\
done$ = input.line$:\
PRINT USING "&";#2;input.line$:\
GOTO formatting.it
IF LEFT$(input.line$,9) = " " THEN\
done2$ = input.line$:\
PRINT USING "&";#2;input.line$:\
GOTO all.formatted
IF count% = 1 THEN file1$ = LEFT$(input.line$,20)
IF count% = 2 THEN file2$ = LEFT$(input.line$,20)
IF count% = 3 THEN file3$ = LEFT$(input.line$,20)
count% = count% + 1
GOTO formatting.it
WEND
output.the.line:
PRINT USING "& & & & &";#2;file1$,fil.sep$,file2$,fil.sep$,file3$
RETURN
all.formatted:
CLOSE 1
CLOSE 2
dummy% = fn.new.screen%
PRINT:PRINT:PRINT:PRINT\
" " + done$
PRINT\
" " + done2$ + bell$
STOP
REM ----------------------------[ error handler ]----------------------------\
error.handler:
IF ERR = "DW" OR ERR = "ME" THEN\
dummy% =fn.new.screen%:\
PRINT:PRINT\
" Operating system reports an error!!":\
PRINT:PRINT\
" Check disk for FREE space available" + bell$\
ELSE\
dummy% = fn.new.screen%:\
PRINT:PRINT bell$ +\
" Error Code --> ";err
STOP
REM --------------------------[ the end ... ]-------------------------------\