D B 9 2

  A debugger for TI92+ and TI89

Original TI92 version by Tleilax

Conversion and updates by DBA


 

TABLE OF CONTENTS

Introduction

Start

Windows and keys

Exceptions

Program terminated

Swap

Symbolic debugging

DB92 installed in a  fixed memory area

Beta testing, bugs

Further developpement

Credits

Revision History

Contact

 


Introduction

DB92 is a debugger that runs on the TI92+ and TI89. It is a DoorsOS program. It features a disassembler, symbolic debugging... It is still a beta-version. Please report bugs to DBA NOT to Tleilax.

The .ZIP package should contain the following files :

It is possible to install db92 into a fixed memory area. It has many advantages. See db92 in fixed memory section.


Start

The name of the program to be debugged should be contained in a TEXT variable named 'todb92'. If this varible doesn't exist, DB92 loads a program named 'test' (maybe it won't work that way in the future). If 'test' doesn't exist, PC points to $000000. If the program is a DoorsOS compatible, then DB92 will point on the program entry, else the program is considered as a TIOS one and DB92 will point at the begining of the program.

The debugged program runs in USER mode, but it is still possible to redefine interrupt priorities ('privilege violation' exception is used to allow that). As the debugger needs to take interrupt 6 into account (to test the ON key), it is not possible to set the interrupt priority bits to a value greater than 5, so don't be surprised if after executing a 'move #$2700,sr' you see $0500 in sr.

Trap #1 is also redirected to avoid Auto-int 6 to be shut down.

Note that the debugger allows the program to access directly the SR register without throwing a 'Privilege violation' error. So, if you debug a part of the program that is supposed to run in USER mode (that is, out of a trap or Auto-int routine), you will still be able to access SR without generating an error (I will try to fix that someday).


Windows and keys

The screen is divided into three parts :

The left pane can contain the 'Registers' window and the 'Breakpoints' window. The bottom pane can contain 'Dump' windows (Handles or simple dump) or 'Symbolic' windows ( 'Labels' and 'Variables' windows).

 

Data entering

You sometimes need to enter hexadecimal numbers. the number you enter is displayed in the title bar of the active window. Valid keys are 0..9, a..f (upper case letters are ignored), backspace, ENTER to valid and ESC to cancel.

General Keys

These keys can be pushed from everywhere into DB92.

F1

About

F2

Reloads the program.

F3

Closes the active window.

F5

Swaps to the program's screen (see Swap section). Any other key swaps back to the debugger if the interrupts were not replaced by the program. Else, ON key swaps back. Note that pressing F5 replace the AutoInts used by the debugger by the AutoInts you set in your program, so that software graylevels are enabled.

Diamond+F5

Graph ripper.

F6

Changes active window. The window with inverted title bar is the active window.

F7

Trace into (debugs inside branchs and traps)

F8

Step over (directly executes branchs and traps)

ESC

Should exit the debugger...

APPS

Displays the menu.

Lock+left/right

Scrolls the active window (Lock is replaced by Alpha on the TI89)

r

Run

u

Unload symbolic info

Shift+s

Saves register values

Shift+l

Load previously saved register values. Shift+L again to revert to the last values.

ON+ESC

Interrupts program execution (during Step or Run)

 

Menu

The menu currently has 3 items :

Code Window

The instruction pointed to by PC is preceded by '>'. The bar in inverted video marks the selected instruction.

Up/Down

Changes the selected instruction. It is always possible to go down but it is not always possible to go upper than the first displayed instruction.

Left/Right

Selected adress +2/-2

Diamond+Down

Next page

F4

Run to (runs the program until the current instruction is reached)

g

Go to adress (Allows to enter the adress of the selected instruction)

s

Set PC to selection

p

Set selection on PC

b

Toggle breakpoint

c

Go to ROM_CALL number

e

Set dump to selected adress

+/-

Adds/Subs an offset

 

Registers window

Selected register is preceded by '>'. To change its value, press ENTER then enter the new value.

Up/Down

Changes the selected register.

Enter

Enter modifications, push enter to exit the edition mode

g

Set code to the value matched into the register

e

Set dump to the value matched into the register

a

Points on the ax register

d

Points on the dx register

p

Points on the PC register

 

Dump Window

To display this window, use the menu if necessary (APPS key). At the beginning, the adress is that of the entry point of the debugged program.

Enter

Switch Edit mode On and Off

  • In Edit mode

Up/Down/Left/Right

Changes the cursor position

Hex numbers

Change the value at cursor position

  • In Normal mode

Up/Down

Scroll one line

Diamond+Up/Down

Page up/down

Left/Right

Increments/decrements the adress

g

Go to adress

h

Go to handle

s

Search string or bytes

n

