This describes the XT hard disk controller.  It is similar to most of the
non-IBM hard disk controllers which are used in PCs.  However, there is no
guarantee, especially considering that the AT uses a different setup all
together.  It is safest to let the system firmware mask the differences.

  The XT hard disk controller decodes ports 320H through 327H

The controller generates interrupt level 5 (IRQ 5) after every operation
(read, write, seek, etc.).  IRQ 5 is vectored to INT 0dH (which is also
assigned as the seldom-used IRQ for LPT2).  INT 0dH disables the Hard Disk
DMA and returns.

Port  Description
                                                                            
320H  Data register.  Write commands, read status.
Write: Always a series of bytes, written sequentially to this port.
The first byte is a controller command and the following bytes
(up to 5) describe head, cylinder, sector, and a control byte
which has a variety of definitions, too numerous for this
discussion.
Read:  When an error is sensed (port 321H, bit 1), you can write a
Sense_Cmd sequence to this register, then read it four times to
obtain everything the controller has to say.  The first byte
indicates the error.  Better check the Tech Ref for this stuff.
                                                                            
321H  Write: controller reset
Output a byte of 00H to this port to reset the controller.
Read:  controller status register
 7 6 5 4 3 2 1 0 
     d       e   
                  bit
              1: 1=error has occurred
              5: logical unit number (drive 0 or drive 1)
                                                                            
322H  Write: generate controller select pulse
Any OUT to this port enables the controller.  Use before a cmd.
                                                                            
323H  Write: DMA and interrupt mask register
 7 6 5 4 3 2 1 0 
   not used  i d 
                  bit
      0: 1=enable DMA, 0=don't use DMA
      1: 1=enable interrupt after ctrlr command (IRQ 5)
                                                                            
See Also: INT 13H (disk I/O)
- -

XT Hard Disk Ports