From 5d71a1316c7850132affebce6f1bbdc491e98d51 Mon Sep 17 00:00:00 2001 From: Tijmen van Nesselrooij Date: Sat, 16 May 2020 11:54:55 +0200 Subject: [PATCH] Add hello world example --- bin/helloworld.wasm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 bin/helloworld.wasm diff --git a/bin/helloworld.wasm b/bin/helloworld.wasm new file mode 100644 index 0000000..b60eb2b --- /dev/null +++ b/bin/helloworld.wasm @@ -0,0 +1,26 @@ +# Push "Hello WORLD" onto the stack +pushi $68; # D +pushi $76; # L +pushi $82; # R +pushi $79; # O +pushi $87; # W +pushi $32; # space +pushi $111; # o +pushi $108; # l +pushi $108; # l +pushi $101; # e +pushi $72; # H + +seti %B $11; # Length of string on stack + +print_loop: +popi %A; +int $0; + +subi %B $1 %B; +gti %B $0; +jmp print_loop; + +# Print a newline +seti %A $10; +int $0; \ No newline at end of file