From 067a12301d20fc7dcc6db75b919b2bdbfcdce7fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Thu, 26 May 2022 21:23:09 +0200 Subject: [PATCH] Documentation updates --- README.md | 6 +++--- src/waforth.wat | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b9970ce..ce25e88 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/waforth.wat b/src/waforth.wat index d3bf6b1..a73a896 100644 --- a/src/waforth.wat +++ b/src/waforth.wat @@ -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