home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
CATLOG
/
KPRTLSTP.LBR
/
KPRTLST+.BQS
/
KPRTLST+.BAS
Wrap
BASIC Source File
|
2000-06-30
|
14KB
|
602 lines
REM -------------[ PRINTLST.BAS (Prints MAST.LST files) ]-----------------\
\
SPECIAL VERSION FOR KAYPRO + LEGACY TIME CLOCK \
\
\
Program written and (C) 1985 by Steven L. Sanders\
\
Date written - November 24, 1984\
\
Version 1, revision 3\
\
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.\
\
\
Revision notes \
\
Vers 1.3 - Fixed a bug from 1.2 that would cause the program to \
barf when it encountered an overrun line of nothing but disk numbers.\
It will now ignore these lines and continue with the next filename\
to be processed.\
\
----------------------------[ (C)opyrights ]---------------------------------\
copyright1$ =\
"Portions of this program (C)1983, 1984 by Digital Research "
copyright2$ =\
" The rest is (C) 1985 by Steven L. Sanders"
REM ------------------------[ DEFINE CONSTANTS ]-----------------------------\
vers$ = "1.3" REM current vers and rev
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
cur.on$ = esc$ + "B4" REM cursor on
cur.off$ = esc$ + "C4" REM cursor off
save.cur$ = esc$ + "B6" REM save current cursor position
rest.cur$ = esc$ + "C6" REM restore cursor position
stat.on$ = esc$ + "B7" REM enable status line
stat.off$ = esc$ + "C7" REM disable status line
pos.cur$ = esc$ + "=8 " REM load cursor to col 1 line 25
REM --------------------[ DEFINE FUNCTIONS ]----------------------------------\
REM position cursor
DEF fn.cursor$(v%,h%)
PRINT esc$ + "=" + CHR$(v%+32) + CHR$(h%+32);
RETURN
FEND
REM this function will center a string
DEF fn.center%(data$)
center% = (80 - LEN(data$))/2
PRINT TAB(center%);data$;
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$ + half.on$ +\
" PRINTLST v"+vers$+\
" - Formats the MAST.LST file (C)1985 Steven Sanders " + \
inv.off$ + half.off$
GOSUB clock
PRINT save.cur$+stat.on$+pos.cur$+\
" Time: " + clock.time$ + " Date: " + military.date$
PRINT rest.cur$;
PRINT:PRINT:PRINT:PRINT\
" Enter a <RETURN> now to abort, or select -"
PRINT:PRINT\
" Output to: "+inv.on$+"<P>"+inv.off$+"rinter, "+\
inv.on$+"<C>"+inv.off$+"RT, or "+\
inv.on$+"<D>"+inv.off$+"iskfile? ";
well:
PRINT bell$;
answer% = INKEY
IF answer% = 0dh THEN PRINT stat.off$ + clr$ : STOP
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 ]----------------------------------\
GOSUB chek.for.file
IF END #1 THEN thats.all
count% = 1
line% = 1
dummy% = fn.screen.two%
PRINT cur.off$; REM turn cursor off until exit
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$,15) = " " THEN\
GOTO do.it
IF MID$(input.line$,15,6) = "UNIQUE" 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% <= 51 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:\
PRINT stat.off$+clr$:\
PRINT cur.on$:\ REM turn cursor back on again
STOP\
ELSE\
dummy% = fn.new.screen%:\
GOTO do.it
WEND
thats.all:
PRINT cur.on$+stat.off$+clr$
PRINT "All done." + bell$
STOP
REM ------------------------[ output to printer ]----------------------------\
list.it:
GOSUB chek.for.file
dummy% = fn.new.screen%
PRINT:PRINT:PRINT\
" ++ Outputting MAST.LST to the printer ++"
PRINT:PRINT:PRINT\
" >> Press <A> to abort printing <<";
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 " + clock.date$ + " at " + clock.time$+ \
" 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$
WHILE CONSTAT%
abort% = CONCHAR%
IF UCASE$(CHR$(abort%)) = "A" THEN\
CONSOLE : CLOSE 1 :\
PRINT:PRINT:PRINT stat.off$+blink.on$+\
" [ Printing ABORTED ]" +\
blink.off$ + bell$:\
STOP
WEND
IF LEFT$(input.line$,15) = " " THEN\
GOTO doing.it
IF MID$(input.line$,4,5) = "DONE:" THEN\
PRINT input.line$:\
GOTO doing.it
IF MID$(input.line$,15,6) = "UNIQUE" 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
PRINT stat.off$+clr$
PRINT:PRINT "All done." + bell$
STOP
REM ------------------------[ output to diskfile ]----------------------------\
create.it:
GOSUB chek.for.file
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!":\
PRINT stat.off$:\
STOP\
ELSE\
CREATE file.form$ AS 2
PRINT:PRINT:PRINT\
" ++ Creating " + file.form$ + " - Press <A> to abort ++"
IF END #1 THEN all.formatted
line.number% = 1
count% = 1
PRINT:PRINT
PRINT USING "&";#2;\
"MASTER.LST - Master CP/M Catalog as of " + clock.date$ +\
" " + clock.time$
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:\
line.number% = line.number% + 1:\
PRINT cr$;" Now working line#";line.number%;:\
GOSUB output.the.line
READ #1;LINE input.line$
WHILE CONSTAT%
abort% = CONCHAR%
IF UCASE$(CHR$(abort%)) = "A" THEN\
CLOSE 1 : CLOSE 2 :\
PRINT:PRINT:PRINT blink.on$+\
" [ ABORTED ]"+\
blink.off$ + bell$:\
PRINT stat.off$;:\
STOP
WEND
IF LEFT$(input.line$,15) = " " THEN\
GOTO formatting.it
IF MID$(input.line$,4,5) = "DONE:" THEN\
done$ = input.line$:\
PRINT USING "&";#2;input.line$:\
GOTO formatting.it
IF MID$(input.line$,15,6) = "UNIQUE" 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$
PRINT stat.off$
STOP
chek.for.file:
IF NOT SIZE(file.mast$) THEN \
PRINT:PRINT:PRINT blink.on$+\
" >> Unable to find MAST.LST on current drive/user <<" +\
blink.off$+bell$:\
STOP \
ELSE \
OPEN file.mast$ AS 1
RETURN
REM -------------------[ Legacy clock routines ]-----------------------------\
\
For use with the Legacy Computer Systems Z-80 piggy-back\
real-time clock board. Be sure to set port equates below \
depending on whether you have the KP2/4 board or the KP10 board.
clock:
DIM TIME(13)
FOR digit = 0 TO 12
Z1 = 079h : Z2 = 07bh REM for Kaypro 10 board
REM Kaypro 2/4 board uses Z1 = 0ah : z2 = 0bh
OUT Z1,0 REM preset data reg
OUT Z2,0cfh REM set mode3
OUT Z2,0 REM all outputs mask
OUT Z1,digit REM send address
OUT Z1,digit+128 REM set latch
OUT Z1,digit
OUT Z1,020h REM set read line
OUT Z2,0cfh REM set mode3
OUT Z2,0fh REM d7-d4 are still output
OUT Z1,020h
REM read data
D1 = INP(Z1) AND 0fh
TIME(digit) = D1
NEXT digit
REM time is given in 24 hr format HH:MM:SS
clock.time$ = CHR$((TIME(5)-8)+48)+CHR$(TIME(4)+48)+":"+ \
CHR$(TIME(3)+48)+CHR$(TIME(2)+48)+":"+ \
CHR$(TIME(1)+48)+CHR$(TIME(0)+48)
IF TIME(6) = 0 THEN day$ = "Sunday"
IF TIME(6) = 1 THEN day$ = "Monday"
IF TIME(6) = 2 THEN day$ = "Tuesday"
IF TIME(6) = 3 THEN day$ = "Wednesday"
IF TIME(6) = 4 THEN day$ = "Thursday"
IF TIME(6) = 5 THEN day$ = "Friday"
IF TIME(6) = 6 THEN day$ = "Saturday"
clock.day$ = day$
REM the date is MM/DD/YY format
clock.date$ = CHR$(TIME(10)+48)+CHR$(TIME(9)+48)+ "/" +\
CHR$(TIME(8)+48)+CHR$(TIME(7)+48)+ "/" +\
CHR$(TIME(12)+48)+CHR$(TIME(11)+48)
todays.date$ = clock.date$
clock.year$ = CHR$(TIME(12)+48)+CHR$(TIME(11)+48)
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "01" THEN\
month$ = "Jan"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "02" THEN\
month$ = "Feb"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "03" THEN\
month$ = "Mar"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "04" THEN\
month$ = "Apr"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "05" THEN\
month$ = "May"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "06" THEN\
month$ = "Jun"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "07" THEN\
month$ = "Jul"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "08" THEN\
month$ = "Aug"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "09" THEN\
month$ = "Sep"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "10" THEN\
month$ = "Oct"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "11" THEN\
month$ = "Nov"
IF CHR$(TIME(10)+48)+CHR$(TIME(9)+48) = "12" THEN\
month$ = "Dec"
military.date$ = CHR$(TIME(8)+48)+CHR$(TIME(7)+48) + "-" +\
month$ + "-" + clock.year$
RETURN
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$ +\
" CB80 Error Code --> ";err
PRINT cur.on$ REM in case we bailed out in CRT mode
STOP
REM --------------------------[ the end ... ]-------------------------------\