Ikarus implements its own loop constructs (repeat, while, mem_goto) by redirecting the VM's program counter at runtime. To support these in the C# wrapper, two APIs are needed.
vm.override_function("repeat", [this](zenkit::DaedalusVm& vm) {
// ...
vm.unsafe_jump(jmp - rp.size); // redirect execution to loop start or exit
});
vm.override_function("while", [this](zenkit::DaedalusVm& vm) {
const int cond = vm.pop_int();
if (cond == 0)
vm.unsafe_jump(loopBacktrack[vm.pc()] - rp.size);
});
Requested C# API:
- DaedalusVm.Pc()
- DaedalusVm.UnsafeJump()
Ikarus implements its own loop constructs (repeat, while, mem_goto) by redirecting the VM's program counter at runtime. To support these in the C# wrapper, two APIs are needed.
Reference OpenGothic (directmemory.cpp):
Requested C# API: