BrickOS Command Reference v2.0-

The history and development of LegOS (now evolved into BrickOS) as been a feat of amazing ingenuity and engineering prowess. However, documentation for LegOS/BrickOS for the novice user has been difficult to come by since it's inception. This is probably rooted in the fact that from the beginning, this has been an "expert's only" development; developed by hardcore hackers/ programmers/hardware gurus for those with the same inclination. Consequently, much of the documentation available has been through the automatically generated API docs, which are often difficult to wade through.

This document hopes to list and outline the basic and most useful C (User level) commands available to the BrickOS programmer to directly control the RCX via BrickOS. Lower level functions are avoided and this reference is by no means comprehensive. The information was distilled down from the Documentation for C coders document. Please consult the BrickOS Documentation at the Source Forge Repository as the definitive reference.

A few function calls and API's have changed since I last released the original version of this document for LegOS 0.2.4. It has been a long time since I've had a chance to play around with BrickOS (switched over to Mac OS X and had a heck of a time getting a working development environment up and running) and I thought going through the API's would get me back up to speed. I thought since I'm doing this for myself, why not update the old command reference? This is work in progress, any contributions/help/suggestions/corrections would be greatly appreciated. Thus, this is my humble contribution to the wonderful BrickOS community.


Dave Chen
BrickOS (at) DaveChen (dot) org

(Original Document: v1.0-10/29/2000, Updated v2.0-7/28/2004)



  1. Provide more code examples, especially code examples for Thread management and Event based program/thread control.
  2. Document LegOS Networking Protocol (LNP) and its functions. I haven't used LNP at all so I need some help with if anyone wants to give me a hand.
  3. Document Semaphore.h - again, I don't know much about using Semaphores for Inter Process Communications so I would need help writing this section.
  4. Document the newer BrickOS features like dirpd.h (Techno-Stuff 2 channel IR Proximity Sensor support), swmux.h (Techno-Stuff sensor multiplexor support), remote.h (LEGO IR Remote subsystem)
  5. Provide more crossreferenced links back to the BrickOS Sourceforge documentation

Main Program and Miscellaneous Information


Memory and String Management


Task Management


Reading and Controlling Sensor


Controlling Motors


Controlling the RCX LCD Display

Digit display positions are denumerated from right to left, starting with 0 for the digit right of the running man. Digit 5 is only partially present on the RCXs display.


Reading RCX Buttons


Making Sounds

Back to Contents

Command Reference copyright 2004 by David C. Chen (all rights reserved).