diff options
| author | kitty <nepeta@canaglie.net> | 2026-03-23 00:42:21 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-03-23 00:42:21 +1100 |
| commit | ccc5e9514111ecec8c045a9b78cb2052da090c95 (patch) | |
| tree | 6769e4902049b6e978703994a5ce277ed3be3721 /readme.md | |
| parent | 8f76c163e577393bda45d9c98745bb4670f27f10 (diff) | |
boilerplate for create does>
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 48 |
1 files changed, 47 insertions, 1 deletions
@@ -24,6 +24,14 @@ store the 64 bit value u into the memory address a. ### `#tib ( -- a )` variable containing the amount of characters in the input buffer. +### `' ( "word" -- xt )` +read a word from the input buffer, +push to the stack its execution token. + +### `'h ( "word" -- ht )` +read a word from the input buffer, +push to the stack its header token. + ### `( ( -- ) IMMEDIATE` start a comment which lasts until the next closed bracket. if the unclosed bracket in the description above bothers you, @@ -32,6 +40,19 @@ have a closing bracket: ). ### `(0handler) ( -- )` the very early error handler, which simply quits the program. +### `(create) ( -- )` +the default behaviour of a word made by `create`, +which simply pushes the address following the definition to the stack. +this messes with the return stack and is not meant to be called +outside of its specific context. + +### `(does>) ( -- )` +run non-default behaviour of a `create`d word. +pushes the data location onto the stack and calls the word +immediately following the `(does>)` call. +this messes with the return stack and is not meant to be called +outside of its specific context. + ### `(header) ( a u -- ht )` create a dictionary header for a word named the provided string. this word does not set the code field. @@ -42,7 +63,7 @@ multiply u1 and u2. ### `*/mod ( n1 n2 n3 -- n4 n5 )` multiply n1 and n2, divide the result by n3. -remainder is in n3, result is in n4 +remainder is in n4, result is in n5. ### `+ ( u1 u2 -- u )` add u2 to u1. @@ -69,6 +90,13 @@ divide u1 by u2. result is in u4, remainder is in u3. ### `[ ( -- ) IMMEDIATE` set the system to interpret mode. +### `['] ( "word" -- ) IMMEDIATE COMPILE-ONLY` +read a word from the input buffer, +compile into the current definition a stack push of the xt of the word. + +### `[compile] ( "word" -- ) IMMEDIATE COMPILE-ONLY` +compile into the current definition a call to a normally immediate word. + ### `] ( -- ) IMMEDIATE` set the system to compiling mode. @@ -129,6 +157,15 @@ compile into user memory an incomplete conditional branch. if the value on the stack is zero the branch is taken. a 32 bit branch offset must be written immediately after. +### `?dup ( n -- 0 | n n )` +if n is not zero, perform `dup`. + +### `?find ( a u -- ht )` +look in the dictionary for the word a (of u characters). +if a word was found, +its link field address is returned along with the true flag. +if no word was found or the string is of length zero, abort. + ### `0= ( n -- ? )` return true if n is equal to zero. @@ -213,6 +250,9 @@ bytes are copied in low memory to high memory order. copy u bytes of memory from a1 to a2. bytes are copied in high memory to low memory order. +### `compile, ( xt -- )` +compile a call to xt into user memory. + ### `d, ( n -- )` write a 32 bit value to user memory and increment the user memory pointer. @@ -317,6 +357,12 @@ and return as a string. tabs (ascii 0x09), newlines (ascii 0x10), and spaces (ascii 0x20) are considered whitespace. +### `postpone ( "name" -- ) IMMEDIATE COMPILE-ONLY` +compile the execution behaviour of a word into the current definition. +if the word is immediate, that will execute the word at runtime +(like `[compile]`). +if the word is not immediate, this will compile code that compiles that word. + ### `r> ( -- u ) ( R: u -- )` move a value from the return stack to the working stack. |
