Larken Directory (Track 0) Repair

See all articles from Update April 1989

The track directory for the Larken disk system is located on track 0. This directory stores the data that is required by the system to locate and load the chosen file. On occasion the system, for obscure reasons, is prone to corrupting the directory track, thus effectively causing the loss of all programs on the disk. This problem is more apparent on the first vintage of the system, nevertheless it could occur on any system. This program is designed to restore the track directory to its pristine newness!!

The program is able to do this because of the design of the LARKEN systen whereby the program name (also it’s starting address, and length) is stored at the beginning of each track.

The program commences by working it’s way through the disk, track by track, picking the program name off each track. It stores this information in a string array, then using this information it reconstructs a new directory in memory and saves it to track 0.

Although the program does a very effective job there are a couple of points to be aware of. The program will restore to the directory track a record of every program file that it finds on the disk. This includes any programs which may have been erased in the original state. Now, this in itself does not present a problem. A problem can arise however, if the erased program is not complete. i.e. some of it’s tracks have been reused with by a subsequent SAVE. In this case a program will be shown as recovered, but in fact it has been only partially recovered. The solution is to do a manual erase of any such programs.

The program listing here is for LARKEN systems which hold 5090 bytes/track. This is the system which is currently being marketed by Larken Electronics. I have provided a list of the program lines which need to be changed to make the program suitable for the earlier LARKEN systems which hold 1960 bytes/track.

 100 REM  Disk Directory
Repair for the LARKEN system

110 REM By G. Chambers
14 Richome Court Scarbo
rough, Ont. CANADA M1K 2Y1

120 REM Use to reconstruct a dama
ged Directory(Track 0)
130 REM Data statements contain
the"RHMDOS.C2" Code.
136 REM For use with the DSK400 syst
em of 5090 bytes/track using DD drives
i.e.80 tracks
140 GO TO 160
150 RANDOMIZE USR 100: SAVE "repair.B1" L
INE 160
160 RESTORE 210
170 FOR n=63000 TO 63104
180 READ a: POKE n,a
190 NEXT n
210 DATA 195,43,246,195,72,246,195,104,24
6,243,205,98,0,201,58
220 DATA 100,0,251,201,205,33,246,58,176,
92,50,29,32,205,126
230 DATA 0,205,123,0,33,112,32,17,156,224
,1,0,20,237,176
240 DATA 195,38,246,205,33,246,58,176,92,
50,29,32,33,156,224
250 DATA 17,112,32,1,0,20,237,176,205,150
,0,205,126,0,205
260 DATA 120,0,195,38,246,205,33,246,205,
129,0,205,123,0,33
270 DATA 112,32,17,156,224,1,0,20,237,176
,195,38,246,201,0
290 DIM a$(79,9): DIM c$(79,9): DIM b$(9)
: DIM d$(256)
300 LET trac=23728: LET nexttrack=63006:
LET loadbuf=63000: LET savebuf=63003
310 LET D=79: LET e=1: LET f=1: LET buffe
r=57500: LET name=57688: LET trackno=5769
8
312 BORDER 1: PAPER 1: CLS
320 PRINT AT 2,7; INK 2; PAPER 6;"LARKEN
DISK UTILITY"; PAPER 1;,,TAB 2; PAPER 6;"
Directory (Track 0) Recovery"; PAPER 1,,T
AB 7; PAPER 6;"By George Chambers"
325 INK 3: PLOT 0,108: DRAW 0,62: DRAW 25
5,0: DRAW 0,-62: DRAW -255,0
326 INK 6: PLOT 8,114: DRAW 0,50: DRAW 23
8,0: DRAW 0,-50: DRAW -238,0: INK 7
350 PRINT AT 10,0;d$;AT 14,2;"Insert your
defective disk"''TAB 2;"and press any ke
y to start": PAUSE 0
360 REM Picking program names off
each successive track
370 POKE trac,1: RANDOMIZE USR loadbuf
380 PRINT AT 10,0;d$
390 PRINT AT 10,0;d$;AT 10,1;"Lifting nam
es off disk tracks";AT 13,8;"Track Prog
ram"
400 PRINT AT 14,9;"No. Name"
410 FOR n=1 TO 79
415 IF n>1 AND PEEK 57500=0 AND PEEK 5750
1=0 THEN LET n=79: GO TO 490
420 LET d=n
430 FOR m=1 TO 9
440 LET a$(n,m)=CHR$ PEEK (57501+M)
450 NEXT m
460 PRINT AT 16,9;n;" ";a$(n)
480 IF n<79 THEN RANDOMIZE USR nexttrack

