What is the KIM-1?In the 70's Commodore produced calculators using ICs from Texas Instruments. But TI, producing calculators as well, was not happy with the success of Commodore and started to reduce the delivery of ICs. So Commodore looked for another supply of ICs and found MOS. To make the delivery 100% sure, Commodore simply bought MOS. By buying MOS, they also bought the KIM-1, a small computer developed by MOS to show people the power of the 6502. Jack Tramiel saw the potential of the KIM-1 and started to market it under the name of Commodore as well.
The KIM-1 has 1152 bytes of RAM, 2048 bytes of ROM and 30 I/O lines. Some of these lines are used to control six 7-segment LED displays, 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. The Kim-1 has originally been developed to be connected to these teletypers by means of two current-loop-connections. The used current 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!". IMHO any PC equipped with a RS232 interface and a program like PROCOMM or KERMIT should do. And what about a C64 with NOVATERM?
A computer without the possibility to load or store programs is no good at all. The KIM-1 has the ability to load and store programs on paper tape 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 hardwareThe well known 6502 is the hart of the KIM-1 and doesn't need any further explanation.
The 1K of RAM is realized by using 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 this document.
A closer look at the 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 left over 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 line of 74145The schematics are without the power supply or the power connector. The fact is that you have to provide your own PS that you have to connect to the application port. As you can see there are a lot of switches. With one exception they represent the keys. Unfortunately UltiCap denies me to name them after their real names, so I simply called them K1..K25:
K0 = RS = Reset K1 = ST = Step K2 = 0 ... K11 = 9 K12 = A ... K17 = F K18 = AD = Address mode K19 = DA = Data mode K20 = + = Increment address K21 = GO = Execute program K22 = PC = Program Counter K23 = SST = Single Step mode (real switch)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 that takes 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 for example 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 that this area is free. You can also see that each I/O area is 64 bytes big. In these cases there exist three mirrors of each I/O area.
All the DOUT lines (Data OUT) of the RAM ICs are buffered by a tristate buffer, 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 of the 6502 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 execution of every single instruction. This enables the user to see the contents of several registers, including the flags and after each step he can check if they contain the value he expected them to have. If it is the wrong value then there can be a flaw in his theory, program or even hardware.
It is obvious that the part of the KERNAL that 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., etc. This is prevented by masking out the upper half of the ROM area by means of a 7401 NAND gate.
The display and keyboard
PA0..6, PB1..4 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..6 read the columns. When a key is pushed and the correct 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..6, 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 ( NO Commodore datasette!). A bit is stored as small beep of a certain frequency. To store a '0' the KIM stores 6 pulses 414 uSec/~2415 Hz (top-top) on tape. To store a '1' it stores 9 pulses of 276 uSec/~3650 Hz. The KIM generates the pulses itself. A simple RC-network smoothes the shapes of the pulses a bit. To be able 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 before, you can connect a terminal to the KIM by means of its onboard serial interface. The source code revealed it should be one using 7 bits and no parity. The baud rate is detected by the KIM itself but I can imagine there has to be a lower and upper limit. 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 transmitted (like RS-232), but if there is a current or not flowing through the circuit.
'Current loop' is often used in an industrial environment as it is much less vulnerable for electronic noise. Most of the time the current is used to activate a LED inside an optocoupler that on its turn signals the receiving device. The advantage of this system is galvanic decoupling: seen from an electric point of view the devices aren't connected together at all.
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 through 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 detect 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 manualsI own a KIM-1 rev. D with the Commodore logo on it and also have the original manuals. With the exception of one, I scanned them to make them available in electronic format:
- Hardware manual: ASCII or IBM Graphics version
- User manual: ASCII or IBM Graphics version
- Programming manual (N/A)
- Hints: ASCII or IBM Graphics version
Source codes of the ROMAvailable here. Because the original listings provided little, and even confusing information, I provided my own as well.
Building your own KIM-1Can this be done? I think: YES! Why build such an old computer? Ask the guys who still fly in those WW1-planes: because it's fun!. Enough talk: read this document!
You can email me here.