(* 1---Module 03---1 *) FUNCTION exists(VAR cpmfile : anyfile) : boolean; BEGIN (* exists *) (*$I-*) reset(cpmfile); (*$i-*) exists := ioresult = 0; END; (* exists *) (* 1---------------1 *) PROCEDURE searchfilecpm(filename : str20; VAR error : integer; first : boolean); CONST sizecpm_fcb = 32; searchf = 17; searchn = 18; setdmaf = 26; VAR i, j : integer; BEGIN (* searchfilecpm *) bdos(setdmaf, addr(cpm_buf)); convertname(filename, cpm_fcb.name, cpm_fcb.extention); cpm_fcb.drivecode := succ(cpm_drive); cpm_fcb.extent := 0; cpm_fcb.cr := 0; IF first THEN i := bdos(searchf, addr(cpm_fcb)) ELSE i := bdos(searchn, addr(cpm_fcb)); IF (i = $ff) THEN error := eodirectory ELSE BEGIN error := 0; i := (((i AND 3) * sizecpm_fcb) + 1); FOR j := 0 TO (namesize + typesize) DO mem[addr(cpm_fcb) + j] := mem[addr(cpm_buf[i]) + j]; END; END; (* searchfilecpm *) (* 1---------------1 *) PROCEDURE dircpm(pausing : boolean); CONST first = true; next = false; VAR errorcode, count, i, n : integer; filename : str20; BEGIN (* dircpm *) count := 0; filename := ''; IF pausing THEN BEGIN clrscr; writeln; write('Dir Mask: '); readln(filename); writeln; END; searchfilecpm(filename, errorcode, first); writeln; IF (errorcode = eodirectory) THEN BEGIN write('No File, '); continue; END ELSE BEGIN REPEAT IF ((count MOD 5) <> 0) THEN write(' ! ') ELSE IF count > 0 THEN BEGIN writeln; IF ((count DIV 5) MOD perscreen = 0) THEN pause; END; count := succ(count); FOR i := 1 TO namesize DO write(cpm_fcb.name[i]); write('.'); FOR i := 1 TO typesize DO write(cpm_fcb.extention[i]); searchfilecpm(filename, errorcode, next); UNTIL (errorcode = eodirectory) OR break; writeln; IF pausing THEN BEGIN write('File Count: ', count, '. '); continue; END; END; END; (* dircpm *) (* 1-End Module 03-1 *)