The Kino 74: My Homebuilt Microcomputer

IMG_1366

IMG_1366

The Kino 74 is stupid.  Plain and simple.  Not stupid as in "it was a stupid idea to build it," but it as far as home built CPUs are concerned it pales in comparison to what others are doing.  Relay computers flatten it.  But I’ll list here what I did and discuss it later on.

The Kino 74 is an 8-bit computer with 4-bits of addressing.  The instruction set is... cute.  It has 5, very self-explanatory commands:

Command Description Op Code
LDA XX Load Accumulator with contents of memory location XX 0000 XXXX
ADD XX Add contents of memory location XX to accumulator and store result in accumulator 0001 XXXX
SUB XX Like ADD, but subtract 0010 XXXX
OUT -- Send accumulator contents to Output register 1110 ----
HLT -- Halt execution 1111 1111 (the latter 1111 is not actually necessary, but I tend to add it to make it obvious when the command appears on the bus)

 That’s it.  Pretty basic.  But it stores its program and then executes it so technically, it’s a computer. Don’t hate.

A basic program might look something like:

  • 0H   LDA 5H
  • 1H    ADD 6H
  • 2H   SUB 7H
  • 3H   OUT
  • 4H   HLT
  • 5H   20H
  • 6H   14H
  • 7H    0AH

It has a few different registers: the accumulator, a B register used for adding and subtracting, the output register... memory address register... etc.  Nothing to exciting.  Here’s a block diagram:

