Skip to content

Instantly share code, notes, and snippets.

@WA9ACE
Created April 22, 2017 01:13
Show Gist options
  • Save WA9ACE/4bb1ff26beea4c790dc0c3f095d19cde to your computer and use it in GitHub Desktop.
Save WA9ACE/4bb1ff26beea4c790dc0c3f095d19cde to your computer and use it in GitHub Desktop.
Imports memory and print functions and calls print passing memory offset and length
module
(import "stdlib" "print" (func $print (param i32 i32)))
(import "js" "mem" (memory 20))
(data (i32.const 0) "Hello World")
(func (export "main")
i32.const 0 ;; pass offset 0 to log
i32.const 20 ;; pass length 20 to log
call $print))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment