Survey of RCX programming

Site map :

Various stuff
Rotation sensor
Security device
The Robot pages
Lego Ants
Robotarm v1.0
Robotarm v3.0
Tutorial 1
Tutorial 2
Physics of Lego
Measuring strength
Combining motors
Stepper motors
Lego ratchet
Electronic ratchet
1-to-2 multiplexor
2-to-7 multiplexor
RCX Mindstorms
Survey of RCX programming
The famous machines
Turing machine
New Page 1
References and links

Last upgrade to the site:
august 10th, 2002.

There has been 

access to my Lego pages since creation.

This is an unofficial LEGOŽ web site.
LEGOŽ is a trademark of the LEGOŽ Group of companies which does not sponsor, authorize or endorse this site.
You can visit the official LEGO website at:

Copyright 1996, 2000, Denis Cousineau



What the RCX graphic interface program editor should bring:

  1. An editor
  2. A syntax checker/compiler
  3. A download utility

Obviously, we want a graphic interface to be friendly-user, and integrating all the required tools in one place. The 3 requirements listed are to my opinion essentials, and cannot be omitted from the program editor, otherwise, it is not convenient/useful.

What the language should bring:

  1. - A complete language
  2. - A symbolic language
  3. - Interactions with on-computer programs

A good language for programming must be complete, i.e. offering all the commands that makes the RCX capable of completing any computation. Of prime importance therefore are the operations Addition, Multiplication... which are not present on the LEGO RIS software that you bought with the kit. (Technically, a complete language is said to be Turing-machine equivalent, a label that assures you

Also, a good language should be symbolic, e.g. we should be able to give arbitrary names to variables, tasks, and other components that can be addressed in a computer. Otherwise, we have to use addresses. Using only addresses can make good programs (but forget about readability and the debug time is multiplied a large number of times).

Finally, the RCX is a computer of its own. As most companies now know, using a network is much more powerful than using only stand-alone computers. That way, data can be shared, or located on computers having a larger capacity.

These six points will be used to evaluate the different capabilities of the program editors available on the net. I mostly concentrate on Graphic-interfaced program editors, but the third section covers some of the non-graphical alternatives.




Table 1 presents a review of the 6 currently known to me (Denis Cousineau) Graphic interface program editors. They are abbreviated, but you can look at the last part, using the number, for a complete name of the software, with authors, and web site.


Table 1: completeness of the package

              Graphic Interface        Language
              -----------------------  ---------------------------
              editor  syntax  download complete  symbol   computer
              ------  ------ --------  -------  -------  ---------
A.1 lego_RIS   x       x       x         NO      NO        NO
A.2 RCXCC      x       x       x         x       x         NO
A.3 BotCode    x       x       x         x       x         NO
A.4 BCommand   x       x       x         x       x         NO
A.5 Mcontrol   NO      x       x         x       x         NO
A.6 GordonBP   x       x       x         x       x         NO
A.7 PRO-BOT    x       x       x         x       x         x

You may notice first that the LEGO interface fails in all respect to provide an adequate language. It is clearly not a recommended interface for serious (or moderate) RCX applications.

Second, the Mind Control does not offers an editor. In order to create programs, you have to call notepad (or any other text processor), (don't forget to) save, and then ask for a download.

Most of the software do not implement in any way RCX-computer interaction with the noticeable exception of PRO-BOT. With PRO-BOT, the RCX will be able to ask the computer to perform complex operations (provided you have made a .EXE program with the computer-programming language of your choice that can perform that operation), and receive a response.

Table 2 looks at other aspects of the graphic interface. These aspect are not as crucial, but may help you make a choice.

In this table, I also mention what library the editor relies on for its normal functioning. The name "library" refers to a set of procedures that are needed to established the communication with the RCX, and to download programs (among other things). The library is intended only for your computer, not the RCX (but the RCX must be able to understand request send through the IR tower-this is the role of the RCX firmware; see Part 3).


Table 2: other quality of the integrated environments

             Help   Library other    comments (+good, -bad, --very bad)
             ----   ------- -------  -------------------------------
A.1 Lego RIS  x     SPIRIT   1       --interface slow and too large
                                      +visual editor
A.2 RCXCC     no    NQC      1       
A.3 BotCode   x     SPIRIT   1
A.4 BCommand  no    SPIRIT   1,2
A.5 Mcontrol  no    SPIRIT   1
A.6 GordonBP  x     SPIRIT   1        +visual editor
A.7 PRO-BOT   x     SPIRIT   2
1: also provides an immediate test of the commands: motor outputs and sensor readings
2: also provides memmap/poll/datalog readings that get back to the computer

Most editors relies on the SPIRIT.ocx library provided by LEGO corp. This does not mean that the language that you see on your editor IS the same as the name of the procedures available in the SPIRIT.OCX. BotCode for example provide a language that is only roughly inspired by the SDK documentations of the library SPIRIT.OCX

LEGO RIS and GordonBP both have a visual editor in which the notion of syntax is no longer a concern.

Finally, RCXCC is the exception: it does not use SPIRIT.OCX at all (well, it seems that it uses it for some download operation?). It uses a language defined by Dave Baum, which is a kind of cross-over between c and SPIRIT.OCX. Yet, it generates codes that are interpreted by the standard Lego firmware (see below).

Since most of the programs are relying on SPIRIT.ocx, the absence of help is a sad thing, but the SDK document is available at: For RCXCC, the NQC language implemented in the editor is fully described at: Dave's NQC page



In order to be able to use and program the RCX, two software are required:

a) an operating system (OS): this is the equivalent of DOS on old-time computer. Without DOS, the computer could not use its input/output (such as the keyboard of the terminal). The same is true for the RCX: without an OS, it does n

[Technically, the OS of the RCX is double: on part is ROM and is concerned with receiving and starting an OS, the second part is the received OS; without OS, the RCX still can use its IR-receiver, but only to receive one program, which will automatically be its OS).]

