Data transfer Commodore to PC

Warning: Nostalgia

Whoever owned one of these early home computers might want to transfer his or her programs to a "compatible" computer as you have it nowadays. And out there you find a lot of ways to transfer date between this incompatible worlds, either by creating special hardware interfacing the serial IEC bus to any of the PC's ports or the "wireless" version using a tape recorder and the PC's soundcard and some additional software.

If you just want to send your BASIC programs to the PC there is an easy way to get this done:
both the VIC-20/C64 and the Arduino offer a serial port that differs from the RS232 standard as they show the inverted polarity and the wrong level (0 to 5 volts instead of -12 to +12 volts).

Seen from the top. When soldering to a PCB take care: the Commodore connecters are 0.156" spacing
Seen from the rear

So you can connect the serial output of the Commodore USERPORT, pin M, PA 2, Bit 2 (CIA 2), to a SoftwareSerial RX of your Arduino.
To send your BASIC program to this port, you just need to load it an enter this command:

OPEN 1,2,0,CHR$(10): CMD1: LIST

CHR$(10) sets the baud rate for the Commodore to 2400 baud. Higher baud rates do not work.

On the Arduino you need a mini sketch like this:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(8, 9); // RX, TX
boolean quoteFlag = false;
const byte activatePin = 13;
boolean KEYBOARD = false;

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial);
  // set the data rate for the SoftwareSerial port

void loop() {
  KEYBOARD = digitalRead(activatePin);
  if (mySerial.available()) {
    char c =;
    if (c == 34) quoteFlag = !quoteFlag; 
    c = c & B01111111;
    c = tolower(c);
    if (KEYBOARD) {
      if (handle(c)) Keyboard.write(10);
    else {
      if (handle(c)) Serial.write(10);

char handle(char x) {
  boolean result = x == 13;
  if (result) quoteFlag = false;
  return result;

The tolower function only is needed if you want to paste the file into the VICE emulator.

Depending on the operating system of your PC the (c == 13) test will be necessary not to get all BASIC statements in one single line.

You might want to use an Arduino-Leonardo and replace the Serial. by Keyboard. to direct the BASIC listing immediately into the editor of your choice. But due to the implementation of the Keyboard.CPP class this will only work properly if your PC keyboard is a US type keyboard.
(See this for more information.)

You can use the quote flag to decode the cursor movement characters.

Actually, I have to admit: you do not need an Arduino to do this job; if you happen to find a COM port at your PC, you just need some kind of inverter and may be, a level shifter, which could be done by a single transistor and some resistors. A soldering iron. And a simple terminal software to store the data you received. But still, you need to change the letters "tolower". And, of course, the Arduino can be reused after doing the job.

Have fun!

contact: nji(at)