browser

Virtual Machine

vm
calendarsave
The xyw virtual machine is a stack/register virtual machine able to operate on 8bit or 16bit integers. It uses: dot-single a user stack of 128 bytes. dot-single a system stack used for managing subroutines of 384 bytes (able to store up to 48 frames of 8 bytes each, to preserve state). dot-single 64KiB of preallocated memory, of which the last 256 bytes are reserved for devices input/output. dot-single two 8bit registers (x and y). dot-single two 16bit registers (xw and yw). dot-single a 16bit program counter (pc). Note that: dot-single registers, pc, stacks are not memory-mapped. dot-single no user access is provided to pc and the system stack. === Execution Flow When a .xim image file is executed, its contents are loaded into memory and then evaluated starting from address $0000. The evaluation happens in a loop performing the following operations sequentially: dot-single if pc >= $FF00 (start of the device page), halt the execution. dot-single check the vm state: dot-single if waiting -> poll devices and execute handlers dot-single tick devices (check error handling, execute image) dot-single execute instruction at pc dot-single increment pc Currently, the following devices support polling: dot-single terminal -> argument processing and key presses dot-single clock -> timer Only the system device implements the tick device api to: dot-single execute on error handlers dot-single execute a xim image