Floppy Controller

Floppy Controller

Post by Marc Ka » Fri, 23 Jun 1995 04:00:00



I desperately need help on programming the floppy controller directly
via registers (incl. controlling head movement etc.)! - Any ideas
where to look for info ?

TIA

Marc

 
 
 

Floppy Controller

Post by Everett Johns » Sat, 24 Jun 1995 04:00:00


marc.k...@elmshorn.netsurf.de (Marc Kane) wrote:
>I desperately need help on programming the floppy controller directly
>via registers (incl. controlling head movement etc.)! - Any ideas
>where to look for info ?
>TIA
>Marc

You need to place certain values described below in the registers
and issue interrupt 13h.  Here is an excerpt from Ralph Brown's
excellent interrupt list that  should enable you to figure it all
out.  (You can contact Ralph at  r...@telerama.pgh.pa.us)

--------B-1300-------------------------------
INT 13 - DISK - RESET DISK SYSTEM
        AH = 00h
        DL = drive (if bit 7 is set both hard disks and floppy disks
reset)
Return: AH = status (see AH=01h)
        CF clear if successful (returned AH=00h)
        CF set on error
Note:   forces controller to recalibrate drive heads (seek to
track 0)
SeeAlso: AH=0Dh,AH=11h,INT 21/AH=0Dh,INT 4E"TI Professional"
--------B-1301-------------------------------
INT 13 - DISK - GET STATUS OF LAST OPERATION
        AH = 01h
        DL = drive (bit 7 set for hard disk)
Return: CF clear if successful (returned status 00h)
        CF set on error
        AH = status of previous operation (see below)
Note:   some BIOSes return the status in AL; the PS/2 Model
30/286 returns the
          status in both AH and AL

Values for status:
 00h    successful completion
 01h    invalid function in AH or invalid parameter
 02h    address mark not found
 03h    disk write-protected
 04h    sector not found/read error
 05h    reset failed (hard disk)
 06h    disk changed (floppy)
 07h    drive parameter activity failed (hard disk)
 08h    DMA overrun
 09h    attempted DMA across 64K boundary
 0Ah    bad sector detected (hard disk)
 0Bh    bad track detected (hard disk)
 0Ch    unsupported track or invalid media
 0Dh    invalid number of sectors on format (hard disk)
 0Eh    control data address mark detected (hard disk)
 0Fh    DMA arbitration level out of range (hard disk)
 10h    uncorrectable CRC or ECC error on read
 11h    data ECC corrected (hard disk)
 20h    controller failure
 40h    seek failed
 80h    timeout (not ready)
 AAh    drive not ready (hard disk)
 BBh    undefined error (hard disk)
 CCh    write fault (hard disk)
 E0h    status register error (hard disk)
 FFh    sense operation failed (hard disk)
--------B-1302-------------------------------
INT 13 - DISK - READ SECTOR(S) INTO MEMORY
        AH = 02h
        AL = number of sectors to read (must be nonzero)
        CH = low eight bits of cylinder number
        CL = sector number 1-63 (bits 0-5)
             high two bits of cylinder (bits 6-7, hard disk only)
        DH = head number
        DL = drive number (bit 7 set for hard disk)
        ES:BX -> data buffer
Return: CF set on error
            if AH = 11h (corrected ECC error), AL = burst length
        CF clear if successful
        AH = status (see AH=01h)
        AL = number of sectors transferred
Notes:  errors on a floppy may be due to the motor failing to
spin up quickly
          enough; the read should be retried at least three times,
resetting
          the disk with AH=00h between attempts
        the IBM AT BIOS and many other BIOSes use only the low four bits
of
          DH (head number) since the WD-1003 controller which is the
standard
          AT controller (and the controller that IDE emulates) only
supports
          16 heads
        AWARD AT BIOS and AMI 386sx BIOS have been extended to handle
more
          than 1024 cylinders by placing bits 10 and 11 of the cylinder
number
          into bits 6 and 7 of DH
SeeAlso: AH=03h,AH=0Ah
--------B-1303-------------------------------
INT 13 - DISK - WRITE DISK SECTOR(S)
        AH = 03h
        AL = number of sectors to write (must be nonzero)
        CH = low eight bits of cylinder number
        CL = sector number 1-63 (bits 0-5)
             high two bits of cylinder (bits 6-7, hard disk only)
        DH = head number
        DL = drive number (bit 7 set for hard disk)
        ES:BX -> data buffer
