7. Debugger

Debugging mode is entered when a breakpoint is encountered or when the user launches the debugger by the popup menu or by pressing the F11 key. This will stop the emulation engine but the LCD is still refresh.

Note : debugger windows are pre-loaded at startup in order to display them quicker. The source code window may take a while to be displayed at first run : this is due to ROM call parsing.

The debugger is made-up of several frames :
- source code
- registers
- memory
- breakpoints
- PC trace
- stack
- heap (handles)

These frames can be moved and/or resized (TiEmu save/restore this with configuration).
Frames are automatically refreshed when a change occurs from another frame.

7.1 Source code

This frame is the main one :


You can browse the source code with arrow and PageUp/Down keys. The green bar show current PC location. The blue one is the selection. The red cross is the breakpoint.

By right-clicking, you get the popup menu :
- go to address : enter the address to go,
- go to PC : jump to PC location,
- set breakpoint (F2) : place a breakpoint at the selection. The bkpt frame is updated,
- set temporary breakpoint : place a breakpoint at the selection. This bkpt will be automatically removed when encountered.
- set PC to selection : load PC with the address at the selection,
- view memory : open a tab in the memory frame with the address at the selection.

The combo box lets you choose a ROM call by using the arrow. You can type it, too. It has automatic completion. Once selected, the view is updated to begin on ROM call address.

Debugging facilities provided are :
- run/break : start/stop emulation engine without closing frames,
- step in/out/over :
    step in equals to step by step
    step out runs PC until a RTS/RTR/RTD/RTE/STOP instruction is reached (go out of the sub-routine)
    step over runs PC until instruction after the current one is reached (skips all code in a sub-routine for instance), except for branches.
    This works for JSR/BSR/FLINE/DBCC/TRAP,
- run to cursor : runs PC until cursor address is reached.

Miscelaneous shortcuts:
- F6 : (internal use) copy source code window content to C:\disasm.txt
- F1 : set selection and PC to next line

7.2 Registers


This frame displays all of the registers of the MC68000 processor. Take a look at the m68k user'smanual if needed.

USP = User stack Pointer (A7 in user mode, S=0).
SSP = System Stack Pointer (A7 is supervisor mode, S=1).
The active pointer is displayed in the stack frame.

SR is displayed in 2 modes : hexadecimal and single flags.

Each field is in-place editable.

By right-clicking on the address/data registers content, you will open a tab in the memory view at the adress contained in the register. Useful for browsing pointers and/or arrays.

If you double-click on sf/uf, you will be able to edit each flag :


7.3 Memory

You can add/remove how many tabs you want. Click on +/- to add_remove tabs.
Use arrow keys or Page Up/Down keys to browse memory.

Each value can be in-placed edited. Click the cell and you will be able to enter an hexadecimal string (like 12, 1234, 567890).

By right-clicking, you will get the popup menu:
- find / find next : open a search engine,
- go to address : let you enter an hexadecimal address to go to,
- dis-assemble : update the source frame at the selected address.
Note : the memory window may show aliases (ghosts) which does not really exist on the real calculator. For instance, RAM exists at $00000-3ffff only but if you open a tab at $40000, you will see RAM content at $000000. So, be careful !

About the search engine:


You can search for hexadecimal values or strings with or without case sensitivity (strings only).

Click the right button to start search.
Click the middle button to find next occurence.

The occurence is green highlighted in the memory frame.

7.4 Breakpoints



This frame let you manage several kind of breakpoints :
- code (added from the source frame)
- exception (traps, auto-ints, ...)
- data (access or range)
- program entry (debugger is raised at the begininng of the program you have just launched).

Each breakpoint can be added or removed and enabled or disabled. You can go to the breakpoint location, too (last toolbar button).

7.5 PC trace

This frame show the 10 latest PC values. Double-click the row will update the source frame with the row address.

7.6 Stack frame



The 'A7 (stack) is' shows the current active stack pointer (user/supervisor).

The frame displays the stack pointer (A7) and the frame pointer (A6) used on TI for function call and data storage.

Content is displayed as word values only. You can browse it by using the arrow or Page Up/Down keys.

7.7 Heap



This frame displays all the handles the calculator have. It shows:
- handler number,
- address in memory,
- and size.

Double click the row to open a tab in the memory frame at the address pointed by the handle.