This email address is being protected from spambots. You need JavaScript enabled to view it.

How to connect PC 1.44Mb floppy-diskette drive to oldie C64 - DDemon project


Introduction story

I will describe one of the hardest way for connecting PC and C64:
I have used standard floppy diskette drive (FDD) which uses a standard 1.44Mb diskettes. C64 computer is too slow for working with FDD which uses data transfer rate of 500Kb/sec. Because of that I have applied a DMA (Direct memory access) type of data transfer which demands additional electrical circuits .
Also I have developed a system software for controlling FDD whit ability to emulate PC-DOS system on C64 (shell as Norton Commander) which makes possible that a files from C64 can be recognized on PC and vice versa. With this (programmed in C64 assembler) you have ability to read and write to 1.44Mb diskette in format which is compatible whit DOS/Windows operating system on PC (files from C64 are readable on PC). This characteristic makes possible to transfer files from C64 to PC (and vice versa) without any software conversion.

Advanced characteristic of C64 and problems

Two advanced features of C64 (almost unknown to the most users of C64) were very helpful in constructing DDemon:

  • C64 has 512 bytes of address space reserved for I/O devices similar to the PC I/O address space of 1024 bytes in which you can find control register of serial,parallel ports and other I/O devices within PC. This address space in C64 is decoded by two signals (I/O1 and I/O2 ) which are derived on the expansion port of C64
  • C64 has DMA input making possible to stop operation of CPU and to take full control over data and address bus. You may say that C64 has already implement logic for DMA type of data transfer.

First characteristic of C64  is used to 'plug in' control registers of FDD in address space of C64 making possible to read/write control/status bits from FDD controller by simplest BASIC instructions such as PEEK or POKE.
Second thing is used for implementation of DMA transfer in which DMA input is set to '0'.
R/W line is also derived onto expansion port and it's 'pull-up' so it can be driven by any device (not only by CPU or Video Controller =VIC). Now everything is simple:
Turn FDD drive motor on, switch on controller on the AT-card with simplest instructions (from BASIC or ASS prog.).
Initiate DMA Read or Write transfer by writing specified bits in control register of FDD controller.
When FDD requests DMA operation set DMA input ='0' (stoping and degating CPU from buses).
Generate proper 16-bit address on the C64 address bus, set R/W line of C64  and drive data bus from AT-card to the C64 data bus (this is DMA- Read cycle: reading from diskette to C64 memory).
DMA transfer is very easy to implement, isn't it?
But there are some problems:
Catch 1: You cannot lower DMA input of C64 at any time. This must take place only when FI2 system clock is low and at start of  machine cycle (before CPU executes any instruction). Due to this I have to use bistabil to synchronize C64 and FDD controller.
Catch 2: CPU isn't only master on the address and data bus. Video controller (VIC) also takes control over buses by stoping CPU in order to refresh VIDEO memory (this VIDEO memory is in fact ordinary C64 memory placed at $0400).Worst thing is that this occurs only sometimes when VIC feels need to read out VIDEO memory so it took me about one month to discover this thing.
When I finally discovered that behavior of VIC I didn't have clue how to avoid this and to safely write/ read into C64 memory. It took me few months to find out control bit in VIC which is used to turn off VIC making possible to be only master at address and data bus of C64.
The screen is blank when you turn off VIC.This is accomplished by lowering bit 4 (DENy bit) at address &D011.

List of hardware and software that you need

Hardware:

  1. C64/128
  2. 1.44Mb floppy-diskette unit for PC and cable for floppy
  3. ISA card with FDD controller (you can get it from old PC's where FDD/HDD controller isn't integrated in motherboard)
  4. Interface for DMA transfer: basically it's PCB (printed circuited board) with TTL elements as interface betwen C64 and ISA card (optionally EPROM).
  5. ISA slot (can be also integrated/soldered on PCB)

Software:

  1. C64 Disk Commander (shell that looks like Norton Commander) this is the emulation of PC-DOS on C64.
  2. C64 Word this is common text editor for C64 which can store text in ASCII-format with ability to view files greater then 64Kb. Also it recognize USA,CRO i C64 character set. It can operate with 3.5inch diskettes and with cassettes.

Electric scheme of interface between C64 and ISA card

INTRO

