The computer simulator window is used to run programs, and to view and edit memory. The window is divided into five regions: memory display, data path, command buttons, input/output window, and simulator options.
A memory window appears on the left side of the computer simulator window. Addresses are listed in the left column with the corresponding values in the middle column. The navigation buttons in the right column can be used to scroll up or down one cell at a time (single triangle) or one page at a time (double triangle). The top-most navigation button takes you to the top of memory (address zero) and the bottom-most button takes you to the end of memory. To go to a particular location, enter the desired address in the text field below the memory window and click the Go to: button. Click the Display Words button to view memory as 16K x 32-bit words. This mode is most appropriate when looking at data. To display the memory as 64K x 8-bit bytes, click the Display Bytes button. Byte addresses will be shown in the first column and the corresponding byte values in the middle column. This mode is most appropriate when looking at machine language programs. You can switch back and forth between viewing modes at any time. Keep in mind that the byte address of the first byte in a word is four times the word address. For example, if the word address is 10, the byte address of the first byte in that word is 40. As part of the data path animation, memory access is automatically tracked. For example, when a write operation has been completed, the window will be adjusted so that the target address will be near the middle of the window and the corresponding memory cell will be highlighted. When displaying words, data access is tracked. When displaying bytes, machine language code access (read only) is tracked. The buttons at the bottom of the memory window allow you to go directly to the address currently stored in the indicated register. For example, to view the element at the top of the stack, click the Goto SP button. |
The animated data path displays the registers of the CPU and the paths that connect them. Potential paths are shown as pale pink. Paths that are used in the execution of a microinstruction are colored green.
In the image above:
If you point at a register with the mouse cursor, the register's decimal value will be displayed in a small text box as illustrated here:
When you select the option to single step through a machine language program (see Simulator Options below), the MIR display is replaced with an IJVM display showing the IJVM instruction that has just finished execution at the top and the next IJVM instruction at the bottom. These instructions are displayed as disassembled source code. To see the machine language code, go to the indicated address in the memory window and click the "Display Bytes" button (if necessary).
In the illustration below, the invokevirtual instruction has just been executed. The method is located at byte address 139. The number of parameters for this method is stored at this address as a two-byte integer. The number of method variables is stored at address 141 (also as a two-byte integer). The first instruction in the method is at address 143 and this is the next instruction that will be executed.
There are four command buttons located beneath the data path display. The underlined characters indicate the keyboard shortcuts. For example, typing Alt-T is the same as clicking the Micro Step button.
Clicking the Micro Step button will execute the next microinstruction in the current microprogram. This allows you to trace the execution of microprograms that you write or the execution of the machine language interpreter.
When you select the option to single step through a machine language program (see Simulator Options below), the Micro Step button becomes an IJVM Step button.
The MIR register will be replaced by the IJVM display (see above) and clicking the IJVM Step button will execute the next IJVM instruction.
If you click the Run button, the computer will execute instructions until it reaches the end of the program. When you click the Run button, it becomes a Break button. Clicking the Break button will stop program execution and the button caption will revert back to Run.
The Reset button, resets the computer by restoring the default values for the CPU registers. Resetting the computer allows you to rerun the current program from its beginning.
The Exit button terminates the application. You can also close the application by choosing the 'Exit' option in the file menu or by clicking the window close button in the upper right corner of the application window.
The input/output window acts as the console of the simulated computer. Any output generated by a program appears in this window. Use the keyboard to provide input to a running program. Your application is responsible for echoing input to the output window. Important: This window must have the focus in order for user input keystrokes to be recognized. When you run a program, the simulator input/output window automatically receives the focus. However, if you interact with some other component on the interface this window may lose the focus. If so, clicking on the window will restore the focus allowing you to enter input. The non-blinking underline cursor shows the location at which the next character will be output. |
The simulator option check boxes are located beneath the input/output window.
These options give you some control over how programs are executed. An option is in effect when it is checked. If you turn off data path animation and/or memory animation your programs will execute more quickly. For fastest program execution, check both of these boxes.
When a machine language program is stored in memory and the control store contains the machine language interpreter the bottom check box is enabled. Checking this box allows you to single-step through the machine language program one machine language instruction at a time (see the section on Command Buttons above).