Dr. Vegetable's Workshop
Home
Workshop
Gift Shop
Download
Links
Contact
LEGO® is a trademark of
the LEGO Group of companies,
which does not sponsor,
authorize, or endorse this site.

Bride of FrankenStorms

When I first started using LEGO to build robots, I became very interested in the work that people like Kekoa Proudfoot had done to reverse-engineer the RCX. In the first few weeks after the product's introduction and well before I had even heard of LEGO MindStorms, a small band of hackers had reverse-engineered the brick far enough to have written alternative programming languages for it. I was curious about the RCX, and wanted to disassemble the downloadable firmware file that came on the CD as well as the hard-coded ROMware that is burnt into every RCX at the factory.

This led me to write a disassembler which converts machine code for the Hitachi H8 into human-readable assembly language. This was a straightforward program to write when armed with the documentation for the processor. I tested my disassembler by running it on the FIRM0309.LGO and FIRM0328.LGO files that came with the RIS 1.0 and 1.5 sets, and also by disassembling the ROM code that I had uploaded from one of my RCXes. As you might imagine, I learned a lot about how the RCX works through this process.

Once I had written the disassembler, it was an afterthought to use the same internal data structures to write an assembler. I made the same disassembler program capable of re-assembling the human-readable code back into the cryptic *.LGO machine code that is required by the RCX.

Armed with a working assembler and disassembler, I set out to write a compiler for a high level language like C. As you may know, most C compilers read a free-form text file from the programmer that specifies in symbolic terms what sequence of steps the program should follow, and translate it into a human-readable assembly language program. This assembly language program must still be run through an assembler to be converted into machine code that the computer can understand. This model allows the developer to inspect and modify the assembly-language program, if desired, before passing it along to the RCX. This facillitates debugging during development of the compiler itself, and also enables the development of "system" function libraries that implement operating system features.

I simplified the language for my "C" compiler, partly out of laziness, partly because a full-blown C compiler would be overkill for my purposes. I plan to take advantage of some of the unique features of the RCX to design a simplified language that is targeted toward LEGO robotics. When complete, this program suite will be a powerful yet easy-to-use development system that will combine the simplicity of a language like NQC coupled with the power and performance of true compiled code like leg-OS.

I have also written a number of compilers that generate RCX byte code like that generated by NQC. Most notably, I added MindStorms support to the SoftWIRE graphical programming environment. It is relatively easy to reprogram an RCX using byte code and the standard firmware, but the runtime performance of the resulting programs is an order of magnitude (or more) worse. This means that byte code applications are incapable of the lightning fast control loop response that is typical of machine code programs. The LegWay robot, which balances itself on two wheels like the SegWay scooter that inspired it, would not be possible to create using a byte code programming language.

I have also written a number of applications that work with the standard RCX firmware. Some of these are available for FREE download and use. Please try these out and let me know what you think.

Back to the Workshop


Copyright (c) 2003 by Christopher Phillips. All Rights Reserved.
LEGO® is a trademark of the LEGO Group of companies, which does not sponsor, authorize, or endorse this site.
I had heard that the movements used in these replica watches uk are high quality and top end models are fitted with replica watches sale imported from Switzerland. This would no doubt increase the costs of the rolex replica sale to an extent that it would be unaffordable for me. I was in for a bit of shock and my jaws dropped in disbelief when I checked out the prices. Most of these rolex replica were priced at such low rates that I could easily purchase a hundred or so for the same cost that I would have to pay for an original one. This is the main reason why more and more people are opting for replica watches it seems. Are you want to buy a Audemars Piguet watch but can not afford it at present, or you just can buy the watch which was out of fashion. Don't worry, we----watchcopiez can help you to solve this problem!