Debugger

Writing a Z80 debugger that runs in software alongside the code you want to debug is a bit like trying to catch a lion: the lion really has to want to be caught. Whether the Astrum debugger is useful to you will really depend on what your code does and which bits you want to debug. It has been used to successfully debug quite a complicated piece of code and it made stepping and analysing the code quite easy. Like the lion, if you and your code want to use the debugger you can! When the assembler has successfully completed you have a binary file. The assembler keeps the symbol tables in memory and the debugger can use these to help you debug your code.

When your code is to be debugged, Astrum will load a version of the debugger that lives below your codes ORG. Hopefully that will mean the debugger will be out of the way. It also pages out the editor and source code, leaving only the portion of Astrum between 26000 and 32767 visible. This portion is needed to return from the debugger.

You can run the debugger separately. Load the appropriate debugger, they are marked with the load address. For example if you need the one that loads at $c000 then do:

    LOAD "debugc000" code $c000
    rand usr $c000

Commands

In the below commands xxxx denotes a 16-bit number. This can be a hex number, a decimal number (if preceded by a =) or a symbol from your assembler. It can also take simple expressions in involving +. So BUFFER+10 is valid for 16 bytes past BUFFER. nn denotes an 8-bit value.

D xxxx nnDisassemble nn instructions from xxxx. nn can be omitted and will default to 8. xxxx can be omitted and will default to the current instruction.
P xxxxShow the value of xxxx
M xxxx nnShow the contents of nn bytes of memory starting at xxxx. nn can be omitted and will default to 16. xxxx can be omitted and will default to the value in HL.
RShow registers
BShow current 8kB bank mappings.
SStep (i.e. execute) the current instruction.
OStep over (i.e. execute) the current instruction. If the instruction is a call then the whole routine will be executed
G xxxxGet to xxxx. This runs your code until the program counter gets to xxxx.
CContinue. Runs your code from the current point.
Z xxxxSet the program counter to xxxx