SX-KEY WATCH

The SX-Key allows File Register Variables to be "WATCH"ed when debugging.

WATCH Variable{.Bit}, Count, Format

The WATCH directive allows the definition of format for viewing and modifying variables at runtime during debug mode. The variable's name, number of bits or bytes to view, and display format may be specified.

WATCH timer, 1, UDEC
WATCH flags.0, 1, UBIN

The table below lists the available format settings for the WATCH directive.

Format Operation
UDEC Displays value in unsigned decimal format
SDEC Displays value in signed decimal format
UHEX Displays value in unsigned hexadecimal format
SHEX Displays value in signed hexadecimal format
UBIN Displays value in unsigned binary format
SBIN Displays value in signed binary format
FSTR Displays value in fixed-length string format
ZSTR Displays value in zero-terminated string format

Consult the SX-Key Development System Manual for additional information about the WATCH directive.

Error when watching one register in more than one format

The WATCH directive allows you to view variable in different bases and lengths, but each WATCH becomes a new symbol and the way SASM builds its symbol table doesn't lend itself to allowing multiple definitions of the same symbol. The problem is that SASM use a binary tree for storing the symbol table. While you can store more than one item with the same name, the problem is when you go looking for it. In order to find an item, you have to start at the root node and then search node to node (using the next node pointers) until you find the item. If you find it, you terminate the search. The result is that you get an error if WATCH is used more than once to view the same variable.

If you have more than one item with the same name, it means you always have to search throught the entire tree in case you have more than one item with the same name but a different type. While it would be possible (anything is possible in software) to modify SASM to allow multiple symbol definitions for WATCH directives, itt's not an easy task due to the way SASM was originally architected.

An easy workaround is to define a new symbole for each way that you want to view a variable.

flagbyte DS 1
flagbytehex = flagbyte
flagbytedec = flagbyte

watch flagbyte,8,ubin
watch flagbytehex,8,uhex
watch flagbytedec,8,udec

Comments: