zxsp Featuresfeatures a Debuggerdebugger with disassembler, Debugger: Breakpointsbreakpoints Done: 2000 – 0.1.8 and 0.2.2and single stepper. Additionally you can load Assemblerassembler sources for Snapshotssnapshots directly with the 'Open' menu command.
In the windows menu you find a panel for the Snapshots: .Z80Z80 central processing unit (cpu). This is the central panel for the Debuggerdebugger. If you want to cancel editing, just enter empty data.
Throttle down the cpu to any speed Done: 2000 – 0.1.8 and 0.2.2and watch it running in the Debugger: Memory view
This field shows the current Registers: CPU cyclecpu cycle since last interrupt. With the information about total cpu Video signals: Frames per secondcycles per interrupt, in-screen start Done: 2000 – 0.1.8 and 0.2.2and end cycle you know how many time is left until the next interrupt or whether writing into the screen will be displayed still this frame or not until the next frame. The Sound: AY control panelay panel Done: 2000 – 0.1.8 and 0.2.2and the video beam indicator are helpful in this case too.
If the machine is halted then you can edit this field. Then the cpu will run up to the entered cycle. If the value is smaller than the current cycle, then it will run up to this cycle in the next frame. This way you may quickly advance to a certain video beam position, where you want to see whether your program is fast enough to write to this screen position before it is displayed.
These fields display the current values of the Snapshots: .Z80z80 Debugger: Registersregisters. They may be changed even while running, but then you should better know which register is not used in your program.
The values are shown in hex, so that the double Debugger: Registersregisters easily form a 16 bit value for reading. When you set a register, you may enter the value in decimal or hex.
In addition to the hex value the currently used Registers: Flagsflags are also displayed with their named bits. To set or clear a Registers: Flagsflag, add it's name or remove it from the visual Registers: Flagsflags display field. The name is important, not the position where you put it in.
Clicking on a button triggers the according interrupt. When the machine is halted, you also have the chance to clear a pending interrupt. In the control menu there are also menu items for a power-on or a simple push button reset Done: 2000 – 0.1.8 and 0.2.2and an NMI interrupt.
The IE Registers: Flagsflag represents the iff1 interrupt enable flip flop. Using this Registers: Flagsflag you can simplify debugging with a simple trick: Insert 'di' Done: 2000 – 0.1.8 and 0.2.2and 'Single stepping: Pause buttonhalt' at a position into your source where you want to stop your program, load Done: 2000 – 0.1.8 and 0.2.2and run the source Done: 2000 – 0.1.8 and 0.2.2and when the cpu hogs on 'Single stepping: Pause buttonhalt' Single stepping: Pause buttonhalt the machine, enable interrupts (or increment the pc) und resume using the single stepper.
The Memory view: Radio buttonsradio buttons left of the Debugger: Registersregisters select which register should be used as base address for the Debugger: Memory view
The Debugger: Memory view
Scrolling Done: 2000 – 0.1.8 and 0.2.2and editing memory contents is not yet implemented. (as of Done: 2008-05-26 - Version 0.7.2
The Debugger: Breakpointsbreakpoint view allows you to set Debugger: Breakpointsbreakpoints. These Debugger: Breakpointsbreakpoints are not visible to the running program; e.g. they are not a RST opcode as would be required for a native Debuggerdebugger. Debugger: BreakpointsBreakpoints can be set for execution Done: 2000 – 0.1.8 and 0.2.2and also for read Done: 2000 – 0.1.8 and 0.2.2and write access.
One special Debugger: Breakpointsbreakpoint can be set from the Tape recorder: Optionsoptions menu: 'Single stepping: Pause buttonHalt Cpu after Block Loaded' sets a Debugger: Breakpointsbreakpoint at the end of the Snapshots: .TAPtape load routine in Snapshots: .ROM
To enter a Debugger: Breakpointsbreakpoint simply enter a new line with the desired address. By default this adds a Debugger: Breakpointsbreakpoint for execution, indicated with an 'x' if you specify no To Do: other:other condition. You may also set Debugger: Breakpointsbreakpoints which Single stepping: Pause buttonhalt program execution for memory reading or writing for certain addresses, appending 'r' or 'w' to the address instead of 'x'.
The Debugger: Breakpointsbreakpoint display also starts with an information, in which page the Debugger: Breakpointsbreakpoint lies, in the above example this is Snapshots: .ROM
If you enter a Debugger: Breakpointsbreakpoint with MMU registers for the +128K / +2: RAM $8000
note: Currently it is hard to remove the last Debugger: Breakpointsbreakpoint, because clearing an input field cancels input. If you want to clear all Debugger: Breakpointsbreakpoints clear the Debugger: Breakpointsbreakpoints field Done: 2000 – 0.1.8 and 0.2.2and enter a single space. (Done: 2008-05-26 - Version 0.7.2
You may also use the menu entry in the Tape recorder: Optionsoptions menu or, supposedly, the menu shortcut for this purpose.
This button Pause button: Step over buttonsteps over a simple instruction as the Pause button: Step over buttonstep over button does. But in case of 'call' Done: 2000 – 0.1.8 and 0.2.2and 'rst' it steps into the subroutine. Block instructions are executed byte by byte Done: 2000 – 0.1.8 and 0.2.2and 'Single stepping: Pause buttonhalt' only executes once.
This button Pause button: Step over buttonsteps over a simple instruction as the Pause button: Step in buttonstep in button does. But it Pause button: Step over buttonsteps over subroutine calls, block instructions Done: 2000 – 0.1.8 and 0.2.2and 'Single stepping: Pause buttonhalt' in one go. In case of a subroutine call it enters the soubroutine Done: 2000 – 0.1.8 and 0.2.2and sets a stack marker like Pause button: Step out buttonstep out does. Pause button: Step over buttonStep over also detects when block instructions overwrite themself or are overwritten or paged out by interrupt code Done: 2000 – 0.1.8 and 0.2.2and stop. 'Single stepping: Pause buttonHalt' stops at the next interrupt even if interrupts are disabled.
Stepping over a subroutine call may stop prematurely if the stack is manipulated, namely if the subroutine pops the return address.
This button sets a stack marker Done: 2000 – 0.1.8 and 0.2.2and runs until a 'ret', 'pop' or 'ex (sp),hl' instruction pops the marked address from the return stack. For this reason Pause button: Step out buttonstep out also stops at the next unbalanced 'pop' Done: 2000 – 0.1.8 and 0.2.2and it won't stop if the stack is repositioned Done: 2000 – 0.1.8 and 0.2.2and the marked address is never encountered.