Benlo Park

VisiCalc

Contact


Microchess for the Kim-1

Peter Jennings


March, 2006




Kim-1

Microchess for the Kim-1 was the first game program sold for home computers. After six months of development, the first copy was shipped on December 18, 1976.

In preparation for the 2002 Vintage Computer Festival, I powered up the same Kim-1 used to write the original program and loaded Microchess into memory.

The program and data required all of the Kim-1's memory ... 1K. How things have changed in the past quarter century.

The Toronto Star, December 22, 1976, covered the story of hobbyist computing and revealed a few facts. In the US, there were 300 tiny computer stores selling systems for about the cost of a high end stereo - $1,000 to $2,000. The Kim-1, one of the smallest hobbyist computers, sold for $245. Byte Magazine claimed a circulation of 73,000 readers.

But Computer Place owner, Murray Desnoyer, did not expect hobbyist computing to amount to more than 5% of his business.

Over the next ten years, several million copies of Microchess were sold to owners of home computers purchased from Apple, Tandy, Commodore and lesser known companies such as Processor Technology, Imsai, Cromemco, Polymorphic Systems, MITS, Ohio Scientific, and many more.


Announcing the Kim-1

Kim-1 Ad

On page 14 of the April 1976 issue of Byte Magazine appeared a new product announcement for the MOS Technology Kim-1. On the facing page, a full-page ad proclaimed its availability.

For $245, you could buy a fully assembled Kim-1 Microcomputer System (Not a kit!) with 1024 bytes of static RAM, a 23 key keyboard, 6 character hexadecimal LED display, an audio cassette interface, and 15 bidirectional programmable I/O pins.

Since the announcement of the MITS Altair, a year earlier, I had been very interested in acquiring a computer. But, just out of school, with student loans still outstanding, the cost was a major issue. The price of the Kim-1 was much more attractive than that of the 8080 S-100 bus systems I had seen advertised, and the fact that it was assembled and ready to use made it even more appealing.

It is also worth noting that $245 in 1976 would be over US$800 today and almost C$1300 in Canada. At the time, the Canadian dollar was worth slightly more than the US dollar. That has also changed.

I knew from the articles in Byte that the 8080 was capable of real computing, but I didn't know about the 6502. In order to satisfy my curiosity about the capabilities of both chips, and having access to a Xerox Sigma IX Time Sharing computer at work, I wrote a simulator for each chip. There is nothing like writing a simulator to focus the mind on understanding the instruction sets for the two chips. The simulators were written in APL. At the end of this exercise I was firmly convinced that I would much rather program a 6502 than an 8080.

In May, I drove to Cleveland to attend the Midwest Regional Computer Conference and parted with my $245 in hard earned cash for a box containing a Kim-1 and three books of instructions. The Hardware Manual detailed the 6502 and its support chips. The Programming Manual detailed the instruction set, and the Kim-1 User Manual showed how to set up and operate the Kim-1 Single Board Computer. Arriving back in Toronto, I was up most of the night reading these manuals.

Within a few days, I had acquired the parts necessary to construct the 5 and 12 volt power supply necessary for the operation of the Kim-1. With trepidation, I pressed the 44 pin edge connector onto the PC board, and applied power. Nothing happened. I pressed the RS key, and the LEDs lit up. With great delight, I entered the example program in the manual and before my eyes, my little computer added two hexadecimal numbers and displayed them on the LED display. I was overjoyed.


Programming is Addictive

The 6502 processor, as shipped in 1976, ran at 1 MHz. With its 8 bit words and 55 instructions, it is generally rated at 0.1 MIPS. As a comparison, the laptop I am writing this on in 2006 runs at 2600 MHz, has 1GB of memory, and is rated at around 5,000 MIPS. Or perhaps a better comparison, the Walmart $199 special Lindows based Athlon offers 10,000 times the processing power and 128,000 times the memory for less than the cost of the Kim. And a hard drive will beat an audio tape recorder for mass storage any day.

Once I had a computer of my own, I became obsessed with writing software for it. I began by hand assembling instructions into 6502 opcodes, looking each one up on the 6502 Reference Card. Soon, the common instructions were embedded in my brain, where they remain to this day. Once I had a piece of working program, I could save it to audio tape.

