RCXSIMULATOR
USER MANUAL



Introduction

The RCXSimulator is a Java applet program that simulates the execution of a program written and compiled in the Not Quite C (NQC) programming language, interprets each instruction, and displays the state of the RCX processor at each step of an instruction.

The RCXSimulator Graphical User Interface (GUI) consists of the panels which are described below.

Control Panel


The control panel contains the button panel and the explanation panel. The button panel contains four buttons, the Run, Step, Stop, and Reset buttons. Clicking on the Run button will cause the RCXSimulator to execute uninterrupted until the Stop button is pushed or a Halt instruction is encountered in the program. Clicking the Step button will cause the simulator to execute the next instruction pointed to by the program counter (pc) register. The Reset button points the pc register back to zero and sets every component of the simulator back to its initial state.

The explanation panel gives a brief, general description of what each OpCode instruction will do.

Motor Panel

The motor panel displays the direction, power value, and state of motors A, B, and C. The values of the direction can be FWD (forward) or REV (reverse). The values of the power value can be 0...7. The state of the motors can be ON or OFF.





Sensor Panel

The sensor panel contains an area that displays the type and value of the sensors on port 0, 1, and 2, as well as an area containing sliders that allows the user to input the values to the sensors. The type of sensor can be light, touch, temperature or raw. The values of the sensors range from 0 to 100, and those values are scaled depending on the type of sensor they represent.

The sliders (scrollbars) in the sensor panel can be moved either left or right and any change to the slider will be reflected in the value column representing the port associated with that slider. The default value for each sensor is 50.






Register Panel

The register panel displays the register number and the value of the operand stored at that address for each of the 32 registers. The registers are numbered from 0 to 31 and each registered is normally associated with a variable assigned by the compiler.












Datalog Panel

The datalog panel displays the datalog number and its value for each of the 100 datalog entries. The entries of the entire datalog can be viewed by adjusting the scrollbar. The datalog size was prefixed to hold only 100 entries but can easily be changed to hold more values.










Method Panel

The method panel displays the pc register, the pc offset (or address), the machine language bytecode (machine code), and the mnemonic of the instruction. Each click of the Step Button causes the small arrow ( pc> ) to point to the next instruction in the program and the pc register's value to indicate the pc control address. The pc offset (or address) is a decimal value that indicates the location of a specific byte of the machine code in relation to the entire program. You could think of the program as a series (or array) of bytes -- the machine code, and each byte is assigned an index (the pc offset) based on its location in the program. As you step (or run) through a program, the small (pc>) arrow will only point to the first byte of an instruction because every instruction in the NQC langauge is followed by a varying number of bytes (this concept is explained in more detail in the I/O Instruction References). The pc register displays the offset associated with the instruction to which the small arrow is pointing.