Skip to main content

Just give me a simple CPU and a few I/O ports

Back when I started programming computers came with circuit diagrams and listings of their firmware. The early machines I used like the Sharp MZ-80K, the BBC Micro Model B, the Apple ][ and so on had limited instruction sets and an 'operating system' that was simple enough to comprehend if you understood assembly language. In fact, you really wanted to understand assembly language to get the most out of these machines.

Later I started doing embedded programming. I wrote a TCP/IP stack that ran on an embedded processor inside a network adapter card. Again it was possible to understand everything that was happening in that piece of hardware.

But along the way Moore's Law overtook me. The unending doubling in speed and capacity of machines means that my ability to understand the operation of the computers around me (including my phone) has long since been surpassed. There is simply too much going on.

And it's a personal tragedy. As computers have increased in complexity my enjoyment of them has plummeted. Since I can no longer understand the computer I am forced to spend my days in the lonely struggle against an implacable and yet deterministic foe: another man's APIs.

The worse thing about APIs is that you know that someone else created them, so your struggle to get the computer to do something is futile. This is made worse by closed source software where you are forced to rely on documentation.

Of course, back in my rose tinted past someone else had made the machine and the BIOS, but they'd been good enough to tell you exactly how it worked and it was small enough to comprehend.

I was reminded of all this reading the description of the Apollo Guidance Computer. The AGC had the equivalent of just over 67Kb of operating system in ROM and just over 4kb of RAM. And that was enough to put 12 men on the moon.

Even more interesting is how individuals were able to write the software for it: "Don was responsible for the LM P60's (Lunar Descent), while I was responsible for the LM P40's (which were) all other LM powered flight". Two men were able to write all that code and understand its operation.

12 men went to the moon using an understandable computer, and I sit before an unfathomable machine.

Luckily, there are fun bits of hardware still around. My next projects are going to use the Arduino.


Martin's Blog said…
I completely sympathize with this point of view.

Although the Arduino is a good start, I found I liked it even more after I threw away the IDE.

You'll probably enjoy figuring it all out for yourself, but here are a few notes I wrote about my experiences:
Legooolas said…
You might want to check out XMOS for their dev kits and chips too -- Eclipse with C, asm and a C-derivative with support for wiggling pins and parallelism.

Has a lot more oomph than the Arduino, but is still pretty easy to understand. Not quite as easy to whack on a board yourself, but there are dev kits for $99 to play with one.

[Disclaimer: I work for them, so am biased :)]
Matt said…
I do miss the BBC's 1mhz bus, even though I still have mine on the shelf!

Even the missing of A/Ds on a modern pc annoy

Anyway if you want some fun get an AVR & a dev card, they are top fun, 8 bit some flash & some ram. A bit more cash gets you a Spartan FPGA that runs at video processing speed.

It is the PC platform that is weak with IO.

If you want an OS you can comprehend try Plan9 or Inferno, the latter runs as a user app on win/lin/osx. Plan9 was the first 32bit kernel I could read and understand & I'm certainly no hotshot.

Hacking the C source of Inferno is fun, I'm even lucky enough to get paid to do it!
Llanyort said…
I purchased a BOARDUINO(arduino clone) from adafruit and put the thing together myself. IT was fun.
Anonymous said…
The Arduino is a great device, I hope you have as much fun with it as I've had with the 2 I have. One of mine is permanently employed at my day job as a build indicator

I've started playing with the the .net micro framework which whilst I appreciate you don't like the api side of things still looks great, uses the really good VS2008 IDE and they are in the process of open sourcing it.

I recently purchased a Meridian/P to play with and have started a little blog about working with .net microframe as well as some other general dot net stuff.
Clint Laskowski said…
John, do you follow this blog: ? It's a blast from the past. You can also, of course, find simulators for the Apple ][ and other boards. Who remembers the KIM-1? My system was the Ohio Scientific C24P. Oh, how I long for PEEK and POKE graphics :-)
Sandro Magi said…
I think you overestimate how well the Apollo code was understood. Take a look at this LtU thread where they describe how two bugs in the Apollo code fortuitously cancelled each other out during the actual mission, instead of crashing the lander. FYI, the Apollo 11 source code is also available on Google Code, and it's linked from that thread.

Software has always had bugs, and I suspect, always will. Only employing formal methods, the least of which are type systems, will drastically reduce the occurrence of bugs.
Unknown said…
Just got my arduino in the mail today. I haven't been this excited about hardware for a while.

Popular posts from this blog

Your last name contains invalid characters

My last name is "Graham-Cumming". But here's a typical form response when I enter it:

Does the web site have any idea how rude it is to claim that my last name contains invalid characters? Clearly not. What they actually meant is: our web site will not accept that hyphen in your last name. But do they say that? No, of course not. They decide to shove in my face the claim that there's something wrong with my name.

There's nothing wrong with my name, just as there's nothing wrong with someone whose first name is Jean-Marie, or someone whose last name is O'Reilly.

What is wrong is that way this is being handled. If the system can't cope with non-letters and spaces it needs to say that. How about the following error message:

Our system is unable to process last names that contain non-letters, please replace them with spaces.

Don't blame me for having a last name that your system doesn't like, whose fault is that? Saying "Your last name …

All the symmetrical watch faces (and code to generate them)

If you ever look at pictures of clocks and watches in advertising they are set to roughly 10:10 which is meant to be the most attractive (smiling!) position for the hands. They are actually set to 10:09.14 if the hands are truly symmetrical. CC BY 2.0image by Shinji
I wanted to know what all the possible symmetrical watch faces are and so I wrote some code using Processing. Here's the output (there's one watch face missing, 00:00 or 12:00, because it's very boring):

The key to writing this is to figure out the relationship between the hour and minute hands when the watch face is symmetrical. In an hour the minute hand moves through 360° and the hour hand moves through 30° (12 hours are shown on the watch face and 360/12 = 30).
The core loop inside the program is this:   for (int h = 0; h <= 12; h++) {
    float m = (360-30*float(h))*2/13;
    int s = round(60*(m-floor(m)));
    int col = h%6;
    int row = floor(h/6);
    draw_clock((r+f)*(2*col+1), (r+f)*(row*2+1), r, h, floor(m…

Importing an existing SSL key/certificate pair into a Java keystore

I'm writing this blog post in case anyone else has to Google that. In Java 6 keytool has been improved so that it now becomes possible to import an existing key and certificate (say one you generated outside of the Java world) into a keystore.

You need: Java 6 and openssl.

1. Suppose you have a certificate and key in PEM format. The key is named host.key and the certificate host.crt.

2. The first step is to convert them into a single PKCS12 file using the command: openssl pkcs12 -export -in host.crt -inkey host.key > host.p12. You will be asked for various passwords (the password to access the key (if set) and then the password for the PKCS12 file being created).

3. Then import the PKCS12 file into a keystore using the command: keytool -importkeystore -srckeystore host.p12 -destkeystore host.jks -srcstoretype pkcs12. You now have a keystore named host.jks containing the certificate/key you need.

For the sake of completeness here's the output of a full session I performe…