Within a few weeks, I had written a cross-assembler in APL in order to not have to hand assemble code all the time. I still had to type in the hexadecimal opcodes and do the debugging by hand, though.

In my spare time at work, I would scribble algorithms and lines of code on pieces of paper. After hours, I would huddle over a terminal and use the cross-assembler to generate 6502 opcodes for the Kim-1. At home, I would type in the opcodes and single step through the program. Corrections would be made by hand, assembling machine instructions in my head.

I had always wanted to create a chess playing computer. Years before, I had dabbled with some homebrew hardware, a tape recorder, and a teletype machine to create a "computer" capable of playing a few moves of standard openings. Moves took minutes to retrieve from tape.

Now, the same old Model 15 Teletype was called back into service and connected to the Kim-1. It generated dumps and listings to help me debug the programs I was writing. The hexadecimal dump at the back of the Microchess manual was printed on this old 1930s technology baudot code printer.

When running, the Model 15 made a thundering noise as the head klunked across the page, typing letters one by one. To save us from eviction, it sat on a 12 inch thick foam pad, which lessened the transmission of vibrations to the floor below. The smell of hot machine oil and ozone filled our apartment when it was printing.

The Computer History Museum in Mountain View, California has one of these old machines on display.


My System

I knew very little about how to go about writing a chess playing program. A few years before, an article had appeared in Scientific American which discussed the state of chess playing programs at the time. Some sample code in ALGOL was shown. I had saved the article with the idea that some day I would have access to a computer so that I could try my hand at this programming challenge.

With the limited memory and processing power of the Kim-1, I spent a lot of time experimenting with different methods of encoding the positions of the pieces on the board. It was clear that I could not afford to store multiple copies of the board as pieces were moved, and that the calculation of piece moves would have to be as efficient as possible.

After a lot of trial and error and some rigorous analysis, I settled on a state machine design, which allowed the use of recursion to work through the advancing positions as moves were generated and evaluated. A move stack allowed the retracing of moves back to the original position.

After each move was generated, an evaluation routine was called to determine the value of the resulting position. Values of move chains were compared. Having a completely independent evaluation routine made it possible to experiment endlessly with different parameters and methods of valuing positions.

The chess knowledge embedded in the evaluation was almost entirely derived from the book My System by Aron Nimzovich. First published in 1930, and revised in 1947, this book is still one of the most recommended guides to chess strategy for players and chess programmers of every level. There is now a recent release of the book by Lou Nimzowitsch and Lou Hays: My System: 21st Century Edition.

  

The dog eared 1964 copy of My System I still have is marked up with a yellow highlighter pen. Each mark is a rule to be followed by a good chess player as enunciated by Nimzovich. Some of the key rules made it into the first version of Microchess. Subsequent versions of Microchess encoded more and more of this fine book into code.

Week by week, the program progressed. At first, it would make legal moves, but they didn't make much sense. The first time I demonstrated it to my brother-in-law, it insisted on marching all of its pawns down the board as quickly as possible, regardless of any other positional strategy.

Night after night, I would stay up as long as I could keep my eyes open, playing games against the steadily improving Microchess. Every time it would make what appeared to be a mistake, I would stop the program and examine the rules and evaluation scores which had caused it to select the poor move over the obviously better one. Then, I would make a change to the program, replace the pieces, and start again.


Kim-1 User Notes

In July, 1976, the first issue of the Kim-1 User Notes appeared in my mailbox. It was exciting to become aware of other hobbyists learning to use the Kim-1 and to know that there would be a forum for the exchange of software and hardware tips and ideas.

Through Eric Rehnke, the publisher of the Kim-1 User Notes, and Rick Simpson at MOS Technology, I learned of another active Kim-1 user in Toronto. Jim Butterfield lived not far from me, and was digging into the 6502 and the power of the Kim-1 to do more than it was ever designed to do. We had to get together.

One evening, I gathered up my tapes and notes and along with another Toronto Kim-1 enthusiast, settled in for a night of conversation and software trading and showing off. I had mentioned that I was working on a chess program when I talked to Jim on the phone. After trading programs like Lunar Lander and many useful utilities, he asked how the chess was coming along. I agreed to demonstrate the program.

