Implement nova64 API with native yield function and registration
This commit is contained in:
+4
-1
@@ -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
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user