6502 by dbhqGitHub

All machines

KIM-1

1976, MOS Technology, 6502, 1 MHz.

Acceptance test Kim1AcceptanceTests: 6 passing.

It models the keypad, the six LED digits, the RS and ST keys, the SST switch, the teletype on its 20 mA loops with the TTY/KB switch, and both 6530s, with the original monitor ROM.

An original KIM-1 from directly above, on black: a dark green board with gold edge contacts on two tabs down its left side, three 40-pin chips at the top left, a column of eight memory chips, a crystal and the KIM-1 name at the top right, the six-digit display behind a dark filter, and the black 23-key keypad with its SST switch at the bottom right.
Photograph: an original MOS Technology KIM-1, on display at the Musée Bolo, EPFL, Lausanne, taken 24 August 2010.By Rama & Musée Bolo, cropped by Tomer T. Source: commons.wikimedia.org. Licence: CC BY-SA 2.0 fr. Changes: resized and converted to WebP for this page.

The machine

Teletype

Off, the monitor uses the keypad and the digits. On, it uses the teletype: press RS, then RUB OUT, and it prints KIM.

The KIM-1 runs in your browser and needs JavaScript. Without it, the keypad, the teletype and the programs below are shown, but nothing runs.

The monitor ROM is MOS Technology's. Who holds it now was not established. No licence or permission from any holder was found. Full rights: Whose ROM this is.

Try it

Type these keys in order, on the keypad or on your keyboard: with focus on the machine, 0 to 9 and A to F press the same keys. After each line the digits should show what is beside it: x is any digit, and blank means dark. The acceptance test types the same program, from the same file, so the two cannot disagree.

  1. RS

    Reset. The monitor starts and shows an address and the byte there.

    Shows xxxx xx

  2. AD17FADA00+1C

    Point the NMI vector at the monitor, at $1C00, so ST can stop a program. The manual's section 4.6 asks for this before ST is used.

    Shows 17FB 1C

  3. AD0200DAAD+10+02+18+6D+11+02+8D+12+02+4C+0A+02

    Enter the program at $0200: LDA $0210, CLC, ADC $0211, STA $0212, then JMP $020A, which loops for ever.

    Shows 020C 02

  4. AD0210DA27+15

    Enter the two numbers it adds, $27 at $0210 and $15 at $0211.

    Shows 0211 15

  5. AD0200GO

    Run it from $0200. The digits go dark, because a running program does not scan the display.

    Shows nothing: dark

  6. ST

    Stop it. The monitor shows where it stopped: the JMP at $020A.

    Shows 020A 4C

  7. AD0212

    Read the result at $0212: $27 plus $15 is $3C.

    Shows 0212 3C

The teletype

Most KIM-1s were used from a teletype, a Teletype Model 33 or a terminal like one, on the board's 20 mA current loops. The monitor prints and reads at ten characters a second, sending and timing every bit itself on two pins of the 6530. To use it, turn the TTY switch on, press RS, then RUB OUT: the monitor times the RUB OUT to learn the line's speed, and prints KIM.

Type in the field under the paper. It types in capitals, as the Teletype did. Enter is RETURN, Backspace is RUB OUT, and LF has its own button. Keys typed while the monitor prints wait their turn, so none is lost.

The commands are the User Manual's: four hex digits and SPACE open an address, two hex digits and a full stop store a byte and move on, RETURN moves on without storing, LF moves back, G runs from the open address, and RUB OUT starts again.

The paper, and the speed of the line

The paper shows what the machine printed, decoded from the bits it sent, and what you type, which the board's wiring echoes back to the printer as a real one does. The speed can be raised to 300 or 1200 baud. Press RS and RUB OUT after changing it, so the monitor measures it again.

The try-it program at the teletype, step by step

