Saturday, March 31, 2012

Support for Breakpoints

I added a couple of new features to my JMON machine language monitor program.

I took the memory test code from here and added a memory test command so you can test memory. It's not too likely that JMON will run if your system has bad memory but it can give you a warm and fuzzy feeling that your system's memory is good.

Note that it is not recommended to run a memory test program like this on EEPROM as it has a limited number of write cycles before it wears out.

Here is a screen shot of the memory test running:

JMON Running Memory Test

The larger new feature is support for breakpoints. There is now a "B" (breakpoint) command that lets you set up to four breakpoints. You can set a breakpoint on an address where you want to go into the debugger (the Krusader mini-monitor). The command puts a BRK instruction there and saves the original instruction. When the BRK instruction is hit, code in the BRK handler puts the original instruction back and jumps into the mini-monitor at the address of the breakpoint. From there you can continue, single step, etc. Once hit, a breakpoint is cleared and needs to be set again. Breakpoints must be in RAM and the IRQ/BRK vector must be in RAM. The program checks and an error is displayed if not.

Here is a sample session:

Using Breakpoint
I've found the mini-monitor in Krusader to be a great tool for debugging machine language programs. The addition of breakpoints makes it even more useful as you stop at specific instructions rather than stepping through long sequences of code to get to the area you need to debug.

As always, you can download the latest version of JMON from here.

No comments: