Skip to main content

TRACE

Print a message in the debugging log.

OpcodeBytesCyclesFormExample
$2321 + 3trace {u_byte}trace 123
$b141 + 3trace {u_trio}trace $12_3abc
$2422 + 3trace i:_trace i:4

Notes

  • The trace instruction 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 3 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 IDMeaning
0 – 239Custom IDs available for the user's program.
240 – 255Reserved for usage by the Hybrix framework.
254Reported during a manual garbage collection, immediately before the "mark" operation.
255Reported during an automatically triggered garbage collection, immediately before the "mark" operation.
≥256Values larger than 255 will be interpreted as a memory address containing a custom text string to display.

See also