How alve-dev/zonetic-vm works
ZonVM is a bytecode virtual machine for Zonetic programs. The principal workflow is a user-supplied .zbc file being validated and section-loaded by the executable, then executed by the VM; execution updates registers and RAM, performs arithmetic, memory and control-flow instructions, and handles ECALL services such as printing and exit. The runtime also provides guarded stack allocation and heap/stack services. The excerpts show the loader-to-VM handoff and representative instruction and syscall handling; detailed handler coverage is partial.
Main entry points: zon_vm.cpp Instruction dispatch · zon_vm.hpp VM RAM · main.cpp File validation and loading · common.hpp ISA definitions
Components 17
Bytecode loading
- File validation and loading
src/main.cpp
VM execution
- ISA definitions
include/common.hpp - VM state and interface
include/zon_vm.hpp - Instruction dispatch
src/zon_vm.cpp - Integer and FP operations
src/zon_vm.cpp - Branches and calls
src/zon_vm.cpp - String operations
src/zon_vm.cpp
Memory management
- VM RAM
include/zon_vm.hpp - RAM allocator
include/zon_vm.hpp - Guarded stack
include/zon_vm.hpp - Load and store
src/zon_vm.cpp - Heap services
src/zon_vm.cpp
Runtime services
- ECALL services
src/zon_vm.cpp - Print and exit
src/zon_vm.cpp
Other components
- Program user
- Zonetic bytecode
- Host operating system
Connections 20
- Program user → Zonetic bytecode: provides
README.md - Program user → File validation and loading: runs with
src/main.cpp - File validation and loading → Zonetic bytecode: reads
src/main.cpp - File validation and loading → VM state and interface: loads and runs
src/main.cpp - VM state and interface → VM RAM: stores state
include/zon_vm.hpp - VM state and interface → RAM allocator: allocates through
include/zon_vm.hpp - RAM allocator → Host operating system: requests memory
include/zon_vm.hpp - Instruction dispatch → Integer and FP operations: dispatches
src/zon_vm.cpp - Instruction dispatch → Branches and calls: dispatches
src/zon_vm.cpp - Instruction dispatch → Load and store: dispatches
src/zon_vm.cpp - Instruction dispatch → String operations: dispatches
src/zon_vm.cpp - Instruction dispatch → ECALL services: dispatches
src/zon_vm.cpp - Integer and FP operations → ISA definitions: uses encodings
include/common.hpp - Load and store → VM RAM: reads and writes
src/zon_vm.cpp - String operations → VM RAM: reads and writes
src/zon_vm.cpp - ECALL services → Print and exit: handles print and exit
src/zon_vm.cpp - ECALL services → Heap services: handles heap calls
src/zon_vm.cpp - Heap services → VM RAM: reads and writes
src/zon_vm.cpp - RAM allocator → Guarded stack: protects stack region
include/zon_vm.hpp - Guarded stack → Host operating system: sets guard protection
include/zon_vm.hpp