Return: CF set on error
        CF clear if successful
        AH = status (see AH=01h)
        AL = number of sectors transferred
Notes:  errors on a floppy may be due to the motor failing to
spin up quickly
          enough; the write should be retried at least three times,
resetting
          the disk with AH=00h between attempts
        the IBM AT BIOS and many other BIOSes use only the low four bits
of
          DH (head number) since the WD-1003 controller which is the
standard
          AT controller (and the controller that IDE emulates) only
supports
          16 heads
        AWARD AT BIOS and AMI 386sx BIOS have been extended to handle
more
          than 1024 cylinders by placing bits 10 and 11 of the cylinder
number
          into bits 6 and 7 of DH
SeeAlso: AH=02h,AH=0Bh
--------B-1304-------------------------------
INT 13 - DISK - VERIFY DISK SECTOR(S)
        AH = 04h
        AL = number of sectors to verify (must be nonzero)
        CH = low eight bits of cylinder number
        CL = sector number 1-63 (bits 0-5)
             high two bits of cylinder (bits 6-7, hard disk only)
        DH = head number
        DL = drive number (bit 7 set for hard disk)
        ES:BX -> data buffer (PC,XT,AT with BIOS prior to 11/15/85)
Return: CF set on error
        CF clear if successful
        AH = status (see AH=01h)
        AL = number of sectors verified
Notes:  errors on a floppy may be due to the motor failing to
spin up quickly
          enough; the write should be retried at least three times,
resetting
          the disk with AH=00h between attempts
        this function does not compare the disk with memory, it merely
          checks whether the sector's stored CRC matches the data's
actual CRC
        the IBM AT BIOS and many other BIOSes use only the low four bits
of
          DH (head number) since the WD-1003 controller which is the
standard
          AT controller (and the controller that IDE emulates) only
supports
          16 heads
        AWARD AT BIOS and AMI 386sx BIOS have been extended to handle
more
          than 1024 cylinders by placing bits 10 and 11 of the cylinder
number
          into bits 6 and 7 of DH
SeeAlso: AH=02h
--------B-1305-------------------------------
INT 13 - FLOPPY - FORMAT TRACK
        AH = 05h
        AL = number of sectors to format
        CH = track number
        DH = head number
        DL = drive number
        ES:BX -> address field buffer (see below)
Return: CF set on error
        CF clear if successful
        AH = status (see AH=01h)
Notes:  on AT or higher, call AH=17h first
        the number of sectors per track is read from the diskette
parameter
          table pointed at by INT 1E
SeeAlso: AH=05h"FIXED",AH=17h,AH=18h,INT 1E

Format of address field buffer entry (one per sector in track):
Offset  Size    Description
 00h    BYTE    track number
 01h    BYTE    head number (0-based)
 02h    BYTE    sector number
 03h    BYTE    sector size (00h=128 bytes, 01h=256 bytes,
02h=512, 03h=1024)

 
 
 

Floppy Controller

Post by gclin.. » Sat, 24 Jun 1995 04:00:00


In article <3sdie1$...@ixnews1.ix.netcom.com>, evj...@ix.netcom.com (Everett Johnson) writes:
> marc.k...@elmshorn.netsurf.de (Marc Kane) wrote:

>>I desperately need help on programming the floppy controller directly
>>via registers (incl. controlling head movement etc.)! - Any ideas
>>where to look for info ?

If you mean you want to go straight to the I/O ports try 'The
undocumented PC'.  It has all the standard values.  Also I found
taking the bios apart quite informative... the only complication is they
support so many kinds of disk drives.  I've got a 386 protected mode
program that programs the I/O ports directly, if this is what you
are interested in give me a buzz and we'll see if we can get it to you.
You'd just have to rewrite for real mode if that's what you are interested
in.

David

>>TIA

>>Marc

> You need to place certain values described below in the registers
> and issue interrupt 13h.  Here is an excerpt from Ralph Brown's
> excellent interrupt list that  should enable you to figure it all
> out.  (You can contact Ralph at  r...@telerama.pgh.pa.us)

