• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Recovering lost programs

Page history last edited by Roger 8 years, 9 months ago



Computer-related Problems

Our team has had a few computer-related problems:

  • Laptop shut down (by itself?  low battery?), and the program was lost.
    • Tip: Save early, safe often!
  • Kids accidentally deleted instructions from their program.  Perhaps by bumping/dragging on the trackpad, or pressing the wrong key.
    • Once an instruction is removed, their program looks totally broken, and they almost end up rewriting it from scratch.
  • Battery goes dead, and forgot to bring charger
    • Team is now dead in the water.  No easy way to transfer progress to another laptop.


Writing it down on Paper 

  • We created a chart that can be used to record the program changes, and compare against what is on-screen.
  • Attached is the form we're using:  Lego-Mission-Summary.doc


Extracting the program from the NXT Robot Brain

  • The kids were surprised to learn that they can't simply transfer their program from the NXT back to their computer.
    • If I can download it, why can't I upload it?
    • Because it's compiled into binary instructions for the brain.
  • What about bluetooth?  Bluetooth is fun and powerful!
    • You can transfer the binary program from one NXT to another, but you still can't get the original graphical version back.  Bummer.
  • Details
    • On your computer, your program is an RBT file.  It's graphical.
    • When you download it to the brain, your computer creates an RXE file.  It's binary.


Hacking on Binary Programs

There are tools here to extract the RXE file from your robot's brain:







NeXTExplorer is a Windows program which lets you explore files on the NXT and PC with drag-and-drop support between the two systems. You can execute programs on the NXT, play sounds on the NXT, defragment the NXT filesystem, delete selected files or all files, and much more. This is a standalone version of the NXT Explorer tool built into BricxCC.




RXEDumper is a simple Windows program which can be used to edit and compile Next Byte Codes (NBC) programs. It also lets you decompile NXT executable programs (.rxe, .rtm, and .sys). If you want a full-featured IDE for writing NBC programs you would be better off using BricxCC



Reverse Engineering a Binary Program Dump

The best you can probably hope for is to extract the motor move durations from the program.  But those are the most valuable.


RXEDumper will show you a text listing that has these sections:

  • Header
  • DataSpace
  • ClumpRecords
  • variable declarations
    • definitions
    • declarations  <--- look here
  • program code


Below is an example of the declarations section.  In there you will see motor commands -- durations and power levels.  The durations are usually the largest numbers.  The power levels were 75 for this program, so you can spot them.  It may also be possible to figure out which motors and directions are being driven:

;------- declarations -------
sl0000    sdword    1800  <---
sl0001    sdword    
sl0002    sdword    75
sl0003    sdword    
sl0004    sdword    
sl0005    sdword    75
m0006    mutex
sl0007    sdword    -1
ul0008    dword    75
ul0009    dword    
ul000A    dword    90
ul000B    dword    360   <---
sl000C    sdword    
m000D    mutex
sl000E    sdword    -1
sl000F    sdword    
sl0010    sdword    
sl0011    sdword    
ul0012    dword    
sl0013    sdword    
sl0014    sdword    
m0015    mutex
sl0016    sdword    -1
m0017    mutex
sl0018    sdword    -1
sl0019    sdword    -100   <--- ?
sl001A    sdword    
sl001B    sdword    100
m001C    mutex
sl001D    sdword    -1
sl001E    sdword    
sl001F    sdword    
sl0020    sdword    
sl0021    sdword    
sl0022    sdword    100
ul0023    dword    
sl0024    sdword    
sl0025    sdword    
sl0026    sdword    100
m0027    mutex
sl0028    sdword    -1
sl0029    sdword    4
sl002A    sdword    2
sl002B    sdword    1
m002C    mutex
sl002D    sdword    -1
ul002E    dword    
ul002F    dword    
m0030    mutex
sl0031    sdword    -1
m0032    mutex
sl0033    sdword    -1
sl0034    sdword    1
sl0035    sdword    
m0036    mutex
sl0037    sdword    -1
m0038    mutex
sl0039    sdword    -1
sl003A    sdword    
sl003B    sdword    1
m003C    mutex
sl003D    sdword    -1
sl003E    sdword    1620   <---
sl003F    sdword    
sl0040    sdword    -75
uw0041    word    1



Comments (0)

You don't have permission to comment on this page.