S. Massini Comments on NQC vs legOS

(Mar'99)

An introduction first: the RCX incorporated a Hitachi H8 processor (which should be technically a Motorola 68000, or similar), which "talks" its own assembler, of course.

The Lego guys built an easy programming tool for kids, which comes with the package. The kids program the RCX with a very high level language, which is something like "follow the line for x seconds", "turn left 90 degrees", and so on, all tight in a nice graphical fashion.

The Lego guys didn't want to twist their minds in order to implement a compiler from this very high level language directly to the very low level one, into the RCX processor. Therefore they implemented a middle language, which is called "bytecode" (I didn't find any better name in the literature). This bytecode is INTERPRETED inside the RCX by a firmware which is downloaded into the RCX itself the first time you run the tool for kids (there are other ways to do so, though). The interpreted bytecode, which being a BYTEcode is ugly by itself, is much more evolved than the raw assembler though. The meaning of the various commands are something like "read sensor 1", "activate motor 2", etc, thus making Lego guys's life easier. You can find the whole bytecode explained in detail in the page at point 1, if you want.

Now, NQC is just a C-like programming language that is compiled to bytecode, with a compiler running on the PC. Once you have the program compiled you get a bytecode file that needs to be downloaded into the RCX. NQC does it automatically.

Pros:

Cons:

My suggestion: skip to the next section!

legOS, by Markus L. Noga & others.

THIS IS COOL.

These guys completely substituted the original firmware (and all its limitations with it) with theirs, which is actually an entire operating system! It's supposed to be very unix-like, with IRQ, multitasking, and so on. I don't trust all these features completely, because they're working on the thing since only last October (1998), and this is still an early phase, but I'm working with it, and it's worth! They modified the gcc compiler (now changed to egcs, don't know why) in order to make it cross-compile for the H8 architecture (the RCX), and provided all the stardard libraries and some other RCX-related libraries. Result: you program EXACTLY in C (or even C++, but I had some problems to try it) and then compile with their compiler. What you get is a brand new firmware ready to be downloaded (with a tool they provide) into the RCX. The commands to interact with the sensors and the motors are pretty straighforward. There are some examples which are enough to understand the whole thing.

Pros:

Cons:

Ah... the last thing: I couldn't get legOS from the site because it seems that the net doesn't like stable http connections at the moment. I asked it to some researchers who used it to build an AI DOG with the RCX. If you can't download it as well, ask me, I'll send it to you.


Rik Belew
Last modified: Tue Apr 11 11:58:23 PDT 2000