The following is a guided tour to running the simulator. sim6811 on unix is used as example.
From the top directory, enter the commands
% cd test/arch/m6811 % ../../../src/boards/sim6811 68mon.s19 PC=e06b A:B=0000 X=0000 Y=0000 SP=0000 CCR=d0(SXhInzvc) [0] e06b 8e 00 f6 lds #00f6 STACK
The simulator is ready to run. The CPU state is printed with
registers (PC .. CCR), clock cycles (
>h Breakpoint commands b - list breakpoints b [+|-] [addr] - toggle, set(+) or clear(-) breakpoint B s|c [addr] - set/clear breakpoint B C - clear all breakpoints B E|e - break on error/no break on error Memory commands md [addr [count]] - memory display mm addr [hh hh..] - memory modify u [addr [count]] - unassemble Run commands g [addr] - go s - step over subroutines t - trace one instruction R - jump to reset vector Stack commands c - print call stack C - print function calls on/off toggle w [min max] - set stack watches Miscellanous commands l - list symbols !Command - pass 'Command' to shell q - quit Register commands: r p|a|b|c|d|x|y|s val - modify register External event commands i sci [hh|"ss"] .. - io input hex digits or strings to SCI i sci print - print contents of SCI buffer i spi [hh|"ss"] .. - io input hex digits or strings to SPI i spi print - print contents of SPI buffer i out [hex|ascii|\ascii] - io output mode for displaying data
The simulator can only display assembly language and convert numbers to global symbols.
>u e06b 8e 00 f6 lds #00f6 STACK e06e 86 20 ldaa #20 SP e070 ba 10 28 oraa 1028 SPCR e073 b7 10 28 staa 1028 SPCR e076 86 30 ldaa #30 e078 b7 10 2b staa 102b e07b 86 0c ldaa #0c PTOF e07d b7 10 2d staa 102d SCCR2 e080 7f 00 fd clr 00fd FLAG e083 86 7e ldaa #7e
>t PC=e06e A:B=0000 X=0000 Y=0000 SP=00f6 CCR=d0(SXhInzvc) [3] e06e 86 20 ldaa #20 SP
Pressing Enter wil repeat the last command and is well suited for stepping through several instructions in sequence.
We want to debug the routine GETIN, so we set a breakpoint at its entry point, and then list all breakpoints.
>b GETIN Breakpoint at e1d8 set >b Active breakpoints: e1d8 GETIN
>g e06e: Running... 68Mon V1.2 (C) 1992 Keith Vasilakes SXHINZVC AB AA IX IY PC SP 11100110 A4 7E E6A4 7EE6 A47E 0000 >Breakpoint before code execution, address e1d8! Subroutine: e1d8 GETIN PC=e1d8 A:B=3e03 X=e1fc Y=0000 SP=00f2 CCR=c8(SXhiNzvc) [8936] e1d8 b6 10 2e ldaa 102e SCSR
The text printed between Running...
and
Breakpoint
, is output from the program running
under the simulator.
>c Call stack: e1cd CHRIN e1d8 GETIN
We are in routine GETIN, that was called from routine CHRIN.
There are two ways of entering IO port data into the simulator: