/c64iec

Partial floppy emulation using an Arduino

Primary LanguageC++

Partial emulation of a C64 floppy drive using an Arduino.

This code emulates a C64 floppy drive to some extent.

Basically, you can LOAD and SAVE files to and from a TFTP server. The data transfer is valid
TFTP traffic. TFTP doesn't handle directory listings, so loading a directory (LOAD"$",8) is
done by having a file "list.dir" which is a prebuilt directory listing in the fake basic code
used from any other C64 floppy (no wildcards and things work).

There is most likely all kinds of timing issues remaining. Overwrite of files ("@0:"-prefix)
is not handled correctly either. No data channels supported apart from the basic LOAD/SAVE.
No fastload support.

Setup
-----

Arduino Nano
ENC28J60-based Ethernet Module
Connection to C64 using DIN6 Serial IEC connector

The IEC is connected as follows:

GND (DIN6 pin 2) to Arduino GND
ATN (DIN6 pin 3) to Arduino D3
CLOCK (DIN6 pin 4) to Arduino D4
DATA (DIN6 pin 5) to Arduino D5

Ethernet connected on SPI, with D8 as CS.


Ethernet Server
---------------

Server side uses "atftpd" and PC64-files (sort of). There is no way to list available files
from the Arduino side, so a full PC64-implementation is tricky. Directory listing (LOAD"$",8)
is possible by running the "create_listdir" (source in the tools-directory) while in the TFTP
directory and redirecting the output to a file called "list.dir".

IP is set using DHCP. No renew is sent, so the lease-time needs to be "long enough". The IP
of the TFTP-server is set using the "next-server" option in the DHCP reply. MAC address is
set to 42:42:42:01:02:03 by default (in an array in c64iec.ino). TFTP-server needs to be on
the same network as the client.


Makefile
--------

The Makefile approach requires a setup version of the Arduino-Makefile project,
found at https://github.com/mjoldfield/Arduino-Makefile.git

The Setup.mk files referenced contains the settings for the Arduino.mk:

ARDUINO_DIR   = /usr/share/arduino
ARDMK_DIR     = /usr/local
AVR_TOOLS_DIR = /usr
BOARD_TAG = atmega328
ARDUINO_PORT = /dev/ttyUSB0