• An overview of the pbFORTH software architecture
• Obtaining and installing pbFORTH
• A brief description of Forth
• Listings of RCX-specific words defined in pbFORTH
• Example programs
Replacement Firmware
Later, in Chapter 10, legOS, I'll talk about another popular programming environment. legOS and pbFORTH are both replacement firmware, which means they actually replace the software on the
RCX. This is the next level of power and complexity beyond NQC. If you're considering this move, which should you choose? It all depends, of course, on what you're trying to do and what
programming you've already done. Table 6-1 compares pbFORTH and legOS in several important areas.
Table 6-1. pbFORTH and legOS Compared, Briefy
pbFORTH
Programming language
Forth
Interactive?
Yes
Development OS
Any
Programming tool
Terminal emulator
As a development environment, pbFORTH excels in two areas:
startup cost
There's a certain amount of pain, the startup cost, associated with learning and using a new development environment. For pbFORTH, this startup cost is low. The software tools you'll need on the
PC side are simple and commonly available. Compare this with legOS, which requires some heavy-duty development tools that can be tricky to install and configure. pbFORTH is very open-
ended; all you need is a terminal emulator or some other simple software that talks to the RCX's IR port. You can interact with pbFORTH from a Windows terminal emulator, a Java application
running on Linux, or even a custom-developed application on a PalmPilot.
development cycle
A development cycle is the sequence of steps you need to follow to write and run a program. With pbFORTH, this sequence of steps is farily short. Basically, you upload or type your program into
pbFORTH via a terminal emulator running on your PC. The program is immediately available to run. With legOS, you need to compile the program on your PC and download the whole thing to
the RCX, which takes a couple of minutes.
However, before you get all fired up about pbFORTH, remember some caution is in order. pbFORTH itself works well, especially considering it's relatively new software, but there are only a few
good tools for working with it. As of this writing, you will have to put up with ugly-looking terminal sessions to program your RCX with pbFORTH.
pbFORTH Overview
Although I'm describing pbFORTH as a way around the limitations of NQC, it's not NQC that limits your robot programs; NQC just reflects the limitations of the RCX firmware. Remember, NQC
is a replacement for software on the PC only. It generates bytecodes, just like RCX Code, that are downloaded and interpreted on the RCX itself. NQC's limitations are the result of the limitations
of the bytecode interpreter on the RCX. To break through this barrier, you have to replace the RCX firmware itself. Figure 6-1 shows a block diagram, similar to Figure 4-1, that shows how
pbFORTH replaces the RCX's firmware.
legOS
C or C++
No
Unix, Linux, or similar
C compiler, either
gcc
or
egcs
Page 117
Need help?
Do you have a question about the MINDSTORMS Robots and is the answer not in the manual?