Bob’s Notebook: Larken utilities

See all articles from Sinc-Link v8 n2
Author(s): Bob Mitchell; George Chambers
Publication: Sinc-Link
Pub Details: Sinc-Link v8 n2 (Volume 8, Issue 2)
Date: March/April 1990
Pages: 3

Here is a utility for the Larken DOS which will read the header information for each file on a disk and give you the first track number, start address, the length, and in the case of BASIC programs, the autostart line number.

I usually make a copy of this information for each disk and tuck it inside the sleeve; it comes in very handy when you need to know this data and you have a program loaded that you are working on. For example, you might be putting in a line to save a particular code file and have to indicate the start address and length. Finding it on the slip inside the sleeve will save some time and frustration.

The first listing is the boot file to load and control the code. The second listing is the BASIC ready for the compiled program you will make using Timachine. The program was first written by George Chambers and I have made some minor adjustments to provide space for track numbers with three digits as with Quad Drives and to show the word “none” when there is no autostart line number in a BASIC program.

Type both of these in carefully and save them a couple of times before doing the compilation. I have included some notes after some lines; of course, these are not to be typed in.

Listing #1 (Header Reader Boot File)

                                                    :COMMENTS
10 REM reader boot. Designed for use with wide printer.
50 RANDOMIZE USR 100: LOAD "reader.Cc"CODE 40000 :load compiled code
100 OUT 127,15 :set condensed mode
110 RANDOMIZE USR 100: OPEN #4,"dd" :set LKDOS PRINT #4 command
120 PRINT #4: CLOSE #3 :close LKDOS stream #3
130 PRINT #4: OPEN #5,"lp" :open stream #5 to wide printer
140 PRINT #4: POKE 16090,39 :set width of line to 40
150 PRINT #4: POKE 16094,8 :set left margin at 8
160 INPUT "drive? (0-3) ";drv :pick a drive
170 PRINT #4: GO TO drv
180 RANDOMIZE USR 40000 :activate header reader code
200 INPUT "another? (1=yes 0=no) ";an :do another or quit?
210 IF an THEN GO TO 160
220 IF NOT an THEN PRINT #4: GO TO 4: PRINT #4: NEW :if NO then load RAMDISK autostart file (see note)*
300 PRINT #4: SAVE "reader.B1" LINE 1 :GO here to save.

*If you want to quit to some other drive number, just adapt this line to your needs. Just remember: PRINT #4: NEW means load the autostart in the disk drive selected.

Listing #2 (Header Reader File ready for Compilation)

  90 REM !USR 40000                                 :forces compilation to start at add. 40000
