From 45a7c61e63efef5edae68012b33bccca311ed62b Mon Sep 17 00:00:00 2001 From: kitty Date: Tue, 17 Mar 2026 22:11:35 +1100 Subject: [ and ] --- readme.md | 6 ++++++ sanctuary.s | 8 ++++++++ 2 files changed, 14 insertions(+) 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 -- cgit v1.2.3