In order to allow the same program to run in the D-BUG12 environment and in the simulator, a D-BUG12 emulator,
DBUG12.ASM, was written. This emulator has the following functionality:
- Handles the reset vector (at $FFFE-FFFF)
- Implements the SetUserVector function
- Allows SWI to end program execution
- "Traps" on all interrupt vectors that are not set by the user.
The emulator also disables the COP timer, enables serial port 0 to 9600 BPS, and configures the clock stretch.
Naturally, a full D-BUG12 emulation is not necessary, because the 68HC12 simulator has most of the capabilities of
the D-BUG12 user interface. The adventuresome can install the full DBUG12 program into the simulator and run it --
yes it does work!
Instructions For Use
- Assemble DBUG12.ASM into DBUG12.S19, if not already done.
- Start the simulator.
- Load your program you want to simulate and DBUG12.S19.
- Do a Reset, then press the "Go" button. Execution will stop at a BGND instruction.
- Set the PC register to the address of the start of your program. If your program starts at $4000, this step is not
- Use the simulator normally to step or run your program.
- If execution stops with a D-BUG12 BGND instruction, with the next instruction displayed being a "BRA", register
X contains the vector number of the interrupt that occurred. For instance $1B = 27, which would be an SWI
instruction interrupt - the normal way of terminating a program under D-BUG12.
- If execution stops with a D-BUG12 BGND instruction where the next instruction displayed being a "RTS", this is
an un-implemented D-BUG12 routine. Feel free to write it for extra credit.