(I'll add this later)

It’s clocked at about 1 Hz normally using a 555 timer so that one can see what’s going on and how the different components juggle the data.  I have plans to add a potentiometer that allows one to accelerate things a bit, because it can get a bit tedious sometimes.  Then again, with such short programs, what’s the rush?  Savor the assembly a little bit and watch that thing add and subtract in slow motion.  But here's a video of me showing it running at a higher speed.

I think the whole shebang draws about 300 mA while running.

This is where other people start talking about compilers and short programs and what kind of stuff their computer can run.  I hope it goes without saying that mine doesn’t do that.  It’d be nice if it did, but frankly, that’s just more to write about.  I’ll end the spec list here and move on to the discussion.

I'm going to play with Eagle (never used it) and see if I can't draw some schematics. That might take a while, but it will also detail a bit better the changes I made to the original design.  They'd be a bit tedious to list here so I'll save it for that.

Update: I did play with Eagle and ended up with some decent schematics!  Not everything is 100% accurate and I'm sure that to a trained eye they'll look sloppy, but they're something! 

Here you go: Kino 74 Schematics

Updated update: I reworked the schematics to include a STORE command that allows the user to write the contents of the accumulator to the RAM.  Strangely enough, it would've only taken adding one chip (an 8-input NAND gate) to make it happen.  Of course, there is some serious wire shuffling as well as "kludge-like" use of three-input NAND gates as two input NAND gates, but it works and uses every input of every chip.  If I could make one change this would be it.  For now, I'm going to shelf it though.  I don't have the chip I'd need and I'd have to take apart a fair bit (two of the boards) of the computer to get it working.   I think if I only had to remover the controller/sequencer board it'd be worth it, but I'd have to rewire the RAM a bit and I'm just not ready to do that (because of the crappy choice to wire everything the way I did).  If I need a project in the future, perhaps it'll be something that I do.  If you're trying to build your own, do it this way.  

Kino 74 Schematics WITH STORE

Here's a video of me taking the viewer through the different blinking lights on the display:

(I'll upload this later... after I make the video...)

2. About the Project:

IMG_1370

IMG_1370

I didn’t keep a detailed log of my progress like a lot of people do with these types of things, so I’m going to do this more as a story.  I’ll try to keep it short... ish.

Let me start by saying also that credit for the schematic design of this project goes to Albert Malvino.  This design, with the exception of a few modifications (replacing unavailable  chips, etc.) is the SAP-1 from his book, Digital Computer Electronics.  The display design as well as the board that “drives” it, is my own (although it isn’t especially unique in the world of homebuilt CPUs).

IMG_2444 1

IMG_2444 1

Ever had someone introduce you to transistors, then logic gates and then say something like “any that is what computers are made of,” and then skip everything else in between.  After about the third time I heard this in a physics class, I think a part of me couldn’t take it anymore and decided then, whether I was aware of it or not, that I was going to eventually build a computer out of logic gates if it was the last thing I did (well, pretty close to logic gates at least).  In October of last year (October of 2012) I was working a crappy job, had just dropped out of grad school because it wasn’t interesting, and realized that I had no idea what I enjoyed doing anymore.  I decided to invest myself and a little bit of money into electronics: something I had enjoyed in school the couple of times I had gotten to do it, but never really thought of pursuing on my own time.  After about of month of tinkering around with little insignificant projects, I stumbled across Bill Buzbee and the incredible Magic-1.  That was what I wanted to do... only I hadn’t the slightest clue what I was doing.  I couldn’t even figure out what memory was made of.  And where were the logic gates?

After some searching for the resources Buzbee listed as helpful, I eventually found a reasonably inexpensive copy of the book Digital Computer Electronics by Alfred Malvino.  That was the resource for which I had been searching.  I think I read the whole thing in about a week, and just for fun, ordered some parts and started building the “SAP-1,” whose schematics are in the book.  After about two nights of work, I had filled up a breadboard, had all of the registers, ALU, memory, etc. set, but no ROM to control it.  I can’t leave it there!

Registers Board

Registers Board

Now, ROM would have been a smart choice, but I guess to make things really explicit, Mr. Malvino decided instead to use a “Control Matrix” as he calls it, to handle the instruction decoding and control words.  I didn’t have another forty bucks to drop on another breadboard so I put the project on hold for a little while.  Life was also kinda tough at that point, and my cats had pulled out some pretty important wires out of some registers, I was frustrated.  Oh yeah and water had gotten spilled into the breadboard.  Anyways, it just wasn’t a great time to spend the kind of hours of focus I can put into such projects, projects I’m not even really sure that I’m going to finish, when I really get going.Fast forward a bit: my girlfriend, Alex, gave me the breadboard I needed to “finish” the project for Christmas.  It still wasn’t the best time to be throwing myself fully into the project, I didn’t even really want to look at how bad the damage was from the cats, and everything led to me waiting about another month before sitting down to finally put the “control matrix” in place.  I should have know when Malvino says something to the effect of “It’s easy to see how including more instructions quickly increases the complexity and makes hard wired control matrices impractical,” that perhaps I should consider an alternative, but hey, why not forge ahead (more on this later).  In the end it took me about a night to wire it all up and repair the damage the kitties had done.  Not sure what I was fussing about.

Controller/Sequencer board

Controller/Sequencer board

Fast forward again.  To August of this year.  That’s right.  I did nothing on the project until August 2013.  Keep in mind that at this point “all” that there is left to do is get the two board talking to one another, neaten things up, and deal with a couple of pesky issues I just hadn’t bothered to put my mind to yet.  Ok, in all fairness a lot had been going on: I had spent the summer working in Vermont as the Assistant Director of a nature camp where technology is considered a no go, I was moving out from living with my girlfriend, and I had been unemployed (i.e. no income for materials) for a stint before that, I was stressed, unsure of myself, all of those great things.  This computer was starting to kind of represented my “failed” year of spending too much money, not finishing the things I start, and not achieving the things I set out to do.  It was kind of hard to look at those two breadboards and not question whether they were going to be so riddled with problems once I fired them up together that I would just give up, rip out all of the chips, and at best start over, and at worst, never look at it again.

Well, I left Vermont, and then moved out of Philadelphia, and decided that my main goal to rejuvenate after a tough year was going to be to finish this computer.  I thought it would take a week or two of focused effort.  It didn’t.  I ran the control wires to get the boards to talk, but then realized that programming the thing would be impossible without a decent set of switches (I had previously just been using labeled wires tied high or low for input).  And if I’m going to spend the money to get a decent set of switches, I need something nice-ish to hold them.  And everyone else has these great LED panels that show what’s going on in the different registers and that would certainly help with debugging... etc.  I had already put a decent amount of money into this thing (more than I had planned) and I was looking at just forty bucks in toggle switches alone.  I didn’t want to bother with those teeny DIP switches so I wanted some satisfying, clicking, nearly-NASA style or Top Gun style switches. I went balls-to-the-wall and designed a front panel in Google Sketchup and Inkscape that would hold LED displays of all the registers and control words, all the control switches, and the data entry.  And everything would have pretty, laser-engraved labels.  To drive the displays, I would need about ten more ICs and ten resistor arrays and then, of course, I would need a breadboard to hold all of that... and about fifty feet of wire to connect everything.  And I would name the thing.  It needed a name.  So, in trying to figure out how to bring this thing up for its first jaunt, I had managed to tack on about a $150-worth of more parts that I had never envisioned.

IMG_1217

IMG_1217

IMG_1219

IMG_1219

But here’s where I question whether my science-y, rational side exists: this was no longer something I could walk away from.  Not only had I put money and time into it, but it now was a symbol.  To fail to build this computer would be to look at this past year as a failure.  It would be to accept defeat.  Rational? No.  A little bit melodramatic? Yes.  But that’s what the project had become.

(After getting a nice coupon) I went ahead and ordered my laser cut front panel from ponoko.com (highly recommended, by the way), and after a house sitting gig and hanging some shutters I had enough money to say “screw it” and place the orders for the final components I would need to wrap this thing up.

Back of front panel with switches and LEDs in place

Back of front panel with switches and LEDs in place

The last week or so has been a bit of a blur of perhaps 6-10 hour days of working on this thing.  I’ll list these things here and it’ll look especially short and like “why did it take me 60 or 70 hours to do all of that?” but I’m ok with that.   It’s roughly in the order that I did them:

  • Laid out plan for “display” board
  • Figured out where to “tap” the signals out of the registers to get good displays at the LEDs
  • Put all LEDs into holders in the front panel (those mothers are PAINFUL and difficult to get the collars onto)
  • Placed all input control switches
  • Ran an ass-load (pardon, but it’s the only appropriate word here) of wires.  Seriously.  An ass-load.
  • Soldered all LEDs and switches as needed.
  • Connected all control switches to the display board, which also holds the circuitry for the control switches and clock buffer.
  • Did some bring up attempts, diagnosed a few issues (chip put in backwards, a wire out of place here and there) and on October 17, 2013 at 2:57 PM, I programmed a short little program and the Kino 74 worked!

Now, this was a huge milestone.  Don’t get me wrong.  In fact, it's so exciting that I made a video of the wide-open computer finally running a program.

[youtube=http://www.youtube.com/watch?v=W-eDTicNFYg]

Troubleshooting setup

Troubleshooting setup

IMG_1352

IMG_1352

No matter what now, I had achieved my goal of getting this thing running, but I had just spent $150 to get this thing looking sexy (I mean sexier than it already was of course) and there was still a lot to do.  I had three breadboards, a disconnected display panel and about a hundred feet of wire littering my desk.  It was hardly yet the compact, “sleek” package I had envisioned for my project.  There was still a lot to do.

  • Hooked up all the display wires (no small task, my chosen method of breadboards and solid core 22 gauge wire were not great.  I spent a lot of time going blind with needle-nose pliers and a headlamp trying to get the accumulator LEDs hooked up in the middle of the breadboard...), realized I made a mistake, took them all out and redid them, realized I made another mistake, and then redid them... I may have had to redo a few of them even still after that.
Running the display wires

Running the display wires

That brings us to today, the day that I’m writing this.  I left the house sitting job I’m working for a couple of hours to go hammer away on the Kino 74.  By hammer I mean delicately place wires with needle-nosed pliers, of course.  I connected everything up, this time almost entirely correctly (only the B register was off a bit and the accumulator had pulled a wire out of the breadboard), and fired it up in all of its glory.  Took it back to the job, corrected the few mistakes and now, almost a year exactly from the day that I started it, the computer is complete in a way that I did not even begin to envision.

A completed, running Kino 74

A completed, running Kino 74

3. Why Invest all of that time and money into something that does so excruciatingly little?

In truth, there’s no reason.  If you’re asking the technical why as in “you could’ve just done a lot more with the space and money you had, so why not?” then I’ll answer that.  If you’re asking why as in “why would you waste your time with a project that costs more than an iPhone but can’t text or play youtube?” this probably isn’t for you.

Honestly, when I started this project I had essentially no background in digital logic or  computer architecture, and hardly any in electronics.  I would have loved to have been able to dive right in at the Magic-1 level and from what everyone else was doing, design my own schematics and wire up something.  But really, I had no idea what I was doing.  I was thrilled when I finally learned about SR latches and called my girlfriend in to see what I had done when I finally understood how two NAND gates can make up a bit of memory.  D-type flip flops were incredible when I learned how those worked.  I’m not necessarily a kinesthetic learner, but I love to build things and I love when theory becomes real, so I was really itching to dive in ASAP to a project.

The Kino 74 really is nearly as Simple As Possible (the SAP from Malvino’s moniker SAP-1).  I doctored it up a little bit, but the core is the same.  What is true though is that I feel I have learned an incredible amount about how computers work and I understand how every little piece of this thing works.  So, for someone coming in who though SR latches were hot stuff, I think it’s a pretty good achievement.  It has made computer architecture and digital logic a boatload more tangible and frankly, had I shot for some of the more “powerful” homebuilt CPUs, I think I would’ve copied what others had done, but still not really fully grasped what every piece was doing and why.

The other benefit to have such a simple computer is that I can actually teach others what’s going on inside a computer, even just conceptually (“there are these things called registers and they shuffle data around and there are control words that tell certain registers to come on and when, etc.”) and it’s pretty hard for them to screw it up.  Short of yanking wires out, there’s not a lot they can do.  And they can see every little detail that is happening in a short, tangible, five-line program that they can write.

Not a lot can get you this close to the core of what a computer really is anymore.

4. Some things I wish I’d done/known, or consider if you’re thinking of building something similar

Looking back on it, I think I would’ve cautioned myself to slow down a bit and really consider my options before deciding that this was the project I wanted to do.  I launched in head first thinking that this would only take a short while (a month or so) and I wouldn’t get very invested, emotionally, time-wise, or financially).  It wasn’t.  That’s ok.  I’m not sad at all and I’m thrilled with the knowledge and the device I’ve gotten.

Here’s what to consider though: now I want to go further.  I want something that I can actually write a useful program with, with more than five separate instructions and than can actually store something to memory, or handle a loop.  I want to learn how to drive a display, or read a keyboard input, or write an operating system.  I want to know all of that and now I really do have my sights set on something like what others have built.  Only now I have to start back at square one on the hardware front because this computer will never be that.

Building something like the Kino 74 is great, but it is limiting in how limited it is.  Plain and simple, there’s just not a lot of discovery left to do with it.  Even if it just had a few more instructions it could really open up fun programming possibilities that would make it a lot more dynamic.  But alas, it doesn’t.

If I could do it again, and had to only change one thing, it’d be to use a ROM chip instead of a hardwired control matrix.  Can I have two? I’d add a register... or two.  I think I’d still feel like I understood everything that was going on, only I’d have more instruction capabilities, more programming options, and I would’ve saved a lot of breadboard space (and possible $40 on that third breadboard...).  The learning wouldn’t stop as soon as the thing was built, there would still be a lot of work and tinkering to do.  So explore that if you’re like me and eager to dive in and have no knowledge otherwise about what is and isn’t a good idea.  This is a great, accessible project to cut your digital teeth on and if you take a little extra time to modify it, you’ll get the satisfaction of having made your own design mark on it, as well as have a whole lot more learning to do when you get to this point.

And ribbon cables.  For the love of god spend enough time finding and using ribbon cables.  They are worth any and all effort.  The Kino 74 cannot be disassembled at this point without disconnecting a lot of wires, which sucks for so many reasons.  Ribbon cables would have made my life so so so much easier.  I guess there’s a reason EVERYONE in the world uses them.  Oh well, it just makes mine that much more unique.

Finally, I probably wouldn’t use breadboards, at least not the nice ones that I used.  They’re expensive, they’re now tied up, and the wires don’t stay in them that well when you have to run as many of them as I did.  Wire wrapping is actually one of the better ideas I think if you want to run your own wire, or spend the time to design PCBs (cheating just a little bit I think...).  The only thing breadboards have over the other options is that it’s super easy to correct wiring mistakes you’ve make.  Ultimately I’d give breadboards a seven out of ten for this project; the low end of acceptable.

5. What’s Next

I’m unsure what my future exploits in this realm will be. I know what I’ve got is hardly a major milestone in the bigger pictures, but it’s a big milestone for where I am now.

I really do want to build a larger, more fully featured computer that actually can run a basic operating system and a compiler of my design and knows how to talk to a keyboard, etc.  And more than anything I’d like it to be something that I design on my own.  I’ve done a lot of projects that almost entirely build off of other’s works and I’d really like to do one that’s all me.  I’m going to search around a bit and do some better planning, but I’ve got a hankering for something larger.  Check back in a few month and we’ll see where I am.

And with that, I'll leave you with some glamour shots and construction shots.  Sorry if I duplicate some that are already up there.  Enjoy and thanks for reading.

6. Photo Gallery

(I'll add this later too.  I have to figure out how to do this in squarespace...)

<3,

John

 

Homebuilt CPUs WebRing

JavaScript by Qirien Dhaela

Join the ring?

David Brooks, designer of the Simplex-III homebrew computer, has founded the Homebrew CPUs Web Ring. To join, drop David a line, mentioning your page's URL. He'll then add it to the list.
You will need to copy this code fragment into your page.