Implement nova64 API with native yield function and registration

This commit is contained in:
Lukas Höppner
2026-08-10 12:43:13 +02:00
parent 1cfcd5a169
commit 27c3aaf88f
7 changed files with 79 additions and 4 deletions
+4 -1
View File
@@ -1 +1,4 @@
tinygo build -o ../simulator/sd/slot0/init.wasm -target wasm-unknown init.go
@REM tinygo build -o ../simulator/sd/slot0/init.wasm -target wasm-unknown init.go
@REM zig build-exe init.zig -target wasm32-freestanding -fno-entry -O ReleaseSmall -femit-bin=../simulator/sd/slot0/init.wasm
zig build-exe init.zig -target wasm32-freestanding -O ReleaseSmall -femit-bin=../simulator/sd/slot0/init.wasm
+3 -1
View File
@@ -2,7 +2,9 @@ package main
// Declare a main function, this is the entrypoint into our go module
// That will be run. In our example, we won't need this
func main() {}
func main() {
_ = add(1, 2)
}
// This exports an add function.
// It takes in two 32-bit integer values
+12
View File
@@ -0,0 +1,12 @@
extern "nova64" fn yield(timeout_ms: u32) void;
pub fn main() void {
_ = add(1, 2);
while (true) {
yield(16); // Yield for 1 second
}
}
export fn add(a: i32, b: i32) i32 {
return a + b;
}