[Return to Main Page]

What is the KIM-1? by Ruud Baltissen
[Up to Early Microcomputers and Trainers]


DISCLAIMER

Copyrights


What is the KIM-1?

The KIM-1 is the first computer developed by Commodore, or better, MOS. MOS was an IC producing factory which Commodore took over to be sure of a constant supply of ICs. Commodore produced calculators before but I don't consider a calculator the same as a computer as long as you cannot program it. The KIM-1 has 1152 bytes of RAM, 2048 bytes of ROM and 30 I/O-lines. Some of these lines are used to drive six 7-segment LED-displays and others are used to read the little hexadecimal keyboard.

The manuals state that the KIM-1 can be connected to a serial teletyper/teleprinter in full duplex mode. The KIM-1 has the capability to adjust automatically for a wide variety of data rates. (10 CPS, 15 CPS, 30 CPS etc...) {** Personal note: I think 1 CPS is +/- 10 Baud **} The KIM-1 was originally developed to be connected to these teletypers by means of two current-loop-connections. The current used may be 20 or 60 mA. But I can imagine that nowadays these teletypers are very hard to find. A small manual named "KIM-1 HINTS" gives us a solution in the form of a little circuit which enables you to connect a teletyper with a RS232-interface. I can hear you think: "I don't have a RS232-teletyper either!". But if you are able to read this document, you posses a computer capable of emulating one. I'm thinking of programs like PROCOMM or KERMIT for the PC and NOVATERM for the C64.

A computer without the possibility to load or store programs is not very good at all. The KIM-1 has the ability to load and store programs on papertape and/or cassette recorder. As paper-tape readers/punchers are hard to find as well, I think the average KIM-owner is limited to the recorder.

The Hardware

The well-known 6502 is the heart of the KIM-1 and doesn't need any further explanation.

The 1K of RAM is comprised of eight 6102s. The 6102 is the MOS-equivalent of the 2102 which is a 1K*1 RAM.

The 6530 is a different and quite complicated story. This IC contains 64 bytes of RAM, 1024 bytes of ROM, a timer and 16 I/O-lines. For more information I advise you to read my 6530 document.

A closer look at my KIM-1 schematic will reveal that only 8 KB is decoded by a 74145, 4-to-10-multiplexer. This means that the whole configuration is mirrored another 7 times within the 64 KB boundary.

Within the 8 KB-boundary the system looks like this:

K0   $0000 - $03FF    1024 bytes of RAM (8*6102)
K1   $0400 - $07FF    free
K2   $0800 - $0BFF    free
K3   $0C00 - $0FFF    free
K4   $1000 - $13FF    free
K5   $1400 - $16FF    free
     $1700 - $173F    I/O, timer of 6530-003
     $1740 - $177F    I/O, timer of 6530-002
     $1780 - $17BF    64 bytes RAM of 6530-003
     $17C0 - $17FF    64 bytes RAM of 6530-002
K6   $1800 - $1BFF    1024 bytes ROM of 6530-003
K7   $1C00 - $1FFF    1024 bytes ROM of 6530-002

K0..K7 = output lines from 74145

Notice the way how the I/O- and RAM-areas are arranged within the area $1400-$17FF. If you study the schematics, you won't find any logic who is taking care of it; this is done inside the 6530. Even if you forget the internal ROM for a moment, it means that you cannot exchange the 6530s with each other like the 6526 CIAs in a C64.

As you can see there is one undefined area (not mentioned at all in any manual): $1400 - $16FF. Exploring my KIM I found out the area is free. You also can see that each I/O-area is 64 bytes large. In these cases there are three mirrors of each I/O-area.

All the DOUT-lines (Data OUT) of the RAM-ICs are buffered by a tristate buffer, the 74125. The schematic reveals that the RAMs do have a CS-line but as I don't have any information about these ICs, I cannot explain the extra use of these 74125-buffers.

The Reset- and NMI-input can be triggered by the user by means of a switch. A 556 takes care of debouncing both switches.

The KIM-1 can be switched to the Single Step Mode. The 6502 generates a (H) at the SYNC-output every time it fetches an opcode. This signal is used to generate a NMI. On its turn the NMI-routine interrupts the momentary program and does its job. In this case it means it runs after the executing of every single machine code. This enables the user to see the contents of several registers, including the flags, after each step checking if they contain the value as he expected them to have. If it is the wrong value then there could be a flaw in software software or even hardware.

It is obvious that the part of the KERNEL which contains the NMI-routine has to be masked out. Otherwise every opcode of this routine will trigger the NMI on its turn, causing the 6502 to startup another NMI-routine etc... This is prevented by masking out the upper half of the ROM-area by means of a 7401. This also means we cannot single-step in this area but I only can say that we have to give the programmers of the KIM at least some credit :-)

The Display and Keyboard

PA0..PA6, PB1..PB4 and a 74145 are used to decode the keyboard and to activate the display. Outputs 0..2 of the 74145 control the rows of the keyboard. PA0..PA6 read the columns. When a key is pushed, and the right row is probed, then the corresponding input of port A is driven (L).

Outputs 4..9 control which one of the six 7-segments-displays will be activated by means of a transistor. PA0..PA6, now functioning in the output mode, control which segments of that display will light up.

Connecting a Cassette Recorder

You can connect a normal cassette recorder to the KIM (ie. NO datasette!). A bit is stored as small beep of a certain frequency. To store a '0' the KIM stores 6 pulses 414 usec (top-top) on tape. To store a '1' it stores 9 pulses of 276 usec. (or ~2415 Hz / ~3650 Hz). The KIM generates the pulses onboard. A simple RC-network smoothens the shapes of the pulses a little bit. To read the data the received signal first goes through a Phase-Locked-Loop circuit. This circuit measures the frequency and informs the KIM about it with sending a (L) or (H) to input PB7.

Connecting a Terminal

As mentioned, you can connect a terminal to the KIM with its onboard serial interface. The source code revealed it must be one using 7 bits and no parity. The baudrate is detected by the KIM itself but I can imagine there has to be a lower- and upperlimit to the baudrate it can work with. The serial interface is of the 'current loop' type. This means that not the voltage level of a line defines whether a '0' or '1' is transmited (like RS232), but if there is a current or not flowing through the circuit.

'Current loop' is often used in an industrial environment. The current is used to activate a LED inside an opto-coupler which on its turn addresses the receiving device. The advantage of this system is galvanic discoupling: seen from a electric point of view the devices aren't connected together. Electronic noise in one circuit cannot disturb another circuit.

The KIM does not use an optocoupler to detect the current. In this case the current activates a transistor which on its turn activates PA7 via a NAND-gate. This gate can be used to block the input.

The originator of a signal has also to supply the current. The KIM simply uses a resistor to limit the current. A NAND-gate with an open collector output takes care of closing or not closing the circuit. A line from the input takes care of the fact that the NAND only operates when there is no input signal. In this way only a half-duplex communication is possible.

The Original Manuals

Recently I bought an original KIM-1 rev. D with the Commodore logo on it. It came with several manuals. With the exception of one, I scanned them to make them available in electronic format:

Source Code for the ROM

The source code is available to browse online or you can download it as a text file: kim-src.asm. Because the original listings provided little, and even confusing information, I added my own comments as well.

Building Your Own KIM-1

Can this be done? I think: YES! Why build such an old computer? Ask the guys who still fly in those World War I airplanes: because it's fun! Enough talk: read this document!

Send your comments and feedback to Ruud Baltissen, Ruud@Baltissen.org.



Last page update: July 10, 1999.