Solid State Tape Device for the (micro)KIM

Pin It

KIM-1 AddIn 1976 I bought my first computer. That was at a time when there was no internet, there where no PC or Apple’s! Computers where meant for big company’s like insurance compagnies and multi nationals. No one had a computer at home. It was the time of the Homebrew Computer Club and Byte magazine. I had a Byte magazine subscription and at a certain point there was an advertisement in it from MOS-Technology for a single board computer called the KIM-1.

If I remember correctly, I, one-way-or-an-other (remember, there was no internet, no email, no PayPal. only had The Yellow Pages and a Phone Book from the city of Amsterdam), found a distributer in the Netherlands where I ordered this piece of magic.

Much later, in 2016,I went to the Apple Museum Nederland in Orvelte and that visit was a trip down memory lane.
Searching the net I found there are quit a lot of Apple ][ emulators and replica’s, but there was also a KIM-1 replica, called the microKIM. I bought the microKIM as a kit from Vincent Briel but due to some missing and some wrong parts (mainly a 65C02 processor that did not comply with the timing of the original 6502 processor and the microKIM design) it took me almost a year and the help of Timothy Alicie (who had a solution for the timing problem) and Jac Goudsmit to get the microKIM working.

The microKIM is as close to the original as possible. There are some differences in the hardware due to the unavailability of some parts and newer parts that are more capable than the parts that where available in the 1970’s. Vince designed a RS232 interface as a replacement for the original TTY interface. So you can connect the microKIM to a computer with a “RS232 to USB” cable and program the microKIM from a terminal program (I use CoolTerm).
From a software point of view the extra RAM (5 kilobyte in stead of 1 kilobyte) and the absence of the first timer at address $1704 (5,6,7) are important. Only the timer at address $1744 (5,6,7) is available which you have to take into account if you want to use a program written for the original KIM-1.

To get “the real vintage feeling” I wanted to design a “solid state” cassette interface that “works” like a real cassette recorder. With the original KIM-1 it was possible to store more than one program on a cassette tape and by keeping track of the tape-counter (writing it down on the cassette) one could position the tape at the start of a particular program, punch in some magic numbers on the KIM-1, press the “GO” button to start the tape-loading program and then press the “play” button on the cassette recorder. Some squeezing sounds (like the one you might know from the early modems) later and after a few minutes the program was loaded into the KIM-1.
Recording was similar with some other magic numbers and pressing the “record” and “play” button on the cassette recorder simultaneously.

A program is recorded to tape using two frequency’s; 3.623 Hz and 2.415 Hz to convert ‘1’ and ‘0’ bits to a pulse-train.

(page E-3 of the KIM-1 User Manual)

Decoding the pulse-train
I tried to let the ESP8266 decode this pulse train but the timing is too tight to decode the train into bits and also be able to convert the bits in bytes and store them to a file. So I fell back to the mighty little ATtiny85 processor to convert only the pulse train to ‘1’ and ‘0’ bits and feed the bits to the ESP8266 for further handling. The duration of one bit takes 7.452 milli seconds.

To distinguish between a ‘1’ or ‘0’ bit the ATtiny only has to record the duration of the change in frequency from long- to short- and from short- to long-pulses. It starts a timer at the moment the pulse duration changes from approx. 414 µSeconds to 276 µSeconds. The timer stops at the moment the pulse changes back to ~414 µSeconds.
If the duration is shorter than 3.726 milli seconds it has found a ‘1’ and makes the output pin High and if the duration is longer than 3.726 milli seconds it has found a ‘0’ and it makes the output pin Low.

To load a program from the Tape Device to the KIM we can skip the modulation to the 3kHz and 2kHz frequency’s and simply feed the one’s and zero’s to the KIM.

Design Goals
The Tape Device user interface must consist of the four buttons found on every cassette recorder. A “fast rewind”, “record”, “play” and “fast forward” button (on the real cassette recorder there also is a “stop” button but we won’t use that button in this design).

Because of the today’s possibilities and state of technology we can store a large amount of program’s on a small device so we need a way to present to the user where we are on the “tape” but we can present more than just a tape-counter. Wouldn’t it be nice if, besides the tape-counter, there was room for a description of the program and maybe the start address to run the program from. And because a large number of program’s can be stored on this device it would also be nice to be able to write-protect a program so it can’t accidentally be overwritten.

I have chosen to use a ESP8266 processor on a small board from Wemos (the Wemos D1 mini). Wemos D1 miniFrom the EEPROM memory of the ESP8266 about 3 Megabytes is used as a filesystem to store programs.
This Wemos D1 board has an USB port to program the ESP8266 and that port can also be used as an interface to a computer, which we will use to enter a description to a program and to make the program Read Only or Read/Writable.

SD1306 OLED For the display the SD1306 with an I2C interface is perfect. This picture shows that as sequence $07 (it’s a hexadecimal number) a program with the description “chessClock” is stored. The program is “Read Only” and the start address is $0200.

The KIM is a 5 volt device and the ESP8266 is a 3.3 volt device (the ATtiny can be both, but we power it with 5 volt) so to connect signals to one-another, level shifters are necessary. N-Channel MosFets are ideal suited for this task.

This is the hardware design:

The software for the ATtiny and the ESP8266 can be found on GitHub.

And here you find a short demo of the KIM Tape Device:

Dit bericht is geplaatst in Computer, ESP8266, KIM met de tags , , , , , . Bookmark de permalink.

6 reacties op Solid State Tape Device for the (micro)KIM

  1. Pingback: ESP8266 as a Tape Drive – High Tech Newz

  2. Pingback: ESP8266 as a Tape Drive

  3. Hessel schreef:

    Leuk project!

    Het lijkt mij leuk om eentje maken voor mijn Multitech MPF-1 single board computer. Dat lijkt me met een aanpassing van _SHORT, voor de andere frequenties, in de code voor de ATTINY85 wel goed te doen.

    Helaas zit op de MPF-1 pin PC7 van de 8255 voor het output signaal niet op de connector, kijken of die ergens af te tappen is. . . .

    • Willem Aandewiel schreef:

      Hi Hessel,

      Nice you like my project.
      It looks like the MPF-1 tape interface is about half the speed of the KIM-1. So it most certainly is possible to use the Solid State Tape Device for the MPF-1.
      Indeed you have to wire the PC7 (and PA7?) pin(s) to the SSTD. You may also have to change the timing of the playbackTape function (#define _SHORT) if the MPF-1 does not like the high speed playback and of course the “#define _SHORT” in the ATtinyPLL program to reflect the 2kHz tones.

      Keep me posted on your progress!

  4. jan iemhoff schreef:

    Hallo all-male

    Is het mogelijk het dat PCB ergens te kopen.

    Groetjes vanuit verschneuwd Germany.

    • Willem Aandewiel schreef:

      Hi Jan,

      I’m afraid I have not made a PCB for the Solid State Tape Device, but you can built it quite simple with a standard PCB like this one or this one.
      I can send you the KiCAD files and than you can send them to a PCB maker (I’m very fond of PCBWay; fast and cheap).


Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *