Hempel Design Group / Home / lego / mindfest /
Extreme Mindstorms Panel - pbForth

Redefining Tinkering in the Digital Age

First off, let me thank the Okawa Centre and the MIT Media Lab for hosting Mindfest and inviting us to be a part of one of many interesting events here this weekend.

I am an embedded systems engineer, which means that I design the kinds of microcontroller systems that run everything from the engine in your car to your microwave oven. The seeds of my career were sown in childhood...

Many of you may recall that this year is the 30th anniversary of what for many of my generation is the crowning achievement of engineering - namely putting a man on the moon and returning him safely to earth. The Apollo 11 rocket was launched on my 7th birthday, and I was building trucks and rockets out of LEGO even then.

I was watching one of the recent special programs when one of my 7 year old twins asked me how did they ever do that? How could they ever figure out how to get to the moon and back? This resulted in some head scratching, and attempts at demonstrating how small the margins for error really were when your target was a quarter of a million miles away.

They had computers then, right Dad? - Oh, sure they did.

Like the kind you do your work on, right Dad? - Well, not exactly.

So I did some research on the Net and came up with a site that had transcripts of most of the design and operational guides for the Apollo missions. I found out that the main computer in the command module had between 24 and 38 K - that's K - of permanent rope-core memory, and 1K of volatile memory. It was so volatile that it erased itself after being read, so that the first thing you did with a variable was write it back so it could be used again. It had an instruction cycle time of 24 usec, which translates to a clock speed of 41.6 kHz, not MHz. And even though Y2K was 31 years away, the real-time clock for the system rolled over after only 31 days, so it's a good thing the missions were only a week long!

So what does the moon launch have to do with pbFORTH and the RCX? Basically this...you can hold in your hand all of the computing horsepower that 3 astronauts depended on to get to the moon and back. The RCX has a lot of potential.

When the news of Mindstorms was first released last fall, and after reading the discussions on LUGNET, I knew I had to have one. But the programming environment bothered me. Without even having seen it, I knew that it would allow sophisticated robots to be built but I also knew that with all that RAM, there had to be more that could be done with it - and like any good engineer the unused capability bothered me.

Which takes me back to the late 70's in high school. At that time, I had already owned a Hewlett-Packard calculator, but the new HP-41 was announced. It had an LCD screen, it was programmable, it had 8K of RAM! This was my first programmable appliance. It was also one of the first "closed" consumer products to be successfully "hacked". Back then, an intrepid group of computer enthusiasts made some discoveries which allowed the HP41 to be programmed in non- standard ways. We had a newsletter that had international distribution, and we even created a custom ROM, which was a card that you could plug into the calculator to give it more capabilities.

Hewlett-Packard, while not officially supporting the project, did not discourage us either. This is a similar situation to the one we are in with the RCX product. HP even had an unofficial name name for their unofficial policy...NOMAS, which besides being a clever play on words, stood for Not Manufacturer Supported.

The HP41 ROM project, as I recall, took about 2 years from concept to shipped product. Most of the distribution of information was via the newsletter, so ideas took months to percolate through the collective intelligence of the group.

For many of us the Net is an indespensible tool, and we wonder how anything got done before it came along. Way back in the early 80's we used email at the University of Waterloo, the usenet groups we subscribe to existed, all that was missing was the high speed infrastructure that made it feasible to distribute large amounts of digital information all over the world - which is the genesis of the Web as we know it today...

It is the collective intelligence of the group, and the ability to exchange information, without having to be in the same room, which makes tinkering in the digital age a truly new experience. If you have information to share, you are welcome, if you grab and whine, you are shunned. It's as simple as that.

From the time that Mindstorms was available until Kekoa cracked the code and was able to dump the ROM was only a few weeks, as I recall. Markus and others were discussing using the knowledge to build an operating system for the brick, and I was waiting for Christmas to come so I could open a very interesting box under the tree.

I put my time to good use, though. I was convinced that I could contribute to the community as well so I decided to port FORTH to the brick because it was relatively easy to do. The birthplace of FORTH was on mini-computers that controlled radio telescopes. With limited resources FORTH was developed to give skilled programmers free reign over the entire systems. In the hands of ham-handed hackers the results were as predictable as death and taxes. Depending on who you talk to, FORTH is either manna from heaven or one of the most difficult languages to manage effectively. There's even a joke that asks - How many FORTH programmers does it take to screw in a lightbulb? Just one, but it has to be the person that put it there in the first place...

FORTH was originally discovered by Charles Moore, an MIT physics grad, who used his new language to control radio telescopes. At the time he developed FORTH, a big computer had 8K of volatile memory and a paper tape to store programs and data on. Out of these meager resources came a language that was extensible by the programmer, was flexible to the hardware, and was interactive.

FORTH caught on with the newly born personal computer industry, but it gained a reputation of being difficult to manage. I do not dispute this - but software in general is difficult to manage. My goal with pbFORTH was to make the RCX into an interactive development system that allowed users to get a really good feel for the underlying hardware and what goes on inside a computer - something I believe many new grads are missing out on.

FORTH has the property of being an interpreter and a compiler rolled into one. Once the pbFORTH image is loaded into the RCX, you can either type parts of your program and test it interactively, or you can use a file uploader to do the typing for you when your program works. The only hard part is that you have to learn FORTH.

To port FORTH to the brick, all I had to do was scour the Web, and while nobody had written a FORTH usable on the RCX, there was a FORTH out there that was designed for the PC and had been successfully ported to two other processors. To make a long story short, I was able to get pbFORTH up and running in about 40 hours, but it would never have been possible without the cooperation of the folks at this table and many others that participate in the forums on LUGNET.

I do not program in FORTH on a daily basis - my customers generally insist on C and I don't blame them. But the RCX is a tool for "tinkering"...nobody is going to look over your shoulder to make sure you make the schedule or sue you if your robot falls off your desk. So go ahead - use pbFORTH - it's perfect for this job of interacting with your robot.

Which brings me back to the moon shot and popular culture. For me, the defining image of engineers in pop culture is in the film Apollo 13. The carbon monoxide scrubber filters for the command module don't fit into the canister in the LEM, and the astronauts are in danger of dying. We cut back to a room at Mission Control with all kinds of junk on a table, and an engineer picks up a round filter and a square canister and says:

OK. We have to make this, fit into this, using this.....

And he points to the collection of stuff the astronauts have in the LEM cabin. When complete, the adapter is rushed through the halls like an accident victim - but works in spite of itself.

These...were master tinkerers - and I'll bet if Mindstorms was available then, they would all have bought one. For the kids of course.


For more information contact info@hempeldesigngroup.com


©2000 Ralph Hempel Modified at 8/17/00; 10:08:36 PM