[comp.sys.ibm.pc] Panic! Hard drive crash.

6101778@PUCC.BITNET (Angus Christie) (01/06/87)

Uh huh.  And I even PARKed it first.  Oh well.  The question is
does anyone have any specs on the BIOS interrupt(s) which talk
directly to the hard drive controller card?  When I boot from a
floppy (as I am forced to do), the system insists that drive C:
is an invalid drive specifier.  What I hope to do is read as much
of the root directory and FAT as I can onto a floppy, then reFORMAT
the thing, then try to restore the sectors.
 
Am I doing the right thing?  Am I asking lots of stupid questions?
Am I whining?  Thanks for listening, anyway.
 

brown@nicmad.UUCP (Mr. Video) (01/09/87)

In article <1514@PUCC.BITNET> 6101778@PUCC.BITNET writes:
>Uh huh.  And I even PARKed it first.  Oh well.  The question is
>does anyone have any specs on the BIOS interrupt(s) which talk
>directly to the hard drive controller card?  When I boot from a
>floppy (as I am forced to do), the system insists that drive C:
>is an invalid drive specifier.  What I hope to do is read as much
>of the root directory and FAT as I can onto a floppy, then reFORMAT
>the thing, then try to restore the sectors.
> 
>Am I doing the right thing?  Am I asking lots of stupid questions?
>Am I whining?  Thanks for listening, anyway.

Attached below in my interrupt 13h assembly language program, complete
with comments on what does what.  It is part of DISKREAD program that
I distributed a while ago.

Anyway, I suspect that your disk partition table is bad.  My program
would show that to you.  Unfortunately I haven't made my program
writable to sectors yet, like Norton's does.  But the program I made
does allow the moving of a sector from one place to another, like
another hard drive.  Copy the partition table from one good drive to
another and you will probably be ok.  But I suspect that won't be
the case.  It may also be that you are getting errors from the drive
and the data is really ok.  Running my program will also report errors
reported back from the hard drive controller.  Let me know if you want
the complete program.  In the meantime, the data you wanted is below.

Good luck.

Mike Brown


          TITLE         INT13
          PAGE          ,132

;********************************************************************
;*                                                                  *
;* INT13       Version 1.0       10/21/86                           *
;*                                                                  *
;* Copyright 1986 Michael L. Brown                                  *
;*                Nicolet Instrument Corp                           *
;*                5225 Verona Rd                                    *
;*                Madison, WI  53711                                *
;*                (608) 273-5039                                    *
;*                                                                  *
;* The user is hereby granted permission to use this program.       *
;* User may not sell program.  User may change and distribute this  *
;* program, but may not charge for it.  This program may be used    *
;* in other programs, but may not charge extra for its inclusion.   *
;*                                                                  *
;* See the BASIC program DISKREAD.BAS for where to send corrections,*
;* enhancements, etc.                                               *
;*                                                                  *
;********************************************************************
          PAGE
;********************************************************************
;*                                                                  *
;* An assembly language interface to the BASIC program DISKREAD,    *
;* which allows the BASIC program to read absolute hard disk        *
;* sectors.                                                         *
;*                                                                  *
;* BASIC syntax is:                                                 *
;*                                                                  *
;*      CALL INT13(ES%,BX%,AL%,AH%,CL%,CH%,DL%,DH%)                 *
;*                                                                  *
;* The registers work as follows:                                   *
;*                                                                  *
;*      AL%   Number of sectors to read/write                       *
;*      AH%   The DISKBIOS INT 13h operation:                       *
;*                00 Reset disk/diskette                            *
;*                01 Read status of last disk operation into AL%    *
;*                02 Read sectors into memory                       *
;*                03 Write sectors into memory                      *
;*                04 Verify the sectors                             *
;*                05 Format the track                               *
;*                06 Format the track & set bad sector flags        *
;*                07 Format the drive starting at track             *
;*                08 Return the current drive parameters            *
;*                09 Initialize drive pair characteristics          *
;*                     INT 41 points to data block                  *
;*                0A Read long                                      *
;*                0B Write long                                     *
;*                0C Seek                                           *
;*                0D Alternate disk reset (see DL)                  *
;*                0E Read sector buffer                             *
;*                0F Write sector buffer                            *
;*                10 Test drive ready                               *
;*                11 Recalibrate                                    *
;*                12 Controller RAM diagnostics                     *
;*                13 Drive diagnostics                              *
;*                14 Controller internal diagnostics                *
;*      CL%   Sector number (1-17, not checked)                     *
;*      CH%   Cylinder number (0-1023, not checked)                 *
;*      DL%   Drive number (80h-87h for disk, checked)              *
;*      DH%   Head number (0-7, not checked)                        *
;*                                                                  *
;* The cylinder (track) number is 10 bits, so the upper 2 bits      *
;* of the cylinder number are placed in the top 2 bits of CL%.      *
;* The remaining 8 bits are placed into CH%.  Even tho CL% and CH%  *
;* are 16 bit BASIC integers, to the 8088, CL and CH are 8 bits.    *
;*                                                                  *
;********************************************************************
          PAGE
