summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-03-17 22:11:35 +1100
committerkitty <nepeta@canaglie.net>2026-03-17 22:11:35 +1100
commit45a7c61e63efef5edae68012b33bccca311ed62b (patch)
tree542e0c52ed2fa6b0ba2dfceb9db8be07da127e46
parentb8696a0bcbfcf3a0fee6ffd411b9e1c2dfc75e82 (diff)
[ and ]
-rw-r--r--readme.md6
-rw-r--r--sanctuary.s8
2 files changed, 14 insertions, 0 deletions
diff --git a/readme.md b/readme.md
index b53648c..6416c28 100644
--- a/readme.md
+++ b/readme.md
@@ -21,6 +21,12 @@ the following is a list of words available in this forth.
### `#tib ( -- a )`
variable containing the amount of characters in the input buffer.
+### `[ ( -- ) IMMEDIATE`
+set the system to interpret mode.
+
+### `] ( -- ) IMMEDIATE`
+set the system to compiling mode.
+
### `>body ( xt -- a )`
yield the code field of xt.
diff --git a/sanctuary.s b/sanctuary.s
index ce407c1..eda1466 100644
--- a/sanctuary.s
+++ b/sanctuary.s
@@ -397,6 +397,14 @@ defcode "compile,", compile_comma, 0
mov qword [here], r12
ret
+defcode "[", lbrac, immediate_mask
+ mov qword [state], INTERPRET
+ ret
+
+defcode "]", rbrac, immediate_mask
+ mov qword [state], COMPILING
+ ret
+
; number {{{
defcode "number", number, 0 ; ( c-addr u -- ?n flag )
pspop r11 ; u