Homebrew CPU
[ Home ] New Stuff ] Minix Port ] Magic-2? ] Overview ] Photo Gallery ] Construction ] Technical Info ] My Other Projects ] Links ]

 

Magic-1 is a completely homebuilt minicomputer.  It doesn't use an off-the-shelf microprocessor, but instead has a custom CPU made out of 74 Series TTL chips.  Altogether there are more than 200 chips in Magic-1 connected together with thousands of individually wrapped wires.  And, it works.  Not only the hardware, but a full software stack. There's a ANSI C cross-compiler for Magic-1 (retargeted LCC), a fully multi-user, multi-tasking port of the Minix 2 operating system. a TCP/IP stack and hundreds of programs.

Except when I'm working on it, Magic-1 is connected to the net.  It serves web pages at http://www.magic-1.org, and by clicking here you can telnet in and play Original Adventure or run a few other old classics such as Eliza, Conway's Life or Hunt the Wumpus.  To log in, use the id "guest" and the password "magic".  Before the Minix port was completed, Magic-1 was running a very simple homebrew operating system.  It also had a simple guestbook program.  Many thousands of people have telnetted into Magic-1 from around the world, and between 2004 and the summer of 2007 they left 1388 guestbook messages.  I've preserved the messsages here.

This web site has served as the development repository for the project, and contains lots of pictures documenting the construction, as well as full documentation and diaries stretching back to the project's beginning in 2001.  You can also find a few videos of Magic-1 running, including the first time it worked.

Start here, and then check out the Overview, New Stuff and Photo Gallery.  To dig deeper, browse through Technical Info, Construction - and if you're really interested, you can even download a complete set of Magic-1's schematics

Although Magic-1 is a custom computer, it no longer is one-of-a-kind.  Aidil Jazmi of Universiti Teknologi Petronas in Malaysia duplicated Magic-1 as a school project.  You can read about his work here.

NEW (8/30/2016): Because of automated script attacks at the standard telnet port (23), Magic-1 will now be using an odd telnet port number: 51515. So, to telnet in to magic-1, do: "telnet magic-1.org 51515".

horizontal rule

Magic

In the summer of 1980 I celebrated my freshly minted B.S. in Journalism by blowing most of the cash I collected in graduation gifts on a TRS-80 Model 1 computer.  Sitting on the floor of my apartment I fired it up, typed in the sample BASIC program and then "RUN".

WHAT IS YOUR NAME?

"BILL", I responded.

HI BILL

Wow!  I was blown away.  This was just a machine, but I could interact with it using language that we both understood.  As a Liberal Arts graduate with next to no technical background, I found this completely astonishing.  Over the next year, I continued to play with my TRS-80 Model 1 while working as a journalist on a small-town Kansas newspaper.  I decided that I really wanted to learn more about how computers worked, so I went back to college and picked up a M.S. in Computer Science.

More than 20 years later, I found myself with an urge to touch that magic again by building my own computer from scratch.  By "scratch", I meant designing my own instruction set, wire-wrapping a CPU out of a pile of 74 series TTL devices and writing (or porting) my own assembler, compiler, linker, text editor and operating system.

I'm calling this computer the "Magic-1", or M-1 for short.  It's a one-address, microprogrammed machine with  one-byte opcodes.  It features 8/16-bit data operations, functioning on an 8-bit wide data bus with 16-bit addresses (mapped via 2K-byte pages into a 22-bit physical address space).   Code and data address spaces can be shared or disjoint, giving each process up to 128K bytes of addressing.   User and supervisor modes exist, along with hardware address translation, memory-mapped IO, and support for DMA and externally-generated interrupts.  As far as components go, it is built entirely out of 74LS and 74F-series TTL devices plus modern SRAM and EPROMs for the microcode store.   After redesigning the memory access mechanism several years into the project, Magic-1 runs at 4.09 Mhz.

Goals