b) a set of communication procedures (called improperly "library" in this text) are also required. They are used by the computer to send information to the RCX or retrieve data from it. The library is for the computer only. The library can be composed of a kit of executable files (.EXE), or stored in dll or activeX (.OCX) files. Formally, the library must be able to send/store/retrieve information/program to and back from the brick.

Although the OS and the library are meant for two different computers (the RCX and your PC computer), they must be compatible so that they can communicate. For instance, the SPIRIT library requires that the OS/firmware firm0309.lgo provided by Lego corp. be loaded on the RCX. The converse is not true however: Other libraries can be compatible with the OS/firmware firm0309.lgo, as seen in Table 3.


Table 3: compatibility between the OS and the libraries

Operating System
(on the brick)     Libraries (on the PC computer)
                   (size)   spirit   NQC(1)  compiler(2) other comment
---------------    -------  ------- -------  ---------   ---------------
firm0309.lgo       (16 kb)      x       x         
PBForth            (13 kb)                               uses Terminal
LegOS**            (5 kb?)                        x      -good knowledge
                                                         of UNIX/c required
1: NQC and LegOS are not Win32-based software; they can or are also
      available for Mac (NQC), OS/2 (NQC) and a variety of UNIX computer (NQC
      and LegOS).
2: The only compiler that can be configure to H8 opcode to my knowledge
      is the GNU compilers (c and FORTRAN). That's fine since it is freeware,
      and of a very good quality (yet text based).

As seen, the only alternative library (the NQC) is also meant to communicate with a RCX under the Lego OS (firmware firm0309.lgo).

LegOS is in a totally different cluster, it uses text-based compiler, a program-downloader (also text-based). However, the new OS allows programming with pointer (true c language), memory management, etc.

PBForth is kind of in the middle, since it is a replacement firmware that let you work without compilers on the PC side.  Even better, it can be programmed with simple text commands (and the RCX will compile itself the code). However, you need to configure a terminal program (one is available in Win95) to communicate to the RCX.

As you can notice by the size of the firm0309.lgo, it is a rather huge OS compared to the total memory size available on the RCX.

[Technically, on the display, when uploading the OS, each increment up to 1638 or so is 10 byte long. The firmware binary image is exactly 16K counting the zero padding at the end. If you use firmdl.c, you don't send the zero bytes at the end, and you e

If memory is a concern, you definitely need an alternative OS.



A- Graphic Interface Program Editors

A.1-RIS LEGO program editor
version 1.0
Written by Lego corporation
A.2-RCX Command Center
version 1.0
Written by Mark Overmars
using NQC from Dave Baum
Version 1.1
Written by ?
Version 1.0
Written by Brian Cwikla
A.5-Mind Control
version 1.0.2
written by Eric Brok
Version 1.3
written by Malcolm S Powell (not Gordon)
Version 3.0
written by Denis Cousineau

B- Non-integrated, non-graphic Program Editor or Library

B.1-SPIRIT.OCX (comes as a ActiveX library)
version 1.0
written by lego corp.
B.2-NQC and RCX Utilities (comes as a set of EXE files run in a DOS window)
version 1.0 b4
written by Dave Baum (with contributors for RCX utilities)

C- Replacement OS (firmware)

Version 0.1.4
written by Markus L. Noga
Version 1.1.1
written by Ralph Hempel