;********************************************************************
;*                                                                  *
;* When the INT13 program returns to BASIC, the following values    *
;* are passed back:                                                 *
;*                                                                  *
;*      AH%   The DISKBIOS INT 13h error numbers:                   *
;*                00 Operation OK                                   *
;*                01 Bad command                                    *
;*                02 Bad address mark                               *
;*                04 Record not found                               *
;*                05 Bad reset                                      *
;*                07 Init failure                                   *
;*                09 DMA boundary                                   *
;*                0B Bad cylinder (track)                           *
;*                10 Bad ECC                                        *
;*                11 Data corrected  AL% contains burst length      *
;*                20 Bad controller                                 *
;*                40 Bad seek                                       *
;*                BB Undefined error                                *
;*                FF Sense failure                                  *
;*      ES%   Segment location of data                              *
;*      BX%   Offset location of data                               *
;*                                                                  *
;* If disk parameters wanted:                                       *
;*                                                                  *
;*      CL%   Maximum useable sector & top 2 cylinder bits          *
;*      CH%   Bottom 8 bits of cylinder number                      *
;*      DL%   Number of known drives attached                       *
;*      DH%   Maximum useable head number                           *
;*                                                                  *
;* Assemble this code using the MASM assembler:                     *
;*                                                                  *
;*      MASM INT13,,INT13;                                          *
;*                                                                  *
;********************************************************************
          PAGE
PARMLST   STRUC
SAVE_BP   DW            ?               ;Save contents of BP
RET_OFF   DW            ?               ;Return address of calling program
RET_SEG   DW            ?
REGDH     DW            ?               ;Offset from DS of 8th argument
REGDL     DW            ?               ;Offset from DS of 7th argument
REGCH     DW            ?               ;Offset from DS of 6th argument
REGCL     DW            ?               ;Offset from DS of 5th argument
REGAH     DW            ?               ;Offset from DS of 4th argument
REGAL     DW            ?               ;Offset from DS of 3rd argument
REGBX     DW            ?               ;Offset from DS of 2nd argument
REGES     DW            ?               ;Offset from DS of 1st argument
PARMLST   ENDS

PARM_SIZE EQU           REGES - REGDH + TYPE REGES

CODE SEGMENT BYTE PUBLIC 'CODE'
          ASSUME CS:CODE,DS:CODE

BUFFER    DB 512 DUP(0)                 ;Set aside area for disk data

INT13     PROC          FAR
          PUBLIC        INT13
          PUSH          BP              ;Save contents of BP
          MOV           BP,SP           ;Set addressability to params
          PUSH          DS              ;Save BASIC DS and ES values
          PUSH          ES
          MOV           SI,[BP].REGAL
          MOV           AL,[SI]         ;Number of sectors to read
          MOV           SI,[BP].REGAH
          MOV           AH,[SI]         ;Function to perform
          MOV           SI,[BP].REGCL
          MOV           CL,[SI]         ;Sector number
          MOV           SI,[BP].REGCH
          MOV           CH,[SI]         ;Cylinder number
          MOV           SI,[BP].REGDL
          MOV           DL,[SI]         ;Drive number
          MOV           SI,[BP].REGDH
          MOV           DH,[SI]         ;Head number
          PUSH          CS
          POP           ES              ;Set up segment address of buffer
          MOV           BX,OFFSET BUFFER ;Offset of the address of buffer
;
; Save the ES and BX values for the BASIC program
;
          MOV           SI,[BP].REGES
          MOV           [SI],ES         ;Save segment of buffer
          MOV           SI,[BP].REGBX
          MOV           [SI],BX         ;Save offset of buffer
;
; At this point do the interrupt to get the disk data
;
          INT           13H
;
; Now we pass the info back to the program
;
          MOV           SI,[BP].REGAL
          MOV           [SI],AL         ;Save AL
          MOV           SI,[BP].REGAH
          MOV           [SI],AH         ;Save AH
          MOV           SI,[BP].REGCL
          MOV           [SI],CL         ;Save CL
          MOV           SI,[BP].REGCH
          MOV           [SI],CH         ;Save CH
          MOV           SI,[BP].REGDL
          MOV           [SI],DL         ;Save DL
          MOV           SI,[BP].REGDH
          MOV           [SI],DH         ;Save DH
;
; Clean up and return to BASIC program
;
          POP           ES
          POP           DS
          POP           BP              ;Clean up stack
          RET           PARM_SIZE       ;Restore the stack
INT13     ENDP
CODE      ENDS
          END
-- 
	   ihnp4------\				|------------------------|
	 harvard-\     \			|        terminus:       |
Mr. Video   seismo!uwvax!nicmad!brown		| The clearing house for |
	 rutgers-/     /			|     rec.arts.drwho     |
	  decvax------/				|------------------------|
	terminus-----/

d757@sphinx.UUCP (01/15/87)

Don't Panic! (Clever how I got that in isn't it?).  O.k. your problem is not
an uncommon one, as I have worked alot with PC hard drive crashes.
   
The first thing you should do is use the IBM diganostics disk that comes
with your PC_DOS manual.  Use it to check if your hard drive has spots
(bad sectors) or its actually your controller card taht has problems.
Often controller cards may seem to work with certain hard drives and then
crash for no apparent reason.  A fast solution might be to try replacing 
the controller card with another one that you know that works.  For those
taht don't know a controller card is attached by a ribbon cable to the hard
drive from one of the internal slots it if fairly easy to remove.

    Another solution might be to check you dip switch settings (located inside
your machine, and notouriosly difficult to flip) to see if your machine
is setup to read 1 floppy and 1 hard drive.

    I hope this is useful info to all.

-- 
"...nothing kills that does not know ye."
      -Meg Davis, `The Elf Glade' 
UUCP:       ihnp4!gargoyle!larry Department of Mathematics@UofC 
            ihnp4!gargoyle!sphinx!d757  Computation Center@UofC