home *** CD-ROM | disk | FTP | other *** search
- HARD DISK DRIVE ON A C-64
-
-
-
-
- PREFACE
-
- This is an explanation of one method of connecting a hard
- disk drive to the Commodore 64 computer using a Western
- Digital controller card. Obviously there are many ways in
- which to approach this task and each will have its merits.
- Since there may be a lack of compatibility with some
- existing software this project may be of limited value and
- each one should give careful consideration to the the pros
- and cons before investing in the project. With this
- disclaimer in mind, ever onward.
-
- The task of connecting a Western Digital hard disk
- controller to the C64 is rather simple but does require
- basic soldering and wiring skills. Remember that it is
- possible to damage the C64 and/or the controller card with
- improper wiring. The cost of this project is very possibly
- more than trivial so proceed with caution. One last time,
- is it worth the risk and effort? The availability of a good
- reference manual with the pin out of the expansion port as
- well as a reference for the PC bus will help to understand
- the following directions.
-
- Before starting with the details an overview of the
- controller card might be in order. A Western Digital WX1
- controller was used in the prototype but the WX2 should work
- as well. Don't be concerned as to what BIOS ROM is on the
- card since it will not be used. There are several different
- versions of the controller cards but all should work. The
- controller writes 17 sectors each of 512 bytes on each track
- which contrasts with the 128 byte sectors on the 1541.
- Dependent upon the version of the controller card the drives
- supported can have up to 8 or 16 heads and a maximum of 1024
- cylinders. The software support described later assumes a
- limit of 8 heads. A limit of 8 heads will allow for the
- attachment of a drive with a capacity of greater than 30
- megabytes. Additionaly 2 drives can be attached to a
- controller and more than one controller could be installed
- offering a great amount of storage relative to a 1541
- diskette. A 10 megabyte drive could possibly be a good
- choice since often a used one can be bought at a very
- reasonable price. The controller supports 19 commands for
- reading, writing, formating, diagnostics, and etc. With the
- exception of the WX1GEN card there is an eight position
- header which is normally used to select which drive
- parameters to use out of a table. The 'hard disk kernal'
- doesn't use these. It reads the configuration off sector
- zero. The FORMAT program is responsible for writing the
- information on the first sector.
-
-
-
-
-
-
-
-
-
-
-
-
- HARD DISK DRIVE ON A C-64
-
-
- 2
-
- Okay, now what is needed before starting the adventure? The
- list follows.
-
- A Western Digital WX1 or WX2 controller card.
-
- A hard disk drive compatible with the controller card.
-
- An enclosure with power supply for the hard disk drive.
-
- Cables to connect the controller to the drive. (1 34
- conductor and 1 20 conductor)
-
- An edge card with .1" contact centers to plug into the
- expansion port. Radio Shack has one new in 1989
- (276-192) which will work.
-
- One 31/62 pin pc mount edge connector with .1" centers
- for the controller card. (A right angle would be
- nice.)
-
- One 14 pin IC socket.
-
- One 74LS04 IC.
-
- One .01 uf 10 volt bypass capacitor.
-
- Some 30 gauge or so wire wrap or similar wire.
-
- Possibly a separate power supply for the controller
- card. It requires +5 and +12 volts. This can be
- obtained from the supply used for the drive. Radio
- Shack has a supply with +5vdc, -5vdc, and +12vdc which
- was originally used on a Coleco which works rather
- well.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- HARD DISK DRIVE ON A C-64
-
-
- 3
-
- The pertinent pin out for the controller card follows:
-
-
- A2 D7 (data bit seven)
- A3 D6 (data bit six)
- A4 D5 (data bit five)
- A5 D4 (data bit four)
- A6 D3 (data bit three)
- A7 D2 (data bit two)
- A8 D1 (data bit one)
- A9 D0 (data bit zero)
- A22 A9 (address line nine)
- A23 A8 (address line eight)
- A24 A7 (address line seven)
- A25 A6 (address line six)
- A26 A5 (address line five)
- A27 A4 (address line four)
- A28 A3 (address line three)
- A29 A2 (address line two)
- A30 A1 (address line one)
- A31 A0 (address line zero)
- B1 GROUND
- B2 RESET (active high)
- B3 +5VDC
- B9 +12VDC
- B10 GROUND
- B13 -IOW (I/O WRITE active low)
- B14 -IOR (I/O READ active low)
- B29 +5VDC
- B31 GROUND
-
- To locate the pins on the controller card place it component
- side up with the fingers facing you. Pin A1 will be on the
- far right and A31 will be on the far left. B1, B2, etc.
- are directly behind the A pins on the opposite side of the
- card. Most if not all the cards will have A1 marked as
- such. The C64 bus needs to be mapped to the contoller which
- requires some of the signals to be inverted. The 74LS04 IC
- is used to invert the required signals and to derive the IOR
- and IOW from the C64 R/W line.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- HARD DISK DRIVE ON A C-64
-
-
- 4
-
- The pins of interest on the expansion port are:
-
- 1 GROUND
- 2 +5 volts dc
- 3 +5 volts dc
- 5 R/-W (READ if high, WRITE if low)
- 7 -I/O1 (I/O BLOCK 1, active low)
- or
- 10 -I/O2 (I/O BLOCK 2, active low)
- Either pin 7 or 10 is used for selecting the I/O
- address of the controller.
- 14 D7 (DATA BIT 7)
- 15 D6 (DATA BIT 6)
- 16 D5 (DATA BIT 5)
- 17 D4 (DATA BIT 4)
- 18 D3 (DATA BIT 3)
- 19 D2 (DATA BIT 2)
- 20 D1 (DATA BIT 1)
- 21 D0 (DATA BIT 0)
- 22 GROUND
- A GROUND
- R A7 (ADDRESS line 7)
- S A6 (ADDRESS line 6)
- T A5 (ADDRESS line 5)
- U A4 (ADDRESS line 4)
- V A3 (ADDRESS line 3)
- W A2 (ADDRESS line 2)
- X A1 (ADDRESS line 1)
- Y A0 (ADDRESS line 0)
- Z GROUND
-
-
- Looking at the back of the C64 at the expansion slot, pin 1
- is on the right top, pin 22 is on the top left, pin A is on
- the bottom right, and pin Z is on the bottom left. NOTE
- that all the alphabet isn't used in numbering the bottom
- pins, refer to a C64 description for the proper pins.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- HARD DISK DRIVE ON A C-64
-
-
- 5
-
- Armed with the above information it's time to start putting
- the adapter together. First trim the fingers of the edge
- card down to where it will properly fit into the expansion
- port 22/44 pin socket. CAUTION! Make sure it fits properly.
- A short can blow the fuse in the power supply. The
- RS-276-192 card mentioned earlier is made to fit a 36/72 pin
- socket. Next mount the 14 pin IC socket close to the
- fingers on the card followed by the 31/62 pin controller
- socket. As mentioned in the parts list a right angle would
- be great since it would allow the controller card to be
- mounted horizontally, but may be difficult to find. A wire
- wrap socket could be used and the pins bent to right angles
- and trimmed properly. Connect the fingers to the sockets as
- indicated below.
-
- C64 CONTROLLER
-
- 1 B31 GROUND
- 14 A2 D7
- 15 A3 D6
- 16 A4 D5
- 17 A5 D4
- 18 A6 D3
- 19 A7 D2
- 20 A8 D1
- 21 A9 D0
- 22 B1 GROUND
- A B10 GROUND
- R A24 A7
- S A25 A6
- T A26 A5
- U A27 A4
- V A28 A3
- W A29 A2
- X A30 A1
- Y A31 A0
- Z B10 GROUND
-
- Make the following connections to the 14 pin IC socket.
-
- IC C64 CONTROLLER
-
- 1 C -RESET
- 2 B2 RESET
- 3 7 or 10 (see text) IO1 or IO2
- 4 A22 & A23 address bits 8 and 9
- 5 5 READ/-WRITE
- 6 B14 -IOR
- 7 1 GROUND
- 8 B13 -IOW
- 9 connect to IC pin 6
- 10,11,12,13 no connection
- 14 2 & 3 +5VDC
-
-
-
-
-
-
-
-
- HARD DISK DRIVE ON A C-64
-
-
- 6
-
- The next step is to connect the +5VDC and +12VDC to the
- socket for the controller card. This power can be taken
- from the power supply in the hard disk enclosure or from a
- separate supply. Radio Shack has an inexpensive power
- supply that was made for Coleco which has +5VDC, +12VDC, and
- -5VDC. Wherever it comes from, wire the +5VDC to controller
- pins B3 and B29, the +12VDC to controller pin B9, and GROUND
- to controller pins B1, B31, and B10. With the wiring of the
- adapter complete it is time to connect a hard disk to the
- controller. Connect the 34 conducter cable to the header
- labeled J1 on the controller and the first drive to the 20
- pin header J2. The second drive connects to header J3 and
- to a second edge connector on the 34 conducter cable. These
- cables must be plugged in so that PIN 1 from the controller
- is connected to PIN 1 of the drive, etc. Most cables have a
- solid colored side coresponding to the PIN 1 side and some
- may be keyed such as to only fit the proper way. The cables
- can have a maximum length of around 10 feet. The drive
- connected to J3 will need its address switches or jumpers to
- be set for drive 2 while the drive in J2 will need to have
- its switches set for drive 1. Plug the controller card into
- the adapter and the adapter into the C64 expansion port.
- Apply power to the drive and controller card along with
- power to the 64. If all is well so far then the C64 should
- come up and run. If not, something is probably either
- mis-wired or shorted. Double check all the connections.
- Remember that a short could blow a fuse either in the C64 or
- in the power supply block. Since most of the Commodore
- supplies are not repairable, a blown fuse in the power
- supply is bad news to say the least.
-
- Once the hardware is up and apparently working it is time to
- start with the software. Available with this package is the
- 'hard disk kernal'. This kernal has the support for the
- nineteen commands. For a better explanation refer to the
- source for the kernal and read the comments. There is a
- control block used to communicate with the controller called
- the Drive Control Block (DCB) which is 6 bytes long. The
- format of the DCB is:
-
- Byte 0 - command code.
- Byte 1 - drive number (0 or 1) and head number.
- Byte 2 - Most significant 2 bits of the cylinder address
- and the sector number.
- Byte 3 - Least significant 8 bits of the cylinder
- address.
- Byte 4 - Number of sectors to read or write, or the
- interleave if formating.
- Byte 5 - Step rate for moving the heads (seeking).
-
- The DCB will need to be updated before reading or writing.
- The 'hard disk kernal' passes this information on to the
- controller. Some additional information is appended to the
- DCB which is used by the 'hard disk kernal' which is
-
-
-
-
-
-
-
- HARD DISK DRIVE ON A C-64
-
-
- 7
-
- documented in the comments of the source for the kernal.
- The success of a call to the hard disk kernal is indicated
- by CARRY being clear upon return, and CARRY set for failure.
- Reference the source for the programs for examples of some
- of the calls.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-