s%=-1
ONERRORONERROROFF:PRINTs%:PRINTREPORT$+" ("+STR$ERL+")":END

DIM B% 10240

INPUT "Start sector: "s$
s% = EVAL(s$)

REPEAT

REMIF s%MOD1000 = 0 THEN PRINT s%
SYS"ADFS_SectorDiscOp",, 1, 4<<29 OR s%, B%, 512
IF B%!1 = &6b63694e THEN PROCfound
s% += 1

UNTIL0

END


DEF PROCfound
PRINT "Directory found in sector "+STR$s%
PRINT "Contents start: (name, load, exec, size)"
d% = 5
 WHILE B%?d% > 0 AND d% < 480
  PRINT FNstr(B% + d%), ~(B%!(d% + 10)), ~(B%!(d% + 14)), (B%!(d% + 18))
  d% += 26
 ENDWHILE
ENDPROC

DEF FNstr(a%)
a$=""
WHILE ?a% > 31: a$+=CHR$(?a%): a%+=1: ENDWHILE
=LEFT$(a$,10)