100 REM ! OPEN # :Timachine Command
170 RESTORE 210
180 FOR n=VAL "63000" TO VAL "63077" :pokes code in lines 210-280
190 READ a: POKE n,a :into addresses 63000 to 63077
200 NEXT n
210 DATA 195,43,246,195,72,246,195,104,246,243 :this code loads/saves directory
220 DATA 205,98,0,201,58,100,0,251,201,205 :track contents from disk to
230 DATA 33,246,58,176,92,50,29,32,205,126 :buffer area at 57500
240 DATA 0,205,123,0,33,112,32,17,156,224
250 DATA 1,0,20,237,176,195,38,246,205,33
260 DATA 246,58,176,92,50,29,32,33,156,224
270 DATA 17,112,32,1,0,20,237,176,205,150
280 DATA 0,205,126,0,205,120,0,195,38,246
290 DIM c$(448) :array to make 14 blank lines
300 DIM l(100) :array to store 100 numbers
310 DIM d$(100,10) :array to store 100 names
320 LET trac=23728: LET loadbuf=63000
330 LET oo=0: LET oa=1: LET ob=2: LET oc=3: :some variables to save memory
LET od=4: LET oe=5: LET of=6: LET og=7:
LET f=oo: LET z=oo
340 LET name=57688: LET buffer=57500 :buffer starts @ 57500; file names 188 bytes later
350 BORDER oa: PAPER oa: CLS
360 PRINT AT ob,oe; INK og; PAPER oa;" LARKEN DISK
UTILITY ";AT od,ob;"Header Reader by G. Chambers";AT
of,od;"Compiled by Bob Mitchell"
370 INK og: PLOT oo,VAL "108": DRAW oo,VAL
"62": DRAW VAL "255",oo: DRAW oo,VAL "-62":
DRAW VAL "-255",oo
380 INK og: PLOT VAL "8",VAL "114": DRAW oo,VAL
"50": DRAW VAL "238",oo: DRAW oo,VAL "-50":
DRAW VAL "-238",oo: INK og
385 INPUT "printout? y/n "; LINE y$
386 LET s=2 :variable <s> is display device
387 IF y$="y" OR y$="Y" THEN INPUT "3=TS2040 5=WIDE ";s :if s=2, data goes to screen
388 PRINT #s :if s=3, to TS2040; if s=5, to wide printer
390 INPUT "Enter No. & Date (max 14)"' LINE g$: :put in I.D.
IF LEN g$>14 THEN LET g$=g$( TO 14)
395 PRINT #0;"Place disk to be read in correctdrive
then press a key"': PAUSE oo
400 REM Get names from Trk 0
410 POKE trac,oo: RANDOMIZE USR loadbuf :chooses trk 0 and loads it to buffer
420 PRINT AT of+oc,oo;c$( TO 320) :prints 10 blank lines
440 FOR n=oa TO 100
450 LET e=n :counts names found
460 IF PEEK (name+oc)=oo THEN LET e=n-oa: LET n=100: :if PEEK=0 then search ends
GO TO 530
470 IF PEEK (name+oa)=254 THEN LET name=name+34: :if PEEK=254 then look for next name
GO TO 460
480 FOR m=oa TO 9 :this loop gets the name
490 LET d$(n,m)=CHR$ PEEK (name+m)
500 NEXT m
510 LET l(n)=PEEK (name+11) :gets first track number
520 LET name=name+34
530 NEXT n
540 CLS : PRINT #s;"DISK HEADER DATA: ";g$
545 PRINT #s;"-------------------------------"
550 PRINT #s;"TRACK NAME START LENGTH S/Ln" :S/Ln=Autostart Line #
570 PRINT #s
590 PRINT #0;"(M returns to menu)": PRINT AT oc,oo
620 FOR t=oa TO e: :this loop loads first track of each file name
630 IF PEEK 23689<og THEN GO TO 830 :from each file to get required data
650 POKE trac,l(t): RANDOMIZE USR loadbuf
670 IF PEEK (buffer+oa)<>oo THEN
680 IF PEEK (buffer+oa)=oo THEN GO TO 800
685 PRINT #s;PEEK (buffer+oa);TAB od; :prints track #
690 FOR a=(buffer+ob) TO (buffer+10) :then the prog. name
700 PRINT #s;CHR$ PEEK a;
710 NEXT a
720 LET start=oo: FOR a=(buffer+ob) TO (buffer+10): :identifies BASIC files as "0"
IF PEEK a=46 AND (PEEK (a+oa)=67 OR PEEK (a+oa)=65) :others as "1"
THEN LET start=oa
730 NEXT a
740 PRINT #s;TAB 14;PEEK (buffer+12)+256*PEEK :prints start address
(buffer+13);
750 PRINT #s;TAB 21;PEEK (buffer+22)+256*PEEK :then file length
(buffer+23);
760 LET len=PEEK (buffer+17)+256*PEEK (buffer+18)+oa :gets the autostart line
770 IF len=65535 THEN LET len=-1 :makes it -1 if 65535
780 IF start=oo AND len<>-1 THEN PRINT #s;TAB 27;len: :if a BASIC file with an autostart line
GO TO 800 :then print line #
785 IF start=oo AND len=-1 THEN PRINT #s;TAB 27;"none": :if no autostart line, print "none"
GO TO 800
790 PRINT #s
800 IF INKEY$="m" OR INKEY$="M" THEN STOP :if menu called, STOP; ie, BREAK into BASIC
810 NEXT t
820 PRINT TAB od; PAPER ob;"Last file on the disk": :finally, some on-screen prompts
LET f=oa
825 IF s<>2 THEN PRINT #s''''''
830 IF z=oo AND NOT f THEN PRINT AT 19,oa;" Press any
key to clear screen"
840 IF z=oo AND INKEY$="" THEN GO TO 840
860 IF INKEY$="m" OR INKEY$="M" THEN STOP
870 PRINT AT od,oo;c$;AT og,oo;c$: PRINT AT oc,oo
880 GO TO 630
1010 IF INKEY$<>"m" OR INKEY$<>"M" THEN CLS :
PRINT AT og,oa;"Press any key for next record":
PAUSE 0: GO TO 350
8900 REM ! CLOSE # :Timachine Command
9000 RANDOMIZE USR 100: SAVE "reader.Bp" :GO here to SAVE.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.