NBC Compiler Usage


What is NBC?

NBC (Next Byte Codes) is a programming language for the LEGO MINDSTORMS NXT product. NBC's syntax is based on assembler programming langauges, so experienced assembler programmers (or just about any programmers) should find it very easy to get started with. Even if you aren't an experienced programmer, NBC is relatively easy to learn.

I'm using Windows, and when I click on NBC a window with some text flashes on the screen then disappears. What's going on?

NBC is a command line based tool - normally you run it by typing an appropriate command into an MS-DOS window. When you double-click the exe file it launches an MS-DOS console, runs NBC within it, then since NBC finishes almost immediately, the entire window disappears.

Some people prefer command line based tools because they allow you to use the text editor of your choice, etc. It also makes for identical behavior under Windows, Mac, and Linux. In order to use the command line version of NBC you'll need to do two things:

1) Use some sort of text editor (such as Notepad) to edit and save a source file for NBC to compile.

2) From an MS-DOS window type the appropriate NBC command. Its usually best to either put all of your programs and nbc.exe in the same directory, or make sure the directory containing NBC is in your command path. For example, to compile the program "test.nbc" you would type the following command:

nbc test.nbc

An alternative is to use the Bricx Command Center by John Hansen, which is a familiar Windows style application that provides a front end to the NBC compiler.

What computers/tools/etc do you use to develop NBC?

I use a PC running Windows XP and Delphi 7.1.