> --------B-1300-------------------------------
> INT 13 - DISK - RESET DISK SYSTEM
>    AH = 00h
>    DL = drive (if bit 7 is set both hard disks and floppy disks
> reset)
> Return: AH = status (see AH=01h)
>    CF clear if successful (returned AH=00h)
>    CF set on error
> Note:      forces controller to recalibrate drive heads (seek to
> track 0)
> SeeAlso: AH=0Dh,AH=11h,INT 21/AH=0Dh,INT 4E"TI Professional"
> --------B-1301-------------------------------
> INT 13 - DISK - GET STATUS OF LAST OPERATION
>    AH = 01h
>    DL = drive (bit 7 set for hard disk)
> Return: CF clear if successful (returned status 00h)
>    CF set on error
>    AH = status of previous operation (see below)
> Note:      some BIOSes return the status in AL; the PS/2 Model
> 30/286 returns the
>      status in both AH and AL

> Values for status:
>  00h       successful completion
>  01h       invalid function in AH or invalid parameter
>  02h       address mark not found
>  03h       disk write-protected
>  04h       sector not found/read error
>  05h       reset failed (hard disk)
>  06h       disk changed (floppy)
>  07h       drive parameter activity failed (hard disk)
>  08h       DMA overrun
>  09h       attempted DMA across 64K boundary
>  0Ah       bad sector detected (hard disk)
>  0Bh       bad track detected (hard disk)
>  0Ch       unsupported track or invalid media
>  0Dh       invalid number of sectors on format (hard disk)
>  0Eh       control data address mark detected (hard disk)
>  0Fh       DMA arbitration level out of range (hard disk)
>  10h       uncorrectable CRC or ECC error on read
>  11h       data ECC corrected (hard disk)
>  20h       controller failure
>  40h       seek failed
>  80h       timeout (not ready)
>  AAh       drive not ready (hard disk)
>  BBh       undefined error (hard disk)
>  CCh       write fault (hard disk)
>  E0h       status register error (hard disk)
>  FFh       sense operation failed (hard disk)
> --------B-1302-------------------------------
> INT 13 - DISK - READ SECTOR(S) INTO MEMORY
>    AH = 02h
>    AL = number of sectors to read (must be nonzero)
>    CH = low eight bits of cylinder number
>    CL = sector number 1-63 (bits 0-5)
>         high two bits of cylinder (bits 6-7, hard disk only)
>    DH = head number
>    DL = drive number (bit 7 set for hard disk)
>    ES:BX -> data buffer
> Return: CF set on error
>        if AH = 11h (corrected ECC error), AL = burst length
>    CF clear if successful
>    AH = status (see AH=01h)
>    AL = number of sectors transferred
> Notes:     errors on a floppy may be due to the motor failing to
> spin up quickly
>      enough; the read should be retried at least three times,
> resetting
>      the disk with AH=00h between attempts
>    the IBM AT BIOS and many other BIOSes use only the low four bits
> of
>      DH (head number) since the WD-1003 controller which is the
> standard
>      AT controller (and the controller that IDE emulates) only
> supports
>      16 heads
>    AWARD AT BIOS and AMI 386sx BIOS have been extended to handle
> more
>      than 1024 cylinders by placing bits 10 and 11 of the cylinder
> number
>      into bits 6 and 7 of DH
> SeeAlso: AH=03h,AH=0Ah
> --------B-1303-------------------------------
> INT 13 - DISK - WRITE DISK SECTOR(S)
>    AH = 03h
>    AL = number of sectors to write (must be nonzero)
>    CH = low eight bits of cylinder number
>    CL = sector number 1-63 (bits 0-5)
>         high two bits of cylinder (bits 6-7, hard disk only)
>    DH = head number
>    DL = drive number (bit 7 set for hard disk)
>    ES:BX -> data buffer
> Return: CF set on error
>    CF clear if successful
>    AH = status (see AH=01h)
>    AL = number of sectors transferred
> Notes:     errors on a floppy may be due to the motor failing to
> spin up quickly
>      enough; the write should be retried at least three times,
> resetting
>      the disk with AH=00h between attempts
>    the IBM AT BIOS and many other BIOSes use only the low four bits
> of
>      DH (head number) since the WD-1003 controller which is the
> standard
>      AT controller (and the controller that IDE emulates) only
> supports
>      16 heads
>    AWARD AT BIOS and AMI 386sx BIOS have been extended to handle
> more
>      than 1024 cylinders by placing bits 10 and 11 of the cylinder
> number
>      into bits 6 and 7 of DH
> SeeAlso: AH=02h,AH=0Bh
> --------B-1304-------------------------------
> INT 13 - DISK - VERIFY DISK SECTOR(S)
>    AH = 04h
>    AL = number of sectors to verify (must be nonzero)
>    CH = low eight bits of cylinder number
>    CL = sector number 1-63 (bits 0-5)
>         high two bits of cylinder (bits 6-7, hard disk only)
>    DH = head number
>    DL = drive number (bit 7 set for hard disk)
>    ES:BX -> data buffer (PC,XT,AT with BIOS prior to 11/15/85)
> Return: CF set on error
>    CF clear if successful
>    AH = status (see AH=01h)
>    AL = number of sectors verified
> Notes:     errors on a floppy may be due to the motor failing to
> spin up quickly
>      enough; the write should be retried at least three times,
> resetting
>      the disk with AH=00h between attempts
>    this function does not compare the disk with memory, it merely
>      checks whether the sector's stored CRC matches the data's
> actual CRC
>    the IBM AT BIOS and many other BIOSes use only the low four bits
> of
>      DH (head number) since the WD-1003 controller which is the
> standard
>      AT controller (and the controller that IDE emulates) only
> supports
>      16 heads
>    AWARD AT BIOS and AMI 386sx BIOS have been extended to handle
> more
>      than 1024 cylinders by placing bits 10 and 11 of the cylinder
> number
>      into bits 6 and 7 of DH
> SeeAlso: AH=02h
> --------B-1305-------------------------------
> INT 13 - FLOPPY - FORMAT TRACK
>    AH = 05h
>    AL = number of sectors to format
>    CH = track number
>    DH = head number
>    DL = drive number
>    ES:BX -> address field buffer (see below)
> Return: CF set on error
>    CF clear if successful
>    AH = status (see AH=01h)
> Notes:     on AT or higher, call AH=17h first
>    the number of sectors per track is read from the diskette
> parameter
>      table pointed at by INT 1E
> SeeAlso: AH=05h"FIXED",AH=17h,AH=18h,INT 1E

