Refactor WASM runner and logging functionality; add heartbeat task and improve initialization process

This commit is contained in:
Lukas Höppner
2026-08-12 01:22:09 +02:00
parent 27c3aaf88f
commit b623e5cf0a
13 changed files with 261 additions and 95 deletions
-17
View File
@@ -1,17 +0,0 @@
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() {
_ = add(1, 2)
}
// This exports an add function.
// It takes in two 32-bit integer values
// And returns a 32-bit integer value.
// To make this function callable from JavaScript,
// we need to add the: "export add" comment above the function
//export add
func add(x int, y int) int {
return x + y
}
+3 -2
View File
@@ -1,9 +1,10 @@
extern "nova64" fn yield(timeout_ms: u32) void;
const nova64 = @import("nova64.zig");
pub fn main() void {
_ = add(1, 2);
while (true) {
yield(16); // Yield for 1 second
nova64.log("Hello from Zig!");
// nova64.yield(1000);
}
}
+10
View File
@@ -0,0 +1,10 @@
pub extern "nova64" fn nova64_yield(timeout_ms: u32) void;
pub extern "nova64" fn nova64_log(message: [*]const u8) void;
pub fn log(message: []const u8) void {
nova64_log(message.ptr);
}
pub fn yield(timeout_ms: u32) void {
nova64_yield(timeout_ms);
}
+5
View File
@@ -0,0 +1,5 @@
extern "nova64" fn log(message: [*]const u8) void;
pub fn main() void {
log(&"Hello from Zig!"[0]);
}