home *** CD-ROM | disk | FTP | other *** search
- PROGRAM EraseChk (input,output,diskfile);
-
- { Verifies that there are no readable sectors }
- { Used after bulk erasing to ensure data destruction }
- { Drive B is hardcoded by constant "drive" = 1 }
- { }
- { Edward Nisley / Microcomputer Consulting }
- { PO Box 8086 Poughkeepsie NY 12603 }
- { CompuServe 74065,1363 }
- { }
- { Application: IBM PC, PC-DOS 2.0/3.0 only }
- { Turbo 3.0 used for compilation }
-
- {-------------------------------------------------------}
- { Compiler directives }
-
- {+R want range checking on strings }
- {+C want ctrl-break checking for I/O }
- {+U want ctrl-break checking enabled }
-
- {-------------------------------------------------------}
- { Global constants }
-
- CONST
-
- datecode = '1 July 85';
-
- drive = 1; { select drive B }
-
- maxtrack = 39; { highest track number }
- maxhead = 1; { highest head number }
- maxsector = 9; { highest sector number }
-
- diskIO = $13; { diskette I/O intr }
- verify_op = $04; { verify sector opcode }
- nsects = 1; { num sects per op }
-
- {-------------------------------------------------------}
- { Global types }
-
- TYPE
-
- regtype = RECORD CASE boolean OF
- false : (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : INTEGER);
- true : (AL,AH,BL,BH,CL,CH,DL,DH : BYTE);
- END;
-
- {-------------------------------------------------------}
- { Global variables }
-
- VAR
-
- rc_0 : INTEGER; { sectors not erased }
- rc_2 : INTEGER; { other ret code totals }
- rc_4 : INTEGER;
- rc_16 : INTEGER;
- rc_x : INTEGER;
-
- rcode : BYTE; { disk op ret code }
-
- regs : regtype; { for BIOS interrupts }
-
- track : 0..maxtrack; { disk drive track }
- head : 0..maxhead; { disk drive head }
- sector : 1..maxsector; { disk drive sector }
-
- {-------------------------------------------------------}
- { Start of the main routine }
-
- BEGIN
-
- LowVideo;
- ClrScr;
- Writeln('EraseChk -- verifies sector destruction');
- Writeln(datecode);
- Writeln;
-
- rc_0 := 0; { count good sectors }
- rc_2 := 0; { count other ret codes }
- rc_4 := 0;
- rc_16 := 0;
- rc_x := 0;
-
-
- FOR track := 0 TO maxtrack DO
- FOR head := 0 TO maxhead DO
- FOR sector := 1 TO maxsector DO BEGIN
-
- regs.AH := verify_op; { set up opcode }
- regs.AL := nsects; { read one sector only }
-
- regs.DL := drive; { set up sector IO }
- regs.DH := head;
- regs.CH := track;
- regs.CL := sector;
-
- Intr(diskIO,regs); { do the verify op }
-
- IF (regs.flags AND $0001) <> 0 { error? }
- THEN BEGIN
- rcode := regs.AH; { some error, bad read }
- CASE rcode OF
- 2 : rc_2 := rc_2 + 1;
- 4 : rc_4 := rc_4 + 1;
- 16 : rc_16 := rc_16 + 1;
- ELSE rc_x := rc_x + 1;
- END;
- END
- ELSE BEGIN { no error, good read }
- rcode := 0;
- rc_0 := rc_0 +1;
- END;
-
- GoToXY(1,5); { present status }
-
- Writeln('Track: ',regs.CH:4);
- Writeln('Head: ',regs.DH:4);
- Writeln;
- Writeln('Return code: ',rcode:4);
- Writeln;
- Writeln('RC Total Meaning');
- Writeln(' 0 ',rc_0:4,' read OK, sector not destroyed');
- Writeln(' 2 ',rc_2:4,' address mark not found');
- Writeln(' 4 ',rc_4:4,' record not found');
- Writeln('16 ',rc_16:4,' bad CRC');
- Writeln(' ? ',rc_x:4,' other errors or combinations');
-
- END;
-
- Writeln;
- Writeln('Program complete');
-
- END.