Find next

t

Set the cursor (in the handle window) below the actual handle being dump

z

Go to the end of the handle (tag)

+/-

Adds/Subs an offset

p

Set code selection.

l

Load symbols (1)

Note (1): To perform this operation you need to have executed autosymb.exe and to have included the .sdb file into your source.If done just search for the header 'dinf', when found push 'l'.(see 'Symbolic debugging' section).

 

Variables window

To display this window, use the menu if necessary (APPS key). Contains the adresses, names and values of the variables that were recorded in the symbolic information table (see 'Symbolic debugging' section).

Up/Down

Moves through the list

Diamond+Up/Down

Page up/Page down

Enter

Allows to enter a new value for the selected variable

s

Search for a variable

n

Find next

g

Set code selection to the variable's address

e

Set dump address to the variable's

h

Goto the first variable

 

Labels window

To display this window, use the menu if necessary (APPS key). Containes the adresses and names of the labels that were recorded in the symbolic information table.

Up/Down

Moves through the list

Diamond+Up/Down

Page up/Page down

Enter

Set code selection to the variable's address

s

Search for a variable

n

Find next

e

Set dump address to the variable's

h

Goto the first variable

 

Handles window

To display this window, use the menu if necessary (APPS key). Each line in this window contains the following fields : Handle number, Address of the corresponding memory block, and a Hexa/Ascii dump of a part of that block.

Up/Down

Moves through the list

Diamond+Up/Down

Page up/Page down

Left/Right

+/- 10 bytes

g

Go to handle

z

Zeroes the offset

 

Graph ripper

Shows the graph at a selected memory location. The current adress and width are displayed at the bottom.

Up/Down/Left/Right

Moves through the memory.

Diamond+Up/Down

Moves through the memory page per page.

+/-

Increase or decrease width

Any hexa digit (lower case)

edit the address

 

Breakpoints

There are two kinds of breakpoints :

  • RAM for inconditionnal breakpoints placed in ram. This kind of breakpoint uses TRAP 13 : the instruction at the breakpoint adress is replaced by a TRAP 13 instruction.
  • ROM for breakpoints above $200000 or conditionnal breakpoints. Those breakpoints use the TRACE ability of the 68000, as it is impossible to write a TRAP 13 instruction in rom... This kind of breakpoint slows down program execution A LOT!!!
Up/Down

Move through the list

d

Remove a breakpoint

g

Set code selection to the breakpoint's address

e

Set dump to the breakpoint's address

s

Suspend breakpoint

If the program is interrupted during a Step (by ON+ESC), the breakpoint put by the Step is not removed : it is possible to continue execution until the corresponding RTS is reached by pressing 'r'. Breakpoints are toggled with the key 'b' while the 'Code' window is active. The 'Breakpoints' window (accessible by the Menu) shows the adresses of the breakpoints.

 

ROM calls

Up/Down

Move through the list

Diamond+Up/Down

Move through the list page per page

Enter

Set code selection to ROM call's address

e

Set dump to ROM call's address

s

Search for a specific ROM call given the begining of its name

n

Find next

c

Go to ROM call

h

Go to ROM call #0  (home)

 

 

Files

Up/Down

Move through the list

Diamond+Up/Down

Move through the list page per page

Left/Right

Quit/enter a folder

Enter

Set dump to file/folder

e

Set dump to the TIOS entry of the file/folder

s

Search for a specific file/folder given the begining of its name

l

Loads the symbolic table of the file if available


Exceptions

The debugger installs managers for the following errors :

  • Address error
  • Illegal instruction
  • Division by zero
  • Bus error
  • Line 1111

Usually, the TI-92 displays a message and freezes. With those managers, you just have to press a key to go back to the debugger. It doesn't prevent unexpected results however. For adress error and bus error, the instruction pointed to by pc after the exception is usually the instruction following the instruction which caused the exception.

The debugger aloso uses those vectors :

  • Trap 13
  • Privilege violation
  • Trace
  • Auto int 6

Program terminated

When the end of the program is reached, a message is displayed. Press a key to go back to the debugger. PC points again at the beginning of the program.

 


Swap

NOTE: We have removed this option to include it into DB92 itself, please let us know if you want this usefull feature back.

The 'Swap' library contains two routines that swap the screens :

  • Prog_Screen swaps to the program's screen default behaviour : sets screen adress to tios::lcd_main.
  • Debug_Screen swaps back to the debugger's screen default behaviour : does nothing.

This library allows the debugged program to adjust the screen settings it needs to be displayed properly (contrast, line size, hardware graylevels...) The library contains some free space where the debugged program can store data needed to perform the swapping, such as the program's screen adress.

