v0.14.0 - Forth-style SYS instruction
🚨 Breaking Changes
SYS instruction changed from IMM16 to NoImm opcode:
- Old format:
SYSopcode (0x60) + 2-byte immediate operand = 3 bytes total - New format:
SYSopcode (0x60) only = 1 byte total - SYS ID is now popped from the data stack instead of being encoded as an immediate
This enables dynamic SYS calls where the SYS ID can be computed at runtime.
Bytecode Example
Old bytecode: 60 01 00 (SYS with IMM16 = 0x0001)
New bytecode: 00 01 00 00 00 60 (LIT 1, SYS)
✨ Features
- Stack-based SYS: SYS ID is popped from the data stack
- Dynamic syscalls: Enable computed SYS IDs at runtime
- Smaller opcode: SYS opcode reduced from 3 bytes to 1 byte (immediates handled separately)
🔧 Changes
Core Changes
opcodes.def: Changed SYS fromIMM16toNO_IMMopcodes.hpp: Updated comment to reflect SYS as NoImmcore.cpp: Modified SYS handler to pop 16-bit ID from stack with validation (0-65535)
Test Updates
- Updated all 19 SYS test cases in
test_sys.cpp - Added
emit16()helper function for test bytecode generation - Changed test bytecode from IMM16 pattern to LIT+SYS pattern
✅ Testing
- All 11 V4-engine tests passing
- Tested with address sanitizer
- Tested with undefined behavior sanitizer
- GPIO, UART, Timer, System SYS calls verified
📦 Compatibility
- Requires V4-front v0.7.0 or later for correct Forth-style syntax
- Breaking change: Old bytecode with IMM16 SYS will not work
- Applications must be recompiled with new V4-front
Full Changelog: v0.13.0...v0.14.0