When you run the command sim11
, you get a screen
that looks something like:
+---------------------------------------------------+ |File Config Help (MENU BAR)| +---------------------------------------------------+ | Step Trace Run Stop Viewpoint (TOOLBAR)| +---------------------------------------------------+ |+----------+ |+----------------------------------+ | || | || | | || stats | || Trace/Messages | | || | || | | |+----------+ |+----------------------------------+ | |+----------+ |+----------------------------------+ | || | || | | || registers| || Source code | | || | || | | |+----------+ || | | |+----------+ || | | || | || | | || memory | || | | || | || | | |+----------+ |+----------------------------------+ | +-------------+-------------------------------------+
The File
button in the menu bar is the place to
start. Press the button and then press the Samples
choice. After a short delay, a window pops up allowing you to
select an assembly language file to load into the simulator.
Double click on the file ex1-simple.asm
. This loads
the source and object code for the example; messages
indicating this are displayed in the Trace/Messages window and
the source code is displayed in the Source Code window.
Now try the following exercises:
Note that the program counter is initialized to 0x6000. (All the registers are displayed in hexadecimal.) Furthermore, the source code line corresponding to the instruction at this address is highlighted in the Source Code window.
Click the Step
button in the Toolbar to single step
the next instruction (clra
in this case which
clears Accumulator A to zero.) Once it has executed, the AccA
register value (in the Registers window) is updated to its new
value. Furthermore, the Trace window shows the disassembled
instruction that has just been executed and the values of all
the registers. Similarly, the source code window highlights the
next instruction. (Thus the trace window shows the previous
instruction and the source window indicates the next instruction.)
Continue single stepping 3 more times until the instruction at address 0x6008 is highlighted. The next exercise explains how to use Breakpoints.
You set a Breakpoint (or unset one previously set) by clicking in the Brk box on the line where you want the breakpoint.
You can now simulate at full speed by clicking the Run
button in the Toolbar. The program stops again quickly.
The tracing is disbled during full speed simulation, but
the message indicates that 8 instructions that took 31 clock
cycles were simulated.
The variables of interest are at locations 0x7000 and
0x7001. Click the Viewpoint
button to set one
up and enter the address you want. (You can set up as many
Viewpoints as you want.)
Run the program a few times. It will continue to stop at the breakpoint, but the values in the Viewpoint(s) will change. (The astute reader may note that the program generates the Fibonacci series.)
To demonstrate that viewpoints work even without
breakpoints, remove the current breakpoint (by clicking on
its box) and click Run
. The program will now
not stop (until 100,000,000 instructions have been
simulated), but the Viewpoints will be updated dynamically
(and quickly). To stop the full speed simulation, click the
Stop
button.