Debug 1802

To use the trace functions of the debugger first select the 'Tools' tab (yellow ellipse) and then the 'Debug 1802' tab (orange ellipse):

To activate/deactivate the debug mode select/deselect the 'Debug Mode' checkbox (blue ellipse). Debug mode is also activated and deactivated automatically when using any of the trace commands (red ellipse). The F6 key enables/disables the debug mode when used from the emulated computer window.

Active debug mode will be indicated in the emulated computer window title (yellow ellipse below). Note that in debug mode the emulator will run slower and take more processor power.

Tracing

There are 4 trace buttons to show or trace instructions executed by the emulated computer:

Tracing output will be shown in the trace output window (grey ellipse). To save the output to a log file press the 'Log' button (brown ellipse). The trace window is cleared by pressing 'Clear' (magenta ellipse).

Pause, Step, Run and Speed

The emulated computer can be 'paused' by pressing the pause button (orange ellipse) and will pause automatically when hitting a break point or trap, see also chapter 'Break Points and Traps' below.

When the emulated computer is paused the pause button will light up orange and the title of the computer will include '** PAUSED **'. To continue just hit the pause button again.

In pause mode the 'Step' button (orange ellipse) can be used to get the emulated computer to execute the indicated number of instructions and after this go back to pause mode. The 'RUN' button (red ellipse) will start execution at the paused address or at the indicated address if a value is specified.

If needed the trace and emulated computer can be slowed down by sliding the 'Speed' slider (blue ellispe) to the left. Normal speed will be restored when Debug mode is switched off even if the slider is not fully to the right.

SCRT

When activated, by selecting the SCRT checkbox (yellow ellipse below), the SCRT function will hide tracing of the 'SCRT' routines. This means when the debugger detects a SEP R4 instruction for a subroutine 'CALL' it will show 'SEP R4 CALL address' (blue ellipse) in the trace window with 'address' being the subroutine address. It will then hide the 1802 code tracing for the CALL handling, i.e. when the PC is R4. The subroutine itself will of course be shown and when ended with a SEP R5 the debugger will show 'SEP R5 RETURN' (magenta ellipse) to indicate the end of the subroutine. Again the 1802 code tracing for the RETURN handling, i.e. when the PC is R5, will not be shown.

Where possible the debugger will set the CALL register and address as well as the RETURN register and address on start-up of an emulated computer. This can be changed in runtime by changing the SCRT values after 'Call:' (orange ellipse) and 'Return:' (red ellipse), the first value is the register, the second the address. Default the registers specified will be R4 and R5.

Register, flag and I/O port values

All register, flag and I/O port values can be seen at any time (orange ellipse):

Default none of these values can be changed (protected mode), this is to protect execution of the emulated computer as changing these values would likely cause a crash. To change these values (except for input ports) unselect the 'Protected' checkbox (yellow ellipse).

To change the value of registers, flags and/or output ports, type in a different value and press enter. No value is changed until enter is pressed! Also be aware that changing values during run time of a computer might be difficult as the emulator constantly changes values. To make it easier to change something pause the emulator (via the pause button, breakpoint or trap), change the value and continue tracing using pause or RUN (see chapters, 'Pause, Step, Run and Speed' and/or 'Break Points and Traps'.

Note: some output values can be 8 or 16 bit depending on simulated HW, for example when the CDP 1870 is used output 4, 5, 6 and 7 are using a 16 bit address value instead of the 8 bit data bus.

Reset & Interrupt Generation

To reset the emulated computer press the 'Reset' button (yellow ellipse):

To manually generate an interrupt request, press the 'Gen. INT' button. The interrupt will only happed if interrupts are enabled; i.e. if IE = 1.

Break Points and Traps

Break points (yellow ellipses), register traps (orange ellipses) and instruction traps (blue ellipses) are handled with the buttons and fields marked in the screen shot below.

Break Points

To set a break point on a CPU 'execution address' type the required address in the field next to the 'Break point' button and press return (or the button). The address will be shown in the break point list. When the emulated computer reaches the specified address it will stop execution and go into 'pause' mode. A total of 64 break points can be set.

Register Traps

To set a register trap first select the required register and type the required value in the fields next to the 'Register trap' button and press return (or the button). The register and value will be shown in the register trap list. When the specified register in the emulated computer reaches the specified value it will stop execution and go into 'pause' mode. A total of 64 register traps can be set.

Instruction Traps/Trace

To set an instruction trap first select the required instruction in the fields next to the 'Instruction trap' button and press the button. The 1802 instruction will be shown in the instruction trap list. When the emulated computer executes the specified instruction it will stop execution and go into 'pause' mode. A total of 64 instruction traps can be set.

An instruction trap can be set on a range of instructions. Either by specifying 'Rx' instead of an actual register value (by use of the choice button) or using 'X' instead of a specify 4, 8 or 16 bit value. For example 'BZ X' will set a trap on all BZ instructions, INP X on all input instructions etc.

Delete

To delete a breakpoint, register or instruction trap select it in the list and press the 'Delete' key.

Deactivate

This feature is only available on Windows: to deactivate a breakpoint, register or instruction trap uncheck the applicable checkbox. To activate it again re-check the box.

Edit

To edit a breakpoint, register or instruction trap select it in the list and edit the text.