browser

System Device

device-system
calendarsave
The System device provides mapping for system-defined registry like stack pointers, program counter, and also user-defined registers. It also provides ways to check the status of the system, debugging, and managing errors.
;system
.macro system.state           $00
.macro system.error           $01
.macro system.page            $03
.macro system.random          $04
.macro system.on_error        $06
=== [1][RW] state A byte identifying the state of the virtual machine using the following values: dot-single 00000000 - system off dot-single 00000001 - system running dot-single 00000002 - system waiting for event Plus, as needed, the following bit asks: dot-single 01000000 - debug mode enabled dot-single 10000000 - error If an error occurs, the error bit will be set as long as an error is set in the appropriate byte (see below). === [1][RO] error A byte indicating the last error. The following values are supported: dot-single 00 - no error dot-single 0x - system error dot-single 1x - terminal error dot-single 2x - clock error dot-single 3x - file error dot-single 4x - beeper error Note: the error handler must clear this error after handling it, or the error handler will keep getting executed. === [1][RW] page Specifies the memory page to use as direct page for fast access to variables using LDD an STD instructions. Note: The direct page is set to the devices page ($FF) by default, to enable single-bit addressing for devices. === [1][RO] random When read, returns a random value between 0 and 255. === [2][RW] on_error Address of the subroutine that will be executed in case of an error.