TRACE
Print a message in the debugging log.
| Opcode | Bytes | Cycles | Form | Example |
|---|---|---|---|---|
| $12 | 1 | 1 + 5 | trace | trace |
| $23 | 2 | 1 + 5 | trace {u_byte} | trace 123 |
| $b1 | 4 | 1 + 5 | trace {u_trio} | trace $12_3abc |
| $24 | 2 | 2 + 5 | trace i:_ | trace i:4 |
Notes
-
The
traceinstruction typically will print a message to the debugger's log output, which is useful to track the state of your program as it is running. However, its behavior is customizable. -
This instruction implements the Hybrix language's kernel::trace() and
kernel::trace_int()functions. -
This instruction invokes a CPU event handler, which adds 5 clock cycles, plus whatever time is spent handling the event.
-
The operand is a trace ID number. If the number is greater than 255, the debugger will interpret it as a memory address, and expect to find a string message there. Otherwise, the number is printed.
-
This instruction does not affect the CPU condition flags. By convention, before it returns the event handler implementation should restore the entire CPU state including flags.
| Trace ID | Meaning |
|---|---|
| 0 | Reported by trace without an operand. |
| 1 – 239 | Custom IDs available for the user's program. |
| 240 – 255 | Reserved for usage by the Hybrix framework. |
| 254 | Reported during a manual garbage collection, immediately before the "mark" operation. |
| 255 | Reported during an automatically triggered garbage collection, immediately before the "mark" operation. |
| ≥256 | Values larger than 255 will be interpreted as a memory address containing a custom text string to display. |
See also
- CPU events:
tracetriggers a CPU event