A board was set up, and the program was loaded into memory from a cassette tape. About three minutes later, we were ready to play. The Kim-1 flickered its LEDs and thought long and hard about each move. Jim's friend volunteered to take on the computer. For a while, the game was close, but suddenly, the Kim made an attack on the king. One move later, checkmate! Microchess had beaten its first live human opponent, other than me.

Kim-1 User Notes, Volume 1, Issue 2, appeared in November, 1976. Unbeknownst to me, Jim Butterfield had alerted Eric to my chess program and the "cover page" proclaimed the news.

There was no contact information for me in the newsletter, but shortly after this announcement appeared, I began to receive phone calls and letters requesting further information and wanting to purchase a copy as soon as the program was available. It was a program to bring the Kim-1 to life. Something to show friends and relatives that it was not just a toy, or a useless pile of wires and blinking LEDs, but a powerful computer, capable of playing chess.


A Business is Born

I love programming. It is almost impossible to explain the joy of writing software to someone who has not experienced it.

First and foremost, it is an act of creation. From a simple thought, and the arrangement of a few words and symbols, a reality is created that did not exist before.

No other activity can keep you in the moment the way that writing software can. At each step, one hundred percent of your concentration is applied to the solving of the current problem. Time disappears.

A well written program is a work of art. From conception to final presentation, the activity is that of an artist - the embodiment of a dream world expressed as an interactive experience for the user.

This is the way I have always felt about programming. And in particular, from its early stages, I thought of Microchess as my work of art.

But the creation of Microchess was also the fulfillment of another dream. I very much wanted to start a business of my own. Because of the lower financial barriers to entry, I knew that it would probably be a mail order business.

At each stage of development, Microchess was not just a programming exercise. It was meant to be a product. It was meant to be used by customers who would be satisfied that they had paid a reasonable price for a fine product.

I first learned about the Altair and the inchoate personal computer market while I was taking a post-graduate course in entrepreneurship at York University. This new market seemed to fit my aptitudes and interests as well as being accessible and full of potential.

I have been looking through the 1976 Byte magazines. It is interesting that there are lots of ads for lots of computers and circuit boards, TV terminals and components, but none for software. At the time, in the hobbyist market, software was something you gave away or traded. A subject to write articles about in magazines and newsletters.

Microchess was unique in that it was a product to turn a hobbyist computer into something which would impress a spouse or a friend. This was the basis of its early market. This was to be the source of its value.


Desktop Publishing Circa 1976

In November it became clear that the program was nearing completion. With no more memory for additional heuristics or more complicated calculation strategies and finding few parameters to tweak for further improvements in play, it was time to move on to distribution of the program.

Microchess was to be a product and not just a program. That meant it should have a manual offering more than just a single photocopied page of instructions. The difference is still apparent today between a programmer who sells shareware with a readme file hastily prepared at the last minute and a software publisher who includes professional documentation and help files. IBM Selectric II Typewriter

The Microchess manual was created using the latest desktop publishing technology of the time.

The text was typed on an IBM Selectric typewriter using different typeballs to vary the size and typeface of the font. Mistakes were corrected with white out, using both a tape and bottle of liquid.

Typed sections of the document were cut out from the page and pasted to the master copy. Cut and paste meant using scissors and rubber cement to paste prepared sections of text and graphics onto a master page.

The cover and headlines were laboriously rubbed onto strips of paper using Letraset Dry Transfer Lettering, which is still available. Sheets of letters in the desired font are purchased and each letter is transferred to the paper by rubbing it with a pencil-like instrument capped with a small aluminum ball.

The pages of source program were printed on the Decwriter at work. The actual dump of the program, which the purchaser would have to type into his Kim, was a dump produced on the already ancient Model 15 printer attached to my Kim-1.


Microchess Manual 1976


Microchess for the Kim-1

This is page 12 of the manual. The entire Microchess program including all the data and program code necessary to run Microchess on a Kim-1. There are 924 bytes of data.

If you purchased Microchess in 1976 or early in 1977, all you received was the manual. It was necessary to enter the program into the Kim from this hex dump using the Kim's hexadecimal keypad. If any mistakes were made, the program would probably not work.

Once the program was entered into the Kim, the user would save the program to cassette.

Later, for the nominal price of $3.00 more, you could receive a cassette tape with two copies of the program and several prepared openings.


Play Kim-1 Microchess on your PC

