Add hello world example

This commit is contained in:
2020-05-16 11:54:55 +02:00
parent 30252e5863
commit 5d71a1316c

26
bin/helloworld.wasm Normal file
View File

@@ -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;