Skip to main content

REQUEST

Request an action from the system environment.

OpcodeBytesCyclesFormExample
$2521 + 5REQUEST {U_BYTE}REQUEST 123

Notes

This instruction is used to request special actions from the system environment, for example from the Hybrix debugger when it is attached. The REQUEST instruction could also be used like a software interrupt for an advanced application such as an operating system, which needs to load different programs and enable them to invoke system functions in a standardized way.

This instruction invokes a CPU event handler, which adds 5 clock cycles, plus whatever time is spent handling the event.

The table below shows the standard functions for each request number. If the Hybrix debugger or virtual machine does not process the request, then control passes to the IO::CPU_REQUEST_HANDLER code. The Hybrix framework's default implementation ignores request number 0 (BREAK); beyond that, it does not contribute any additional request functions. Instead, it simply reports a failure.

Request numberFunction
0 – 15Reserved for usage by the Hybrix virtual machine and development environment.
0BREAK Pause your program in the debugger. This implements the Hybrix language's BREAK statement.
1GC SWEEP Invokes the debugger's garbage collector to perform a "sweep" operation.
2GC MARK Invokes the debugger's garbage collector to perform a "mark" operation.
16 – 255Available for usage by a custom kernel.
Useful for advanced programs such as an operating system or software debugger.

Details:

  • When the Hybrix debugger is not attached (for example in the ROM Player), the virtual machine ignores the BREAK request number; all other requests are passed through to IO::CPU_REQUEST_HANDLER and by default will fail.

  • The GC SWEEP and GC MARK request codes are rarely needed. They would be used to debug memory corruption problems in an advanced program. These request functions can replace the kernel's "sweep" and "mark" operations, providing an equivalent algorithm that performs extensive safety checks.

See also