Additional Notes on the Super Simple CPU Applet
(provided by your instructors)
Start the Super Simple CPU applet
If you have followed the use of the applet in class, you might jump to
the applet and then only refer to these notes
in another window if you have a problem.
Contents:
Log Window
Selections in the Main applet
Data formats: All data is initially
shown in binary (which is important to decode instructions).
Some values may be negative (leftmost bit 1). You are not responsible
for the binary encoding. See p. 60 in the text if you like.
We will generally use nonnegative data to make it easy to recognize.
By unchecking the binary boxes the data for the CPU and/or the memory is
displayed in decimal (making it easier for most people to read data values).
You may want to switch back and forth to look at the machine code for instructions
and to look at data values in the accumulator or data in memory.
The Opcode list and More Info buttons:
The "Opcode list" button provides a small summary of the opcode meanings.
"More Info" explains more completely.
The examples pulldown list:
This is a good place to start finding programs. We will not consider
the examples "negative numbers" or "GCD" in class.
Execution Speed
Normal execution: To follow the execution, you
can leave "normal" in the dropdown list at the left, and press the "1 step"
button to see each instruction execute. If this goes by too fast,
you can try doing it the slower, but much more complicated way in manual
mode:
Manual Mode: This is tricky to use correctly. Skip
it if normal mode is slow enough. If not, read on:
Change the "normal" in the left dropdown menu to "manual".
Then to initiate an instruction, you press "1 step". You can wait
on each substep as long as you like and press the "advance" button to go
on to the next substep. Eventually each step ends with the label
in the blue field "Updating PC". At that point you must press the
"1 step button" to start the next step, and show each further substep with
the "advance" button .... Only press "1 step at the beginning of
the execution and when you see "Updating PC".
If you press the wrong button when single stepping, the applet seems
to get confused. You may need to reload your example, or exit the
applet page and return.
Running a program continuously: If you want the applet to
just run the whole program, you can press the "Run" button. If you
want to stop before you reach a stop instruction, press the "Stop" button.
(This is particularly important if you forget to enter a Stop instruction!).
If you do not care to follow the workings of individual instructions, you
can choose "Fast" mode.
Reset button
The "Reset" button ONLY resets the CPU to all 0's. It does not change
memory. That should leave the instructions the same as before, but
data values are NOT reinitialized. If you assemble a program and
load it to memory, all of memory is reset automatically, but you must still
reset the CPU with this button.
The reset button is unnecessary when you first load an example from
the dropdown menu.
The Assemble Window and Loading and Saving
Saving memory contents
If you want to save memory contents, you will need to press the "Assemble
Window" button. Click on the "Load from Memory" button to copy memory
into the right text area as one continuous text block, with one memory
location per line. Unfortunately there is no way to save this text
area directly, nor any menus or buttons to help you, but you can select
all the memory text, for instance by dragging the mouse, and then copy
it using the key combination Ctrl-C. (That means hold down the Ctrl
key and then press the C key, and release the C and then the Ctrl key.)
Then you can paste the memory data into another text application.
For instance in notepad you can use Ctrl-V to paste, or you can select
the appropriate menu item or button.
Loading memory contents
Loading memory is roughly the reverse. Paste your machine code (leading
0's not needed) from some other text source into the right text area in
the Assemble Window. Then press "Load to memory" button.
Assembly/Disassembly
Example assembler code: You can load the assembler code for
any of the examples by selecting from the dropdown list of examples, just
as in the main applet window.
Assembling: You can assemble assembler code in the left
text box into machine code on the right using the Assemble button.
You can then put it into memory by pressing the "Load to memory" button.
Disassembling: The Disassemble button does NOT operate
on the right text window, it disassembles main applet memory into the left
text box of the Assembler Window. The right assembler window is ignored.
It also fails to be a true inverse of the assembler because the disassembler
does not generate any symbolic labels. It just uses numbered addresses.
Loading and saving assembler programs
Loading assembler programs:
-
Paste the assembler code from another document into the LEFT text box in
the assembler window, again pasting with Ctrl-V.
-
Press the "assemble" button
-
Press the "Save to memory" button
-
Be sure to press the "Reset" button before running the new code.
Saving assembler programs:
You can Select the text on the left side of the assembler code window,
and then paste it into any text file, in the same way that the machine
code can be copied from the right side. If you have made instruction
changes directly to memory, you can save them by disassembling first.
In this case you lose any symbolic labels from earlier versions of the
assembler code.
Log Window
Press the "Log Window" button in the applet. The log shows all instructions
executed, not just in the current program. There is no button to
delete old entries, but the log is an editable text window: you can
select parts and delete them or save them elsewhere.
Last modified:
10 February 2003