From fe76d91f33b2441de87597ae5885ea9005f35b1c Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Tue, 28 Nov 2023 20:06:41 +0100 Subject: refactor: seperate cli crate Signed-off-by: Henry Gressmann --- examples/wasm/helloworld.wasm | Bin 0 -> 115 bytes examples/wasm/helloworld.wat | 15 +++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 examples/wasm/helloworld.wasm create mode 100644 examples/wasm/helloworld.wat (limited to 'examples') diff --git a/examples/wasm/helloworld.wasm b/examples/wasm/helloworld.wasm new file mode 100644 index 0000000..a5c95d0 Binary files /dev/null and b/examples/wasm/helloworld.wasm differ diff --git a/examples/wasm/helloworld.wat b/examples/wasm/helloworld.wat new file mode 100644 index 0000000..b74c98f --- /dev/null +++ b/examples/wasm/helloworld.wat @@ -0,0 +1,15 @@ +(module + ;; Imports from JavaScript namespace + (import "console" "log" (func $log (param i32 i32))) ;; Import log function + (import "js" "mem" (memory 1)) ;; Import 1 page of memory (54kb) + + ;; Data section of our module + (data (i32.const 0) "Hello World from WebAssembly!") + + ;; Function declaration: Exported as helloWorld(), no arguments + (func (export "helloWorld") + i32.const 0 ;; pass offset 0 to log + i32.const 29 ;; pass length 29 to log (strlen of sample text) + call $log + ) +) \ No newline at end of file -- cgit v1.3.1