Maciej Witkowiak YTM/Alliance ytm@friko.onet.pl 12.11.1999 [this article is not finished yet, but it will be actualized] [please mail me if you want to be informed] TABLE OF CONTENTS ABOUT ORIGINS NAMING CONVENTION THE 8 BIT INTERFACE THE 8 BIT DATA CABLE THE POWER ABOUT PUTTING ALL THAT STUFF INTO C64 AND OTHER POSSIBILITIES ABOUT ALL THAT STUFF IN C128 ABOUT PROGRAMMING IDE ON C64 ABOUT ORIGINS This file contains only some hints for those who would like to build IDE interface for C64 or C128. It based on documents from: ftp://ftp.elysium.pl/groups/Alliance/ide/ide.txt ftp://ftp.elysium.pl/groups/Alliance/ide/c64-ata-interface/ NAMING CONVENTION Whenever I refer to an IC by its type: 74'138, 74'139 I mean that one from the IDE interface you are going to build. Also 74'138 means 74LS138 or 74HC138 or 74HCT138. HCT chips are the best. THE 8 BIT INTERFACE If you want only to make 8 bit version (like I did - twice: in C64 and C128) then you need only a 74'138 and an inverter. Nothing else is needed. You connnect 8 lines of data and the rest as below: THE 8 BIT DATA CABLE In particular you need to connect only 17 wires. The best way is to do this by 8+9 two wire wraps. On first 8 you connect data lines, and the rest is as follows (IDE pins): GND, A0, A1, A2, /IOR, /IOW, /CS0, /CS1, /RESET (signals from 74'138, inverter and system bus of C64) I'm not sure about /RESET but it is generally A Good Thing (tm) to have it. THE POWER You'll have to find a power source capable of +5V and +12V. It's up to you to build or buy such a thing. C128 owners are lucky - original heavy duty power supply is just OK. /----\ |1234| - this is IDE HDD power connector looking on HDD from back ------ 1 - red +5V 2 - black GND 3 - black GND 4 - yellow +12V All IDE drives I've ever seen have power connector on the right side and pin 1 of it is connected by red wire - this is +5V. On the left side there's data cable and the rightmost wire is also red so there's no confusion - you always connect red-to-red. ABOUT PUTTING ALL THAT STUFF INTO C64 AND OTHER POSSIBILITES For minimal (8bit) version you need a cable (as described in this document) and two ICs - 74'138 and anything that can act as inverter - 74'00, 74'02, 74'04 and so... You'll need also one 74'139 to build address decoder if you want to place IDE in other space than I/O1 ($DE00) or I/O2 ($DF00). You need only to connect 74'138 as on scheme of c64-ata-interface and put A4 line through inverter (74'04...). I've got all signals from CPU chip but they may be taken also from expansion port pins. I've found CPU (U6) easier. Here is the description: phi1 U /RESET RDY phi2 (named CLOCK on the IDE scheme from c64-ata-interface) /IRQ R/W /NMI D0 AEC D1 VCC D2 A0 D3 A1 D4 A2 D5 A3 D6 NOTE - THIS IS ONLY FOR 6510/8500 AND NOT A4 D7 ABOUT 8502 IN C128!!! A5 P0 A6 P1 A7 P2 A8 P3 A9 P4 A10 P5 A11 A15 A12 A14 A13 GND If you would like to put the interface in other address space, then you have to install an address decoder. You can build only the half needed or the full-featured version. One 74'139 should be enough for everyone. Get VIC (U7) chip out of the socket and bend pin 10 up. Do the same with SID (U9) and its pin 8. Connect two wires to those bended pins. Connect also another two wires to corresponding pins on the board - in sockets. You may try to trace the tracks and find more comfortable place to solder. If not then the solder side of the board will be the safest choice. When you'll get those 4 signals connect everything as described below: VIC pin #10 (board) -> IC pin 15 VIC pin #10 (chip) -> IC pin 12 SID pin #8 (board) -> IC pin 1 SID pin #8 (chip) -> IC pin 4 from board - SID /CS - 1 U 16 - VCC (+5V) A8 - 2 15 - VIC /CS - from board A9 - 3 14 - A8 SID /CS on chip<- /D400 4 13 - A9 /D500 5 12 - /D000 -> VIC /CS - on chip /D600 6 11 - /D100 /D700 7 10 - /D200 8 9 - /D300 | 74'139 GND You will also have to connect pins 2+14 and 3+13 within 74'139. Those lines - A8 and A9 can be taken from CPU - pins 15 and 16 (respectively) As you see you get 5 I/O page signals - for $D100, $D200, $D300, $D500, $D600 and $D700. Pages $D5, $D6 or $D7 are generally a good thing for connecting second SID - you just solder one SID on another, but apart from pins 1-4 and 8. Then you solder two capacitors to pins 1-2 and 3-4 and /CS line from our address decoder to pin 8. If you want to have a stereo SID then don't solder pins 27 together and build a copy of amplifier from the board. You might also not to solder pins 23 and 24 because these are POTX and POTY and might be used to mesaure resistance. (stereosid is described in document on ftp.elysium.pl somewhere in /Documents directory but it contains only information for old version of SID and old C64 - with +12V) ABOUT ALL THAT STUFF IN C128 This scheme works quite weird in my C128. But first few changes - I've build it internally and I had to change some source pins. 74'138 pin #1 (R/W) -> CPU U6 pin 39 74'138 pin #5 (I/O1) -> 74'138 U3 pin 12 74'138 pin #6 (CLOCK)-> CPU U6 pin 1 /RESET was taken from MMU U7 pin 2 but it can also be found on CPU U6 pin 40. All other lines (address, data) were taken from ROMs (U34, U33) because it was the easiest way. Instead of I/O1 or I/O2 or making internal decoder (which would also be A Good Thing (tm)) I got this signal from U3 (74'138), pin 12 - this is unused and indicates I/O space, page $D7xx. Programming that is the weirdest thing. I'm personally considering making a 8522 version especially for C128 because now I'm a bit scared to try to write a sector on the disk. It goes like this: 1) it works best when 2MHz is ON and IRQ & screen (poke $d011,0) are OFF 2) it works best when 'LDA $D700' (data low register) at address like: $xx00, $xx20, $xx40, $xx60 and so on... 3) it works best when you are synchronizing with raster like this: ldy $d012 loop: cpy $d012 beq loop iny lda $d700 ; this has to be on $xx00, $xx20... sta $0400,x ;just do something inx bne loop Only when you abide those three rules you will get all bytes from IDE. Otherwise you are likely to loose from 1 to 15 or more bytes. Note that this is checked only for READing. I haven't tried to write yet. ABOUT PROGRAMMING IDE ON C64 [towrite:to be encountered and written] Seems to be more byte-leakage free but there are also some random losts - from one to four bytes. This will be checked in nearest future.