490 NEXT n
500 REM Placing Used/Free track reco
rd in buffer (Track 0)
501 PRINT AT 10,0;d$;AT 14,1;"Install a n
ewly-formatted disk"''TAB 6;"and press an
y key": PAUSE 0
502 POKE trac,0: RANDOMIZE USR loadbuf
503 PRINT AT 10,0;d$;AT 14,1;"Now re-inse
rt defective disk"''TAB 2;"and Press any
key to continue": PAUSE 0
520 FOR n=0 TO d
530 POKE 57524+n,245
540 NEXT n
550 REM Compile the program
names into C$ array
560 PRINT AT 9,0;d$;AT 9,0;"Reconstructio
n of the directory will take a couple of
minutes"''TAB 10;"Please wait"''TAB 4;"Co
mpiling program names"
570 LET c$(1)=a$(1)
580 FOR n=2 TO d
590 LET b$=a$(n)
600 LET f=0
610 FOR m=1 TO e
620 IF b$=c$(m) THEN LET f=1
630 NEXT m
640 IF f=0 THEN LET e=e+1: LET c$(e)=b$
650 PRINT AT 16,11;c$(e)
660 NEXT n
670 REM Poke pgm names into
buffer(Track 0)
675 PRINT AT 13,0;d$;AT 14,0;"Putting tra
ck names in directory"
680 FOR n=1 TO e
685 PAUSE 30
690 FOR m=1 TO 9
700 POKE name+m,CODE c$(n,m)
710 NEXT m
720 LET name=name+34
730 PRINT AT 16,11;c$(n)
740 NEXT n
750 REM Poke track numbers in
to buffer (Track 0)
760 LET f=1
770 PRINT AT 13,0;d$;AT 14,0;"Putting Tra
ck No's in Directory"
780 FOR n=1 TO e
790 LET f=1
800 FOR k=1 TO 79
810 IF c$(n)=a$(k) THEN POKE trackno+f,k
: LET f=f+1: POKE trackno+f,249
820 NEXT k
830 LET trackno=trackno+34
840 PRINT AT 16,11;c$(n)
850 NEXT n
860 PRINT AT 9,0;d$;AT 10,1;"The director
y has been rebuilt"'''' PAPER 5; INK 2;"R
emove WRITE-PROTECT label from defective
disk and install. '''' Press a key to
save to track 0 ": PAUSE 0
870 POKE trac,0: RANDOMIZE USR savebuf
880 PRINT AT 11,0;d$;AT 13,9;"JOB COMPLET
ED": PAUSE 0
890 STOP
1000: SAVE "repair" LINE 10

The following lines should replace those in the “REPAIR.B1″listing to make the program suitable for the LARKEN systems that format to 1960 bytes per track i.e. the earlier systems.

 135 REM For disks made prior to the Larke
n cartridge DOS,modify lines 720 and 830,
replacing the 34 in each line with a
33.
136 REM Use only with the LKDOS system
i.e. 1960 bytes/track.
240 DATA 195,38,246,205,33,246,58,176,92,
50,29,32,33,16,248
250 DATA 17,112,32,1,192,7,237,176,205,15
0,0,205,126,0,205
270 DATA 112,32,17,16,248,1,192,7,237,176
,195,38,246,201,0
310 LET D=79: LET e=1: LET f=1: LET buffe
r=63500: LET name=63608: LET trackno=6361
8
415 IF n>1 AND PEEK 63518=0 AND PEEK 6351
9=0 THEN LET n=79: GO TO 490
440 LET a$(n,m)=CHR$ PEEK (63505+m)
480 IF n<79 THEN OUT 84,8: PAUSE 3: RAND
OMIZE USR nexttrack
530 POKE 63527+n,n+127
810 IF c$(n)=a$(k) THEN POKE trackno+f,k
+128: LET f=f+1: POKE trackno+f,249