> Format of address field buffer entry (one per sector in track):
> Offset     Size    Description
>  00h       BYTE    track number
>  01h       BYTE    head number (0-based)
>  02h       BYTE    sector number
>  03h       BYTE    sector size (00h=128 bytes, 01h=256 bytes,
> 02h=512, 03h=1024)

 
 
 

Floppy Controller

Post by gclin.. » Sat, 24 Jun 1995 04:00:00




>>If you mean you want to go straight to the I/O ports try 'The
>>undocumented PC'.  It has all the standard values.

> Some others mentioned that book too, I will get it! And yes,I need to
> got to the I/O port level, unfortunately that is.....

>>Also I found taking the bios apart quite informative... the only complication is they
>>support so many kinds of disk drives.

> Aren`t they all compatible with the NEC 765 chip ? - This AT chip
> strictly limits the floppy access to tracks/sectors as far as I have
> found out. I need to control the head and motor movements directly, so
> I doubt its in the BIOS.

Yeah- but then you've got your 360K drives and your 1.2M drives and
your 720K drives and your 1.44M drives... and they all have different
numbers of tracks and sectors.  Other parameters have to be changed
as well.  And your head movements are restricted to stepping the head
for a quantum at a time, but I think you can reprogram the time intervals,
for example different drives need different step rates.

Quote:

>>I've got a 386 protected mode
>>program that programs the I/O ports directly, if this is what you
>>are interested in give me a buzz and we'll see if we can get it to you.
>>You'd just have to rewrite for real mode if that's what you are interested
>>in.

> That would certainly help! At the moment I don`t care too much about
> real/protected mode, DMA seems to be easier (should read "more
> familiar";-) in real mode. Could you send it via mail or may I get it
> at an ftp site ?

I'd love you to get it at an FTP site but it's not approved yet... I'm
running it on a 16MHZ 386 and they had problems with I/O timing
on the 100MHZ 486 they were using, so I need to test some more.  But
I'll send you the sources via mail, that is as soon as my mail server
comes up (down for hardware maintenance).

David

- Show quoted text -

Quote:

>>David

> TIA

> Marc Kane

 
 
 

Floppy Controller

Post by Marc Ka » Sun, 25 Jun 1995 04:00:00



>You need to place certain values described below in the registers
>and issue interrupt 13h.  Here is an excerpt from Ralph Brown's
>excellent interrupt list that  should enable you to figure it all


Thanks for the list! - But DOS/BIOS programming is not giving me the
amount of control I need to have. Do you have any specs for direct
controller programming for NEC 765 PC standard floppy controllers ?

Marc Kane

 
 
 

Floppy Controller

Post by Marc Ka » Sun, 25 Jun 1995 04:00:00



>If you mean you want to go straight to the I/O ports try 'The
>undocumented PC'.  It has all the standard values.

Some others mentioned that book too, I will get it! And yes,I need to
got to the I/O port level, unfortunately that is.....

Quote:>Also I found taking the bios apart quite informative... the only complication is they
>support so many kinds of disk drives.

Aren`t they all compatible with the NEC 765 chip ? - This AT chip
strictly limits the floppy access to tracks/sectors as far as I have
found out. I need to control the head and motor movements directly, so
I doubt its in the BIOS.

Quote:>I've got a 386 protected mode
>program that programs the I/O ports directly, if this is what you
>are interested in give me a buzz and we'll see if we can get it to you.
>You'd just have to rewrite for real mode if that's what you are interested
>in.

That would certainly help! At the moment I don`t care too much about
real/protected mode, DMA seems to be easier (should read "more
familiar";-) in real mode. Could you send it via mail or may I get it
at an ftp site ?

Quote:>David

TIA

Marc Kane

 
 
 

Floppy Controller

Post by Peter Harriso » Sun, 25 Jun 1995 04:00:00




Quote:>I desperately need help on programming the floppy controller directly
>via registers (incl. controlling head movement etc.)! - Any ideas
>where to look for info ?

You might look at the book
    Operating Systems - Design and Implementation
    Andrew S Tanenbaum
    Prentice-Hall
    1987
    ISBN 0-13-637-331-3

which has complete(?) source code for a unix like operating system
called MINIX. There is a compete source listing including floppy
drivers for the NEC PD765 - this is direct not via BIOS

Alternatively I guess the Linux source - widely available, try
sunsite - will have what you need although I am not able to check
just now.

Cheers
Pete

--
=============================================    For every problem there is
Peter Harrison           Handsacre, Staffs.      always a solution which is

=============================================     - And I ALWAYS find it!

 
 
 

Floppy Controller

Post by Marc Ka » Tue, 27 Jun 1995 04:00:00



>You might look at the book
>    Operating Systems - Design and Implementation
>    Andrew S Tanenbaum
>    Prentice-Hall
>    1987
>    ISBN 0-13-637-331-3
>which has complete(?) source code for a unix like operating system
>called MINIX. There is a compete source listing including floppy
>drivers for the NEC PD765 - this is direct not via BIOS
>Alternatively I guess the Linux source - widely available, try
>sunsite - will have what you need although I am not able to check
>just now.

Good idea, thanks! - I`ll try to get the sources from sunsite!

Quote:>Cheers
>Pete

Regards

Marc

 
 
 

1. QIC40/80 tapes via floppy controller

For a friend I am posting this question:

Does anybody have specifications for reading QIC40 (and possibly 80) tapes from
a tape drive connected through a floppy controller? If anybody has any source
it would be very welcome.

The reason for this is that he is trying to retrieve some data frm a tape which
cannot be read by his backup program due to damage to the directory structure
on the tape.

With hopes of lots of answers... :-)

--

Snailmail: Hovmaalvej 88-17, 2300 Copenhagen S, Denmark
Phone: (+45) 32 522 922 * Fax: (+45) 75 890 589 * BBS: (+45) 32 529 208

For every problem there's a solution that's simple, elegant, and wrong...
                                                            -- H. L. Mencken

2. Custom hover button problem

3. Can a faulty floppy controller do this to my diskettes?

4. What is a used external DD floppy drive worth?

5. Moderators note Re: Info needed on reprogramming floppy controller

6. Suggestion: Language improvement

7. Programming Irwin Tape Unit (w/ floppy controller)

8. How can I get an ALPHA in Excel4???

9. Accessing the floppy controller

10. programming the floppy controller

11. floppy controller information

12. Floppy Controller Commands

13. Information on Floppy Disk Controller