This session enters the try-it program through the teletype, runs it and reads the result back. After each line the paper should end with what is beside it: x is any hex digit. Kim1TeletypeTests types the same session, from the same file, so the two cannot disagree; that suite has 18 tests passing.

  1. On the keypad: RS

    At the teletype: RUB OUT

    With the TTY switch on, press RS, then RUB OUT. The monitor times RUB OUT to learn the speed of the line, then prints KIM, an address and the byte stored there.

    KIM
    xxxx xx
  2. At the teletype: 17FASPACE

    Open the NMI vector at $17FA: type the address, then a space. The monitor prints the address on a new line, with the byte there.

    xxxx xx 17FA
    17FA xx
  3. At the teletype: 00.1C.

    Point it at the monitor, at $1C00, so that ST can stop a program: type each byte, then a full stop to store it and move on.

    17FA xx 00.
    17FB xx 1C.
    17FC xx
  4. At the teletype: 0200SPACEAD.10.02.18.6D.11.02.8D.12.02.4C.0A.02.

    Enter the program at $0200: LDA $0210, CLC, ADC $0211, STA $0212, then JMP $020A, which loops for ever. It is the program the keypad's try-it types.

    020B xx 0A.
    020C xx 02.
    020D xx
  5. At the teletype: 0210SPACE27.15.

    Enter the two numbers it adds, $27 at $0210 and $15 at $0211.

    0210 xx 27.
    0211 xx 15.
    0212 xx
  6. At the teletype: 0200SPACEG

    Open $0200 and type G to run the program from there. The monitor stops listening while it runs.

    0212 xx 0200
    0200 AD G
  7. On the keypad: ST

    Stop it with ST on the keypad. The monitor prints KIM and where the program stopped: the JMP at $020A.

    KIM
    020A 4C
  8. At the teletype: 0212SPACE

    Read the result at $0212: $27 plus $15 is $3C.

    020A 4C 0212
    0212 3C

About the KIM-1

What is modelled, and what is not

Not modelled: the cassette interface and the expansion bus.

The five photographs of the original, and their credits

Each is credited as its source gives it. Under each is what the 3D model took from it.

An original KIM-1 from directly above, on black: a dark green board with gold edge contacts on two tabs down its left side, three 40-pin chips at the top left, a column of eight memory chips, a crystal and the KIM-1 name at the top right, the six-digit display behind a dark filter, and the black 23-key keypad with its SST switch at the bottom right.
Photograph: an original MOS Technology KIM-1, on display at the Musée Bolo, EPFL, Lausanne, taken 24 August 2010.By Rama & Musée Bolo, cropped by Tomer T. Source: commons.wikimedia.org. Licence: CC BY-SA 2.0 fr. Changes: resized and converted to WebP for this page.Used for the model: the tracks on the top face, as one of three photographs of it; the keypad's size and its keys' places, the display window, the crystal, the name and the red wire; and a check on where the chips sit.
The same KIM-1 from above its other end, on black, with the keypad at the bottom left, the edge connector along the top, the KIM-1 name at the bottom right and a loose red wire across the left of the board.
Photograph: the same board at the Musée Bolo, from its other end, taken 24 August 2010.By Rama & Musée Bolo. Source: commons.wikimedia.org. Licence: CC BY-SA 2.0 fr. Changes: resized and converted to WebP for this page.Used for the model: the tracks on the top face, as one of three photographs of it, and the heights of the parts, by triangulation with the next photograph.
The same KIM-1 from a low angle at one corner, showing the heights of the keypad's raised bezel, the display window, the crystal, the chips and the capacitors.
Photograph: the same board at the Musée Bolo, from a low corner, taken 24 August 2010.By Rama & Musée Bolo. Source: commons.wikimedia.org. Licence: CC BY-SA 2.0 fr. Changes: resized and converted to WebP for this page.Used for the model: the heights of the parts, by triangulation with the photograph before.
Another original KIM-1 of the same revision, from directly above on white: a bright green board with yellow capacitors, two white ceramic chips and a purple one, six separate LED digits and the black keypad.
Photograph: another MOS Rev B KIM-1, its component side, on a white ground, taken 17 March 2016.By Hans Otten's Retro Computing site, which does not name the photographer. Source: retro.hansotten.nl. Licence: no licence stated. Changes: resized and converted to WebP for this page.Used for the model: the tracks on the top face, as one of three photographs of it: a different board, so where a part or the red wire hides a track on the Musée Bolo's, this one often shows it; and a check on where the chips sit.
The solder side of the same Rev B KIM-1, from directly above on white: green lacquer over tinned tracks, rows of solder joints where the chips' legs come through, and the gold edge contacts now on the right.
Photograph: the same Rev B board turned over: its solder side, taken 17 March 2016.By Hans Otten's Retro Computing site, which does not name the photographer. Source: retro.hansotten.nl. Licence: no licence stated. Changes: resized and converted to WebP for this page.Used for the model: the tracks on the underside: the only photograph of it.
Whose ROM this is

The monitor ROM is MOS Technology's, copyright 1975, and MOS was bought by Commodore in 1976; who holds it now was not established, and no licence or permission from any holder was found. Our copy is Hans Otten's dump of real 6530-002 and 6530-003 chips, kept in this repository under roms/ with where it came from, and checked by SHA-256 each time it is read.

The ROM is kept in the repository, in roms/, with where it came from. The site checks it against its hash when it is built, and serves it beside the emulator.