Bill Forster of Wellington, New Zealand, was so intrigued by Microchess that he decided to create a version in C that would run on the PC (or any computer capable of compiling C programs). His approach to the problem was to emulate the 6502 op codes as C macros, so that the original Kim-1 source would be compiled into C instructions.

In the process of debugging his code, he discovered errors in the source files available on the web due to OCR errors when they were converted from paper to text documents. Finally, after much effort, he created a version of the program that feels a lot like what a hobbyist in 1977 would have created for his 6502 homebrew computer with a teletype output.

  00 01 02 03 04 05 06 07
-------------------------
|BR|BN|BB|BQ|BK|BB|BN|BR|00
-------------------------
|BP|BP|BP|BP|**|BP|BP|BP|10
-------------------------
|  |**|  |**|  |**|  |**|20
-------------------------
|**|  |**|  |BP|  |**|  |30
-------------------------
|  |**|  |**|WP|**|  |**|40
-------------------------
|**|  |**|  |**|  |**|  |50
-------------------------
|WP|WP|WP|WP|  |WP|WP|WP|60
-------------------------
|WR|WN|WB|WQ|WK|WB|WN|WR|70
-------------------------
 00 01 02 03 04 05 06 07

Download the C source and a Windows console application executable version of the program if you would like to play with it on your PC.

It is fascinating that twenty years on, the spirit of the early days of personal computing is still inspiring some of us to play with our computers in the same ways we did back then.


Kim-1 Simulation

What was it like to play Microchess on the Kim-1? If you would like to relive those days and compare the experience with using today's personal computers, you can try Charles Bond's Soft6502 Simulator. He has created a small Windows program with a keyboard and hex display, just like the Kim-1.


Soft6502 simulated Kim-1 keyboard

To enter a program, such as Microchess, use the keypad. Press the AD key to enter address mode. Enter the value 0000 to move to address $0000. Press the DA key to signal the entry of data. Press D and 8 to enter $D8 into address $0000. Press the + key to move to the next memory location. Enter A2. Press +. Enter FF. And so on until the entire program has been entered.

Download Soft6502.zip

To try Microchess, download the program by right clicking the link below and choosing Save Target As:

Microchess for Soft6502

  1. Unzip and run the Soft6502 simulator.
  2. Load the code file ( File | Load | microchess_1_soft6502.h65)
  3. Select 0x0000 as the starting address or key in AD 0000
  4. Press GO to run the program
  5. Press C to reset the board
  6. Press PC to make the program play the first move (1333 P-K4)
  7. Press 6343 to respond with your move (P-K4)
  8. Press PC to tell the computer to play

Read the complete manual to understand the board layout and program commands. Because the simulation works slightly differently from the Kim-1, it is necessary to watch the OUT LEDs on the left. When the program is expecting user input, the LEDs will be lit.

With the speed slider at full speed, the simulation will be faster than the original Kim on a new PC.

To make the program play itself, alternate between E to exchange sides and PC to play.

Many thanks to Charles Bond for adapting the simulator to handle the ROM routines for I/O and debugging the OCR code and making Microchess work.


Bags of Mail

The first mention of Microchess to users was a front page teaser in the November, 1976 issue of Kim-1 User Notes publication by Eric Rehnke. The first orders for Microchess were generated by that free publicity.

In December, as the product was almost ready to ship, I sent announcements of the new product to all of the magazines and newsletters serving the new industry.

Dave Beetle of Los Gatos, California, published On_Line, a bi-weekly newsletter of classified advertisements aimed at computer hobbyists. The first official announcement of Microchess appeared in the December 15, issue.

On_Line provided a great service to computer hobbyists in those days. Ads were cheap and the publication was frequent so a lot of surplus computer hardware was sold and traded through Dave’s important publication. Microchess ads appeared in On_Line for the next few years and never failed to generate sales of the product.

The January 1977 issue of Kim-1 User Notes featured the Microchess new product announcement.

In early 1977, the other magazines, Byte, Creative Computing, the brand new Kilobaud and the very important Doctor Dobbs Journal of Computer Calisthenics and Orthodontia published announcements of Microchess and orders began to trickle in to our apartment in Toronto.

My contact with MOS Technology was Rick Simpson and we chatted from time to time on the telephone. MOS Technology showed Microchess playing on the Kim-1 at various trade shows and Rick was kind enough to forward a list of interested customers to me for follow-up.

