Skip to main content

TRACE

Print a message in the debugging log.

OpcodeBytesCyclesFormExample
$1211 + 5TRACETRACE
$2321 + 5TRACE {U_BYTE}TRACE 123
$B141 + 5TRACE {U_TRIO}TRACE $12_3ABC
$2422 + 5TRACE 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 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 IDMeaning
0Reported by TRACE without an operand.
1 – 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