HC11 Simulator

This describes the text-mode simulator. I highly recommend the graphical tksim11 front-end; it works similarly)

We also have a simulator, which lets us watch what a program is doing better than we can on the actual processor. The simulator is called Sim6811. As with the assembler, you first need to have gotten access to the assembler, as described in Getting Access to CS273 Software. Once you've done this, if you execute the command

Sim6811 program.s19

you will see a screen that represents the contents of the processor. Here's an example of what that screen might look like.


A 00 B 00    t=0
D  0000
X  0000 Y  0000         breakpoints ->
SP 0000 PC F800         lds     #00ff
    00 (.... ....)

       0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
0000  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0010  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0020  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0030  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0040  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0050  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0060  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0070  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0080  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
0090  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
00a0  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
00b0  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
00c0  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
00d0  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
00e0  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................
00f0  aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................

The current contents of the registers are shown at the top. We've talked about the A register and mentioned the B register; we'll get to D, X, Y, and SP later. We've also talked about the PC. The eight dots in parentheses are the condition codes register; when a code is set, its dot is replaced by a letter.

To the right of the PC contents is the next instruction to be executed, translated into assembly code.

The t= line tells how much time has passed (measured in machine cycles) since the program started executing.

The big block of aa's is some of the machine's memory. this memory, addresses 0000 through 00ff, turns out to be the only memory that your program can read and write. It contains aa in every byte at the moment because that's what's in there when the simulator starts.

Each time you press the <return> key, the simulator will execute one instruction and show you the new state.