burleigh@cica.cica.indiana.edu (Frank Burleigh) (03/03/90)
I'm grappling with DOS' disk hardware error codes. I have a TC2 program in which I install this hardware error handler, which DOS calls on error. This allows me to inspect the values of AX and DI and try to do something graceful about the error: int handler( int err, int ax, int bp, int si ) { err_val = err; /*save DI*/ ax_rtn = ax; /*save AX*/ hardretn(-1); /*return*/ }/*handler*/ I experienced a failure in a write operation and I don't fully understand the critical error I got back. The copy procedure is, in part: while( (cnt = read( ip, (char *)buf, BUFSZ ) ) > 0 ) { while( write(op, (char *) buf,cnt ) < 0 ) { /*write data*/ errormsg(); /*problem writing*/ close( op ); /*close errant file*/ unlink( dpw ); /*delete errant file*/ ... } } The values of AX (ax_rtn) and DI (err_val) after this call to write() were: AX 3F00 DI 8 Decoding AX (Duncan, p. 148) indicates a disk error writing in the files area of A: to which abort, retry and fail are acceptable responses. But I don't understand DI = 8. From a fellow netter: #define CE_SECNOTF 8 /* sector not found */ Question: assuming I have gotten the DI value correctly, how can a write operation produce 'sector not found?' [I tried the copy several times and it failed in the same way each time. Then I tried DOS' COPY, which copied with no error. I then deleted that file from the floppy and tried again with my program and it worked fine.] Question: More generally, what do the following disk hardware errors mean? (I know general failure means no format, but are there other disk problems that cause general failure to be returned?) #define CE_DATAERR 4 /* data error (bad CRC) */ #define CE_SEEKERR 6 /* seek error */ #define CE_UNKMED 7 /* unknown media */ #define CE_SECNOTF 8 /* sector not found */ #define CE_WRIFLT 10 /* write fault */ #define CE_READFLT 11 /* read fault */ #define CE_GENFAIL 12 /* general failure */ Please e-mail responses. Thank you for any information. -- Frank Burleigh burleigh@cica.cica.indiana.edu USENET: ...rutgers!iuvax!cica!burleigh BITNET: BURLEIGH@IUBACS.BITNET Department of Sociology, Indiana University, Bloomington, Indiana 47405