The label before this free space is 'Data'. The program can access this data by including the 'swap' library to its library list. The source of the library should be included in the .ZIP package. If you use a library such as graylib or any routine that uses an AutoInt to swap screens, you don't have to rewrite the 'swap' library, as your interrupt handler deals with the screen (it also works when you look at your program's screen using F5 key).


Symbolic debugging

DB92 allows the programmer to include symbolic debug informations in the program. The informations are displayed when available in the Code window : When the debugger encounters a branch instruction with an adress that matches to a label's adress, it replace the adress by the label's name (plus character ':' ). When it encounters a memory access that corresponds to the adress of a variable, it replaces the adress by the variable's name (plus character '_') ONLY if the adressing mode is 'Absolute long' or 'PC relative with offset', which are the most used adressing modes when a variable is directly referenced in the source listing.

The symbolic informations are included in the program itself. Some macros are provided to help you using this feature (they are in symb.inc) : Variables are declared in a block that begins with 'dbv_begin' and ends by 'dbv_end'. Each variable is declared with 'dbv_add var_name,var_type' where 'var_type' is the size of the variable (dbv_BYTE, dbv_WORD or dbv_LONG).

Labels are declared in a bloc that begins with 'dbl_begin' and ends by 'dbl_end'. Each label is declared with 'dbl_add label_name'. The last macro is 'db92_symbols'. It must be placed JUST BEFORE your program's entry point. It contains the adresses of the Variables and Labels blocs and notifies the debugger that symbolic informations are present.

Actually, you usually won't have to use these macros : 'autosymb' is a program that scans your source file for labels and variables and automatically builds a file that you can include just before your program's entrypoint. It is a really simple program, it doesn't even searches for included files. I included the source file in the package so that you can improve it.


DB92 installed a fixed memory area

The program 'db92inst.9xz' is a utility that copies 'db92' to fixed memory area. It has two important advantages :

  • Once db92 is copied, you can delete it (you can also delete  'db92inst' ). The debugger does not waste a single byte of memory then.
  • As db92 is in a fixed location in memory, you can debug programs that use memory allocation without risk, and you can debug the ROM.

The drawbacks now :

  • Once db92 is in the stack, you cannot turn the calculator down manually, you have to wait for APD (this is a bug, it will be fixed maybe later; this is because of a bug into the ON+ESC key combo). Note that you can easily turn off your calc typing the command: exec "4e444e750000", it stands for Trap   #4 then rts.

Once db92 is copied you can invoke it in two ways :

  • By pressing ON+ESC, the debugger is launched as if you pressed ON+ESC during a program's execution. It is recommanded that you invoke db92 this way only when the TI-92 is idle. You shouldn't quit the debugger while the calculator is busy either. Sometimes the calculator crashes when you exit. Once the debugger is invoked, you can use ON+ESC even when the calculator is busy.
  • By using the program 'launch92'. It launch DB92 using the program you just choosen.

Beta testing, bugs...

I hadn't much time to test deeply this program yet. I have not found any serious bug but I'm pretty sure there are lots. Note:this version has been tested  with the 'Tiger' emulator, and 1.00, 1.01 and 1.05 ROMs. (For 1.05 ROM it is NOT the same binary program, please verify that the DB92.9xz you've is the good one)

Be careful when you debug programs that allocate memory : first, if there is an error in the freeing routine, the debugger will probalbly crash when you quit ; second, don't forget that if you single step the program or if you stop it by ON+ESC, the allocated memory is not freed. So if there is no reason to avoid it, don't quit the debugger before your program has properly ended (it doesn't mean that you shouldn't interrupt your program, it means that if you did so, you have to press 'r' again). The usual case of prema ture exit is when you found THE bug and you are in a hurry to download the corrected version ;) (or at least that is how I see the thing...)


Further developpement

 

 


Credits

I would like to thank all the people who have worked and probably still work for the developpement of the Fargo shell. And :

Jonas Minnberg for the Tiger emulator

Thibaut Terlon for lending me his TI92 for a moment

Mathieu Lacage and Sacha Kaercher for their suggestions/bug reports


Revision History

 

/07/1999 v 0.9.0

fixed bugs, added features, added bugs.

Newest version by DBA
v 0.7.1

fixed bugs, added features

(...)

 

v 0.2.1

fixed bugs, added features

v 0.1.3

fixed bugs, added features

v 0.1.2

fixed bugs, added features

v 0.1.1

first public release


Contacts

Original author: guillaume.pothier@eleve.emn.fr (before july 2001...)

Further development: DBA; Fred and Kty

Report bugs to:

Fred imfred@mailcity.com ICQ # 33467465
Kty kty@mailcity.com ICQ # 45376616

Please let us know if you find bugs. Any suggestions are also welcome.

Tleilax 

DBA