This el. scheme looks complicated but this is due to real life digital circuits (such as 74139 and other). Logical scheme (created by simple parts such as NOT, JK and other parts) is much more understandable and simpler but I don't have time to make it.
I have never implemented EPROM module so signals such as CE,ROMH,ROML and EXROM/GAME were never used. Points (junctions) with same name are connected (e.g. CLOCK ).On scheme there are four types of signals:
INTERNAL - used only between elements on scheme (e.g. DEX2/$DFDO,CLOCK,LE,..)
C64 - connected only to the expansion port of C64 (e.g. IRQ/C64,RESET/C64,R/W,..)
AT-CARD - connected only to AT-CARD (e.g. RES/FDD,IRQ 6,DRQ 2,DACK 2,..)
SHARED - signals that are shared by C64,AT-card and this DMA interface and usually with three- state ability (e.g. data and address lines D0-D7, A0-A15)
IC 4040 has strange pin out (you can view it from EWB4 because it is custom made IC) but basically it has two controls inputs:
RESET-resets counter to zero; CLOCK - CLOCK is negative-edge sensitive input;
Two power pins: Vcc and GND
11 counter outputs (used as address lines).
For detailed description about signals on scheme you must download that zip file (at bottom of page).

DMA TRANSFER

4040 and 2*74244 are 11-bit (2048) counter with tri-state outputs. Purpose: to address C64 memory at DMA transfer (read or write).
CLOCK is negativ-edge sensitive input, CLEAR/4040 resets counter when is "1",DMA controls outputs of counter: when "0" then DMA transfer is active (address outputs of counter are connect to address bus of C64.
Function CLEAR/4040 is obtain by IRQ 6, interrupt caused by FDD.
*
First JK bistabil is used for synchronization of FDD and C64. When DRQ 2 is active ("1") then it is needed at negative edge of FI2 (system clock of c64) to pull down DMA input of C64 at "0" which halts CPU and regain control over address & data bus of  C64 (which makes possible for direct read/write in C64 memory by bringing proper address which is provide by our 11-bit counter).

PROGRAMING DMA

8-bit latch 74373 is used to memorize other address signals (A12-A15), to fully decode 16-bit address of C64.
Also contains values for other signals:
R/W (for C64, to notify C64 type of operation: read from C64 memory or write in memory
R  W  (for FDD same purpose)
These values are written just one time before DMA cycles. Latch provides change of address at which the data is to be read from or written in memory of C64 at DMA transfer (in 2KB jumps)
*
All these signals are active when DMA cycle is active (DMA ="0", DMA line is connected to OC input of latch (output enable))
To write data into latch it is needed to select it by demultiplexer 74139 with inverted signal DEX1. (LE).
When DEX1 is at "0" (C input of latch at "1" (LE=1)), then data on data bus is being written in latch.
Address of latch in C64: DFE0-DFEF.

ADDRESSING FDD REGISTERS

To access data stored on diskette it is needed to address FDD control registers:
registers are at $DFF0-$DFF7:
-with I/O1 and I/O2 the AEN signal is generated which selects all AT-card, then with address signals A0-A8 (generated by C64) it's possible to precise address FDD registers. That kind of access provides user to easly access FDD-control registers, GAME,COM1,COM2 and LPT port registers (by commands such are PEEK i POKE).
*
Also you need to generate R and W signals for FDD: R/W from C64 is inverted and connected through 74244 which isn't used in counter.
(when R/W "1": R=0 ; W=1 and vice versa)
This is necessary because these signals are needed to be disconnected (in tri-state) when DMA-cycle is active. (AEN signal controls when these signals are in tri-state: AEN ="0": R i W are active)
(lines marked by blue to differ from counter connections)
*
Note: it seems that R input of FDD has to be pulled up to power by resistor (3.3K) because when it is in tri-state it goes in "0" which causes errors.

INITIATION: signals CLEAR/JK,IRQ 6,DRQ 2

It is needed to assure that DMA-device dont turn himself on because of some reason, and to start to work from known states (JK-bistabiles).
If FDD doesn't work or if FDD registers are not initialized then IRQ 6 output from AT-card float at "1" same as DRQ 2 (signal IRQ 6 is actived at end of DMA cycle, until DRQ 2 is in non-stop use at DMA transfer).
That characteristics I have used in my schemes:
IRQ 6 signal from FDD is used as CLEAR/JK signal, when it is on "1" then he blocks JK- bistabil and clears counter (CLEAR/4040).
Also to obtain real function of IRQ 6 signal (to signalize end of DMA cycle) I have to gate it by DRQ 2 signal on IRQ line of C64 (IRQ 6 active at "1").
When DRQ 2 is at "0" then it is possible for IRQ 6 to set IRQ line of C64 at "0" ( at same time reseting counter and JK-bistabil).
*
That signal have to be gated through log. devices of OC (open collector) or Thri-state ability, because IRQ line of C64 is pull-up and you cannot connect ordinary log. device to it.

EPROM (optional)

To address EPROM you need to decode CE signal by ROMH and ROML outputs from C64.
To plug in EPROM in address space of C64 you need to set lines EXROM/GAME at "0".
Second JK bistabil (T-type) is responsible for that. It's triggered by neg. edge of  DEX2 signal (at dfd0-dfdf) from demultipexer 74139.
That means that by addressing these locations you can "turn on or off" your EPROM from C64 address space.
The RESET line of C64 is connected to CLR input of bistabil which provides to turn on EPROM just at powering-up time of C64.

demon.gif

For all those freaks out there this is export of el. scheme of Disk Demon from EWB4

 

Download stuff

Detail description (~130Kb zipped in html format) of software and mostly of hardware stuff you can find in this zip file (unzip in one temporary folder, and you should be able to see everything off-line).
It contains description in html format, pictures, source code for software and else ( you can get an el. scheme of my masterpiece in Electronic WorkBench 4 format).

Tribute to the C64

C64 C64 was my first computer (back to 1989.). You never forget your first love, so I'll keep these pages unchanged as reminder to those times. At my Univeristy www.fesb.hr I was challenged by my Digital Electronics professor that I'll never succeed to connect the C64 with 3.5 inch PC floppy diskette drive, so I made interface from bunch of 74xx digital circuits, AT controller card with FDD controller and 3.5 PC diskette drive and device worked as charm!
I've even manage to emulate and implement C64 version of Norton Commander, simple C64 File manager using FAT system, so diskette content can be read/write from both PC and C64. Normally, when my colleague had to transfer his seminar work from C64 to the PC, device stopped working, but nevertheless I still have original PCB circuit, AT card FDD controller card and of course C64 the king of all computers. It's amazing how many powerful and useful programs can be fitted into the 64Kb of memory, in now days even ordinary cell phone or PDA requires few Mbytes or even Gbytes to even start!

Everlasting COMMODORE 64, first computer of mine and of many other computer scouts. There are few of us trying to prevent falling C64 to the darknes of ignorance....



Connecting PC & C64

How to connect 1.44Mb floppy drive to C64 - find out more info about my masterpiece (this is the hardest way for connecting PC & C64).This piece of hardware (Disk Demon) allows you to easily transfer data between C64 and PC using ordinary 1.44Mb PC-diskette. Detail description of hardware and software used to accomplish that.

PC2C64 - connecting PC and C64 with parallel cable using bidirectional port - this is easiest way for connecting: you need only parallel cable to connect and bidirectional parallel port (with PS/2-EPP ability) on your PC. Characteristic of this project is safe (utilizes handshake lines and so-called CHECK-SUM check) and simple 8-bit (whole hardware is one parallel cable) transfer of data between PC and C64. Additional data about parallel cable get on my electronic page.

Utilities for PC & C64

PC:

Convert tools - once you transfer files (games) from C64 to the PC you may want to convert them into format which can be recognize by every C64 emulator.
Con_t64 converts C64 native  files into T64 (turbo tape) format which is supported by
every emulator.
Con_PC64 converts C64 native files into PC64 format supported by PC64 emulator (file extension *.p00).

C64:

Basic 2 ASCII (BtoaC200) - tool for converting BASIC program into ASCII text which can be then transfer to PC and print-out or whatever. Note: this is C64-native code so you must transfer it on C64 before using. There is source code (assembler) in ASCII format.

ASCII text editor (C64WORD) - it is conceptually similar to the MS EDIT text editor from DOS which means it has some 'advanced'  features like selecting text, copying or deleting selected text.
It can recognize a different character sets (C64,USA,CRO), it can read files bigger then 64Kb, also it can convert ASCII text in C64 BASIC format. Archive includes C64 exe and sc. code.

Games

These are my favorite games:

risk1.gif wizard.gif

R.I.S.K. - my favorite game on C64. You are space fighter fighting vicious aliens.

Wizard Of War - best game for two players ever invented!


Elite - I think that everybody knows what is it.
A.C.E. - my best avio-simulation on C64. Note: it seems that this version doesn't work on CCS64.

deathrid.gif thcats.gif

Death Ride - my favorite arcade.

Thunder Cats - another arcade with great music

 

uridium.gif dmagic.gif

Uridium - concord iron,zinc,silver spacestations.

David Magic - legendary flipper

 

C64 emulators

There are only two of them which are known to me and they are (download sites):

  • CCS64 - very best emulator for C64. 'Must have' for every C64 freak.

 

Links