How to turn your 5307 into a Hard Drive Controller:



First of all, I needed to procure a working IDE hard drive, which I took out of an old computer.  While I was at it I grabbed a standard PC power supply to power the drive:

The Hard Drive is a WD Caviar 33100 with a 3 GB capacity.  Since my program will only write one sector (512 bytes) at a time, this is more than sufficient.

The power supply is a Senstron standard PC power supply.



There are no 40-pin connectors on the 5307 board.  I decided to send a 40-bit signal to the 60-pin expansion connector J9.  I purchased a 60-pin IDC socket connector and attatched it to the end of the 40-pin ribbon cable:



The controller works by holding a 40-bit value in two registers (the upper 8 bits in D1, the lower 32 bits in D2).  The program can change the value of any of the signals used, and can either write the values in the registers to the J9 connector, or read from the J9 into the registers.  It can also change the current LBA to an arbitrary value.

Subroutines used in the program:
INITIALIZE
Sets up the start state

SET_CS1FX
SET_CS3FX
SET_DIOR
SET_DIOW
SET_RESET
SET_DA
Sets the bit or bits to the value passed in D5

SET_DATA
Writes data from D5 to the data bits in the 40-bit registers.

GET_DATA
Writes the data word stored in the 40-bit registers to the buffer pointed to by A0

WAIT
Used to create a programmed delay for timing purposes

OUTPUT
Writes the current state of the 40-bit registers to the J9 connector

INPUT
Reads the current state of J9 into the 40-bit registers.

SET_LBA
Changes the LBA to the value in D0.  D0 is cleared when this subroutine excecutes.

A copy of my code is availible here.