Add hello world example
This commit is contained in:
26
bin/helloworld.wasm
Normal file
26
bin/helloworld.wasm
Normal 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;
|
||||||
Reference in New Issue
Block a user