diff options
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -13,6 +13,7 @@ sanctuary is a 64-bit subroutine threaded forth for amd64 linux systems. - `ht`: header token - `""`: string in input buffer - `|`: 'or' +- `,`: used to separate multiple stack effects when multiple are needed ## Glossary @@ -353,6 +354,13 @@ yields the address of the first available byte in user memory. ### `hex ( -- )` set current base to hexadecimal. +### `hijacks ( xt "word" -- )` +'hijack' an existing definition to perform the action of xt. +this word *will* corrupt the dictionary if used outside +its very specific context (replacing core assembly words +with better versions in forth), so it should be avoided +in favour of `defer` and friends. + ### `if ( ? -- ) IMMEDIATE COMPILE-ONLY` if the flag is true, execute the following if statement, terminated by `else` or `then`. @@ -428,11 +436,15 @@ yield the address of the return pointer. note that the address points to the return stack *before* this word was called. -### `s" ( "string" -- ) IMMEDIATE COMPILE-ONLY` +### `s" ( "string" -- , COMPILES: -- a u ) IMMEDIATE COMPILE-ONLY` compile into the definition code to push the given string, terminated by a double quote. the string data and length are stored inline in the definition. +### `s>z ( a u -- a )` +compile into user memory a copy of the given regular string +converted to a null-terminated string. + ### `smudge ( -- )` toggles the smudge bit on the xt in latest. @@ -510,6 +522,16 @@ otherwise branch to after. ### `xor ( u1 u2 -- u )` perform bitwise XOR on u1 and u2. +### `z" ( "string" -- , COMPILES: -- a ) IMMEDIATE COMPILE-ONLY` +compile into the definition code to push the given string, +terminated by a double quote. +the string is null terminated and does not store a length; +this is meant for interfacing with the linux system. + +### `zstrlen ( a -- u )` +the length of a null terminated string in bytes. +the ending null byte is not counted. + ## dictionary format note that the string length of one byte limits a word's name to 255 characters. |
