From a654a2e0418b0f143cb4d6c55776c844e7254e22 Mon Sep 17 00:00:00 2001 From: kitty Date: Fri, 20 Mar 2026 01:03:51 +1100 Subject: stack and math words --- readme.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 7e93f2f..c168abe 100644 --- a/readme.md +++ b/readme.md @@ -17,6 +17,9 @@ sanctuary is a 64-bit subroutine threaded forth for amd64 linux systems. the following is a list of words available in this forth. +### `! ( u a -- )` +store the 64 bit value u into the memory address a. + ### `#tib ( -- a )` variable containing the amount of characters in the input buffer. @@ -35,9 +38,18 @@ remainder is in n3, result is in n4 ### `+ ( u1 u2 -- u )` add u2 to u1. +### `+! ( a -- )` +add one to the value at memory address a. + +### `, ( u -- )` +write a 64 bit value to user memory and increment the user memory pointer. + ### `- ( u1 u2 -- u )` subtract u2 from u1. +### `-! ( a -- )` +subtract one from the value at memory address a. + ### `-rot ( u1 u2 u3 -- u3 u1 u2 )` rotate the three topmost values on the stack so that the topmost value is moved to the third highest. @@ -57,6 +69,9 @@ start compilation of the word 'name'. ### `; ( -- ) IMMEDIATE` end compilation of the currently compiling word. +### `@ ( a -- u )` +fetch the 64 bit value at memory address a. + ### `>body ( xt -- a )` yield the code field of xt. @@ -67,6 +82,12 @@ in the input buffer. ### `>r ( u -- ) ( R: -- u )` move a value from the working stack to the return stack. +### `1+ ( u -- u')` +add one to u. + +### `1- ( u -- u')` +subtract one from u. + ### `2drop ( u1 u2 -- )` remove the two topmost values from the stack. @@ -82,6 +103,23 @@ yields current program break. ### `bye ( -- )` exits the forth system. +### `c, ( c -- )` +write an 8 bit value to user memory and increment the user memory pointer. + +### `c! ( u a -- )` +store the 8 bit value u into the memory address a. + +### `c@ ( a -- c )` +fetch the 8 bit value at memory address a. + +### `cmove ( a1 a2 u -- )` +copy u bytes of memory from a1 to a2. +bytes are copied in low memory to high memory order. + +### `cmove> ( a1 a2 u -- )` +copy u bytes of memory from a1 to a2. +bytes are copied in high memory to low memory order. + ### `dp ( -- a )` a variable that contains the lowest free byte of memory in user memory. -- cgit v1.2.3