Documentation updates

This commit is contained in:
Remko Tronçon 2022-05-26 21:23:09 +02:00
parent 02dabe38df
commit 067a12301d
2 changed files with 8 additions and 9 deletions

View file

@ -49,11 +49,11 @@ Although WebAssembly (and therefore WAForth) is typically used in a web environm
You can download a pre-built binary of the standalone shell from
[the Releases page](https://github.com/remko/waforth/releases).
The standalone shell is built using [wasmtime](https://wasmtime.dev),
but the build configuration can easily be adapted to build using any
The standalone shell uses the [Wasmtime](https://wasmtime.dev) engine,
but its build configuration can easily be adapted to build using any
WebAssembly engine that supports the
[WebAssembly C API](https://github.com/WebAssembly/wasm-c-api) (although some
have [known issues](https://github.com/remko/waforth/issues/6#issue-326830993)).
engines have [known issues](https://github.com/remko/waforth/issues/6#issue-326830993)).
## Using WAForth in a JavaScript application

View file

@ -19,7 +19,7 @@
;; Returns: number of bytes read
(import "shell" "read" (func $shell_read (param i32 i32) (result i32)))
;; Read a single key from the input device
;; Read a single key from the input device (without echoing)
(import "shell" "key" (func $shell_key (result i32)))
;; Load a webassembly module.
@ -35,7 +35,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; A regular compiled word is a function with only the
;; top-of-stack pointer as parameter (and return the new top-of-stack pointer)
;; top-of-stack pointer as parameter (and returns the new top-of-stack pointer)
;; Arguments are passed via the stack.
(type $word (func (param i32) (result i32)))
@ -68,7 +68,6 @@
;; ABORT_INDEX := 0x39
;; CONSTANT_INDEX := 0x4c
;; NEXT_TABLE_INDEX := 0xab (; Next available table index for a compiled word ;)
(table (export "table") 0xab (; = NEXT_TABLE_INDEX ;) funcref)
@ -186,9 +185,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; These follow the following pattern:
;; - WebAssembly function definition (func ...)
;; - Dictionary entry in memory (data ...)
;; - Function table entry (elem ...)
;; - WebAssembly function definition: `(func ...)`
;; - Dictionary entry in memory: `(data ...)`
;; - Function table entry: `(elem ...)`
;;
;; The dictionary entry has the following form:
;; - prev (4 bytes): Pointer to start of previous entry