OK, so I understand wanting to do your own CPU, buy why on earth are you doing it this way?  I mean, why TTL - why not FPGA?  And really, 16-bit virtual addresses in a 22-bit physical address space!  What's the deal with that?

I guess any project should start off with some notion what of what you're trying to achieve. My high-level project goals were:

bulletTouch the magic.  By this I meant to gain a deeper understanding of how computers work, and specifically computers similar to those of the late 70's and early 80's that first fired my interest.  For this reason, the Z80 loomed large in my mind throughout the design process, and running with an 8-bit data bus and 16-bit addresses just seemed right.  Although I was largely trying to use parts that would have been current in that time, I wasn't shooting for historical accuracy.  My choice of 74xx is a nod to the past, and my choice of 74Fxx had more to do with availability.
bulletTTL rather than FPGA. My reasons here pretty much boil down to "because that's what I want to do."  FPGAs do sound fun, but I really am drawn towards using technology that is similar to that which was current when I first became introduced to computers.  Perhaps for Magic-2....
bulletLearn more about computing areas in which I have interest, but much ignorance.   From my years as a software developer, I've gained a passing familiarity with language tools.  However, I really wanted to better understand hardware and operating systems.  To this end, I pushed the hardware complexity to what I consider the limits of my hobbyist abilities, and included support for preemptive multitasking and paging to enable me to support a "real"  operating system for my machine.
bulletBuild something real.  I'm proud of some of the software I've written, but I thought it would be nice if I could have something physical to show for all my work.  That's part of the reason I went with wire-wrap.  My wife and kids may not be impressed by my instruction set design, but all those wires ought to at least get some sort of reaction from them ("Geez Dad, you're such a nerd.  Would you please put that thing away before my friends come over and you embarrass me to death?").
bulletFunctionality over Speed.  I don't really need this machine to be as fast as possible.  Efficient, yes - but wherever possible I traded off speed for simpler circuits.  
bulletCompactness.  One of my pet peeves is how bloated modern software is.  I think there's a lot you can do with 128K bytes of addressing, and I liked the idea of keeping things compact and utilitarian.  I've tried to construct an expressively dense set of 1-byte opcodes. 

At the end of the day, I wanted a working, and useful, machine that I understood completely.  Oh, and it had to have a real front panel with lots and lots of cool blinky lights.

 

horizontal rule

P.S. Although this site gets few visitors, I have on occasion gotten the comment that:

  1. I have way too much time on my hands

  2. I must be single.

Well, wrong on both counts!  Married - 3 kids & two dogs, and not nearly enough time.  I manage to make progress on the project by putting in the odd hour here and there and treating it as the multi-year effort that it is.  It also helps that as far as my wife knows, I'm actually doing paying work on the laptop and not just screwing around with my hobby projects :-).

horizontal rule

P.P.S. Corrections:

  1. When I said "my wife" in the previous section, I actually meant to say "my beautiful, intelligent and under appreciated wife who not only does way more than her share of the work around here, but also knows that this web site exists and checks it out from time to time."

  2. Regarding my suggestion that my "paying work" ruse is successful:

     "Do you really think I don't know when you're playing with your toys?  On the rare occasion when you are doing real work, you slouch.  When you are playing with your hobby project you get all intense.  You know you can't fool me.  Never forget that."

Now, in my own defense, I'd like to say that, uh - hold on for a second

 what?  - the dishes?  No, no I didn't forget.  I was just getting up to do them.  And Will's bath?  Yes, of course, that too.   Yes, dear - on my way......

horizontal rule

Got any advice, abuse or comments for me?  Send email

 

horizontal rule

Homebuilt CPUs WebRing

JavaScript by Qirien Dhaela

Join the ring?

David Brooks, designer of the Simplex-III homebrew computer, has founded the Homebuilt CPUs Web Ring.  To join, drop Dave a line, mentioning your page's URL. It will then be added to the list. You will also need to copy this code fragment into your page.