This web page describes my experience with programming Lego NXT, and the tools I've been hacking on, or using.


The spec I'm relying on is the Executable File and Bytecode reference available at Lego's site.

USB interface

The script linxt, based on libusb, seems to work fine for transferring files to and from the NXT. With a hotplug config file /etc/hotplug/usb/lego-nxt.usermap containing the line

lego-nxt 0x0003 0x0694 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
and a corresponding script lego-next to set up the device ownership, it even works without root privilages.

I haven't found any proper specification for the USB interface, besides the linxt source code.

Assembler for the virtual machine

The nbc language compiles nxt byte codes for the virtual machine. It's written in delphi/pascal, which isn't quite to my taste. I've started writing my own assembler (using common free software tools such as gcc, bison, and gperf). The current version supports only a small subset of bytecodes and datatypes, though.

The package also includes a crude disassembler.


Repository access

The subversion repository is available at


Sorry, please check the source code.