Debugger
Debugger
Debugger
- Edit field
The edit field must contain the filename to the model specific symbol reference
file which is chosen by the combo box.
2.) Menu Debug
- Run F5
Continue calculator emulation under debugger control. The emulation will stop at
a breakpoint. Please remember that the emulation speed is slower than without d
ebugger control.
- Run to Cursor F6
Execute program until address at cursor position is reached. Breakpoints are sti
ll active and may stop execution before.
- Step Into F7
Execute one code instruction.
- Step Over F8
Execute a GOSUB, GOSUBL or GOSBVL as one instruction. Normally the instruction c
ursor will set to the position behind the GOSUB instruction.
But this makes trouble in the following code part:
GOSUB +
NIBASC /Hello world/
C=RSTK
The program counter will never reach the address behind the GOSUB instruction. T
he debugger solve this problem by breaking the emulation when the stack has the
same level before the GOSUB instruction. In this example the single step executi
on will continue after the C=RSTK instruction.
- Step Out F9
Continue the program until a RTI, RTN, RTNC, RTNCC, RTNNC, RTNSC, RTNSXN, RTNYES
instruction is found above the current stack level.
At some code constructions (mostly used to save space on the hardware stack) lik
e
C=RSTK
PC=C
and
C=RSTK
RSTK=C
RTN
the stop address will be wrong. The problem in both code fragments is the C=RSTK
opcode. In the first example there is no RTN instruction to stop. In the second
one the C=RSTK instruction purge the original return address and then the RSTK=
With a left mouse button double click on a breakpoint you can toggle the check b
ox inside. When you use the space key instead, on all selected breakpoints the c
heck box is toggled.
- Clear All Breakpoints
Clear all address specific breakpoints.
- NOP3 Code Breakpoints
What are NOP3 code breakpoints? As you know user programs are loaded somewhere i
n memory and can be moved after a garbage collection. So it's very difficult to
break a user program at a hard set breakpoint with F2. To solve this problem the
debugger will stop emulation at a NOP3 opcode. So you can easily add a NOP3 com
mand into your sources to force a break condition. To enable this you have to ch
eck this item.
NOP3 and NOP3, what's the difference? The Saturn CPU has no NOP command, so NOP3
is an opcode that is three nibbles long and doesn't change a register. In the H
MACRO
CON(3) #024
ENDM
NOP3
BREAK
code breakpoint
GOSBVL =SAVPTR
save register
GOSUB +
NIBASC /Hello world/
C=RSTK
RPL
CODE
GOVLNG =GETPTRLOOP
ENDCODE
- CODE Object Breakpoints
If this item is checked, the debugger stops program execution at the first instr
uction of every DOCODE object which isn't located in ROM. For inspecting DOCODE
objects in ROM use address CODE breakpoints instead please.
- RPL Breakpoints
If this item is checked, the debugger stops program execution on every instructi
on called after a PC=(A) or PC=(C) opcode. This is normally the begin of a new R
PL command. RPL breakpoints use a "-R" marker instead of the assembler "->" PC p
osition marker.
4.) Menu Interrupts
- Step Over Interrupts
If this item is checked, interrupt handler code will be skipped. This option is
useful when you don't want to debug the interrupt handler. But be careful, when
you disable the interrupts all code until interrupt enable belong to the interru
pt handler code and couldn't executed in single step any more. Enabled breakpoin
ts are still active.
You can also use this option if you want to quit the interrupt handler. Just che
ck this option, press F7 for "Step Into" for stopping the debugger behind the RT
I instruction, and uncheck this option again.
5.) Menu Info
- Last Instructions...
This is a short viewer for the last 255 executed CPU addresses. The disassembled
opcode maybe wrong, because only the CPU address of each command was saved and
memory mapping may have changed meanwhile. In the "Last Instructions" dialog you
can copy selected lines to the clipboard or clear this list.
- Profiler...
This opens a small toolbox window which shows the number of CPU cycles and the c
orresponding execution time of the instruction sequence between the last two bre
akpoints. The CPU cycles are only approximate values, the real cycles are depend
ing mostly on the used ROM to Saturn CPU core interface.
- Write Only Registers...
Some of the display registers have a different meaning on reading and writing. T
his dialog shows the data written to the write only I/O registers.
6.) Code window
This windows shows you the disassembled code. The line with the current PC is ma
rked with a "->" or "-R" between the address and the disassembly.
You can use the UP, PAGE UP, DOWN and PAGE DOWN keys to scroll the window conten
t. There is one strange behavior, when you move to higher addresses the debugger
is able to disassemble the next line correctly, but when you move to cursor to
lower addresses the debugger does not know if this address is at the begin or in
side of an opcode. In result you get wrong disassembled lines.
Context menu pressing the right mouse button:
- Go to address... G
Moves the cursor to the specified code address. Therefore you can enter a hexade
cimal number or the symbolic reference name.
- Go to PC
Sets the cursor to the actual position of the PC.
- Set breakpoint F2
Toggle a code breakpoint at the cursor position in the Code window.
- Set PC to selection
Set the PC to the cursor position. Be careful with this command, you change the
execution order of the commands!
- Find
Search in the mapped CPU address area for an address which contain a PCO (Primit
ive Code Object) header. The disassembled code of this address is shown in the C
ode window.
- Previous PCO
Search for a PCO before the address shown in the first line of the Code window.
- Next PCO
Search for a PCO behind the address shown in the first line of the Code window.
7.) Register window
Here you can see the actual contents of the CPU registers. The values are only u
pdated at a program execution stop. All changed CPU registers are highlighted.
With the left mouse button you change the content of the register. On bit regist
ers, like CY and Mode, the state change immediately without any request.
8.) Memory window
This windows shows the memory content in the selected context.
You can use the arrow, PAGE UP and PAGE DOWN keys to move the cursor to a memory
position, the + and - keys change the memory position by one nibble under the c
ursor. With a double click on the left mouse button (only in Map mode) you can c
hange the content of the two addresses. When the memory position is read only (R
OM or write protected RAM) the content wouldn't change.
Context menu pressing the right mouse button:
- Go to address... G
Moves the cursor to the specified memory address. Therefore you can enter a hexa
decimal number or the symbolic reference name.
- Go to PC
Sets the cursor to the actual position of the PC.
- Go to D0
Sets the cursor to the actual position of the D0 register.
- Go to D1
Sets the cursor to the actual position of the D1 register.
- Go to Stack
Sets the cursor to the return address placed in the top level of the stack.
- Follow
Follow is a Pop-up menu to change the address behavior of the memory window. Nor
mally the address of the memory window is static and only change by entering a n
ew address. With Follow the memory window view follow the content of a selected
address or register. In follow mode the memory window is only updated after an e
mulation step.
- Follow none
This is the default mode. The address of the memory window is static.
- Follow Address Content
This is a special mode of indirect addressing. You can specify an address which
content will we interpreted as memory pointer. The memory window follow this mem
ory pointer.
- Follow Register PC/D0/D1
The Memory window follow the content of the selected register.
- Find... F
Calls the "Find" dialog box, allowing you to search for a data sequence in hexad
ecimal or ASCII mode. The search area is selected by the memory view Mapping mod
e described in the following section. If the data sequence is found the Memory w
indow and an opened "RPL Object Viewer" window will be updated.
With the button "Previous" you can search for the previous and with the button "
Next" you can search for the next occurrence of the data sequence.
When you close the "Find" dialog box, you will loose all saved strings in the da
ta combo box.
- Mapping
Mapping is a Pop-up menu to select the memory view of the Memory window. Normall
y the CPU see only 512KB of the total memory, the rest is banked or covered by o
ther modules. The following menu entries select the memory chip connected with t
he chosen Chip Select signal of the MMU. The connections are calculator model de
pendent.
- Mapping Map
This is the default mode. Here the Memory window shows what the CPU see. In this
mode you can also change the memory content of writeable memory.
- Mapping NCE1/NCE2/CE1/CE2/NCE3
Here the Memory window shows the content of the selected Chip Select signal. The
content is showed in a linear address model and it's content can't be changed i
n this mode.
Here's a comparison of the mapping of the emulated calculator models:
Abbreviations: ROM
RAM
Flash
Slt
BS
nc.
=
=
=
=
=
=
| HP38G
| HP39/40G | HP48S/SX
| HP48G/G+/GX |
HP49G
----------------------------------------------------------------------------NCE1 | ROM 512KB | ROM 1024KB | ROM
256KB | ROM
512KB | Flash 2048KB
NCE2
CE1
CE2
NCE3
|
|
|
|
|
|
|
|
RAM
32KB | RAM 32/128KB | RAM
Slt1 32/128KB | BS
| BS
Slt2 32/128KB | Slt1 32/128KB | RAM
nc.
| Slt2 32KB-4MB | RAM
256KB
128KB
128KB
This example
LC(5) #C0000
CONFIG
LC(5) #98765
CONFIG
128KB size
start address of module
will config a 128KB module at address #80000 and not at the given address. So th
e MMU viewer will show you the address #80000.
11.) Miscellaneous window
The Miscellaneous window show you the internal state of the interrupt flag, the
1ms keyboard handler and the contents of the Bank Switcher latch. The Bank Switc
her item is only enabled on calculators with a latch inside. You see the loaded
value of the address lines A6-A0. You have to ignore the last bit (A0), because
it isn't wired to the six bit latch.
You can change the values by pressing the left mouse button over the old content
.
01/09/13 (c) by Christoph Gieelink