One day, I asked Rick if he would allow me to insert advertising flyers in the Kim-1 packages they shipped. He discussed it with management, and the company agreed. From then on, every Kim-1 shipped contained a goldenrod colored flyer advertising Microchess. One out of every three purchasers of the Kim-1 ordered Microchess on cassette.

At the time, I was still working for Comshare during the day and filling orders for Microchess at night. We had just moved from our apartment to a small house in downtown Toronto when the news of Microchess reached the installed base of Kim-1 owners. I arrived home from work to find two large canvas bags marked “Canada Post” on our front doorstep. I didn't understand. Why had our letter carrier left his bags there? It seemed very odd.

I wasn't even sure I should look inside the bags. He would probably be back soon to pick them up, but it was already evening and none of it made any sense. I looked inside and was surprised to find the top letters addressed to me. I dug deeper into the bag. They were all addressed to me. I dumped the bags on the floor and began to look into the envelopes. Most of them contained orders for Microchess. But the real excitement was discovering that the envelopes also contained checks. There is something uniquely satisfying about receiving money for something you have created yourself.

It was time to quit my day job.


Micro-Ware Limited

On April 1, 1977, Micro-Ware Limited was incorporated as an Ontario Corporation with one thousand dollars in share capital. No need for a lawyer, the forms were straightforward and the operation easily done by visiting the government offices in downtown Toronto. Articles of Incorporation were cribbed from a set of books at the library intended for use by lawyers. I wonder if it is still as easy to do.

Micro-Ware’s corporate headquarters were located in the back bedroom of 27 Firstbrooke Drive, Toronto. The eight by ten room had a great view of the back yard. The first purchases made by the corporation were a Skilsaw and enough lumber to build a desk and work table. With a swivel chair in the center, I had a U-shaped desk area with ample room for computers and work surface, all within reach without leaving the chair. There were many days during the summer of 1977 that I didn't leave that chair from early morning until late at night.

Micro-Ware logo

A logo was created for Micro-Ware which embodied the spirit of the high technology of the company. The letters M and W were made of paper tape. In 1977, all our products were available on paper tape for 6502 and 8080 machines.

The Kim-1 with expansion board and memory was my main computer at this time. As a development system, I began developing Micro-ADE, an Assembler, Disassembler and Editor system which ran in 4K on the Kim or any 6502 system. Dual cassette players were used for input and output. A Lear-Siegler ADM-3 dumb terminal was the user interface.


More to come ...

Microchess Source Code

Original Manuals and Source Code. Converted to text from an OCR scan by Erik Van den Broeck.

Download the Microchess Source Code formatted for modern cross assemblers and with serial I/O by Daryl Rictor.

Download the Microchess C Emulation, which includes Microchess for the Kim-1 with 6502 to C macros and an exe file for playing Microchess on a PC as created by Bill Forster.

Microchess has been ported to the PICAXE 28X2 and 20X2 microcontrollers by Ian Mitchell. The complete source code and a description of the methodology employed are available for download from the University of Tasmania web site.


Microchess at the Computer History Museum

The Computer History Museum in Mountain View, California, chose as its first exhibit, Mastering the Game: A History of Computer Chess. I donated a number of artifacts and documents to the exhibit, many of which were on display during the course of the show. Many documents related to Microchess are available for download in PDF format.


Microchess on Arduino

Oscar Vermeulen has created a modern Kim-1 using Mike Chambers’ 6502 emulator for the Arduino. With Microchess installed, you can relive the 1970s today.

Oscar even offers a kit of parts to build your own Kim Uno using an Arduino Pro Mini.

If you don't want to use the keyboard and LED display, he has extended Microchess to use a serial terminal, as many early users did.

Kim-1 Microchess on an Apple ][

Jeff Rosengarden has converted the original Kim-1 Microchess source code to be compatible with more modern assemblers and added I/O code to make it work on an Apple ][ or AppleWin simulator.

Download jchess.zip to try it yourself.

Microchess on eBay

Original Microchess cassettes and manuals show up from time to time on eBay. Check eBay now for Microchesss. Original and replica Kim-1s sell on eBay. With the ceramic chips, they can fetch several thousand dollars. Check eBay now for Kim-1