summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-02-24 14:59:23 +1100
committerkitty <nepeta@canaglie.net>2026-02-24 14:59:23 +1100
commitcb16fdb58dbe98c49831a596d332defc2740c051 (patch)
treeab66c3e63a3baf4ba7bf8cc91708542394988dfa
parentd3306df06f02023a1fe16156cc0a7c656dcceff7 (diff)
WORDS
still not sure whats going on with s". i have discovered that using multiple s" seems to point the LFA of cell+ (the first forth-defined word) to directly after the text of the second string. now i just need to figure out Why or How that could possibly be happening.
-rw-r--r--jefs.fs13
-rw-r--r--jefs.s13
2 files changed, 16 insertions, 10 deletions
diff --git a/jefs.fs b/jefs.fs
index 02b52c9..9677229 100644
--- a/jefs.fs
+++ b/jefs.fs
@@ -45,7 +45,7 @@ hex : ret, c3 c, ; decimal
\ TODO interpret mode strings?
\ : s" [ char " ] literal 1 >in +! ( skip spc ) [compile] litstring ; immediate
-: s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup s, r> >resolve swap [compile] lit [compile] lit ; immediate
+: s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, r> >resolve swap [compile] lit [compile] lit ; immediate
: ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another "
\ https://wiki.osdev.org/X86-64_Instruction_Encoding
@@ -154,7 +154,7 @@ variable hld
: .qword (.qword) say space ;
: ? @ . ;
-: .s sp 8 + ( skip sp itself ) begin dup s0 @ >= while dup @ .qword 8 + repeat drop cr ;
+: .s sp 8 + ( skip sp itself ) begin dup s0 @ > while dup @ .qword 8 + repeat drop cr ;
: bytes-allocated hend @ h0 @ - ;
: bytes-used here @ h0 @ - ;
: bytes-free bytes-allocated bytes-used - ;
@@ -164,7 +164,12 @@ variable hld
\ it only seems to happen if the called word is a builtin or a number?????
\ : .free bytes-free u. ." of " bytes-allocated u. ." bytes free (used " bytes-used (.) say ." )" cr ; \ segfaults
+: >nfa ( lfa -- nfa ) 9 + ;
+: (words) ( lfa -- ) >nfa dup w@ swap 1+ 1+ swap say 2 spaces ; \ TODO works? maybe? idk
+: words latest @ begin ?dup 0<> while dup (words) @ ( todo ->NEXT ) repeat cr ;
+
\ .free bye
-: t s" eue eu eo o eu" drop .s say ;
+\ : t s" eue eu eo o eu" drop .s say s" eue " ;
-t bye
+words
+bye
diff --git a/jefs.s b/jefs.s
index 76d352a..3d9fa1c 100644
--- a/jefs.s
+++ b/jefs.s
@@ -91,6 +91,13 @@ defword "@", fetch, 0
pspush r12
ret
+defword "w@", wfetch, 0
+ pspop r11
+ xor r12, r12
+ mov r12w, [r11]
+ pspush r12
+ ret
+
defword "c@", cfetch, 0
pspop r11
xor r12, r12
@@ -269,12 +276,6 @@ defword "find", find, 0
mov r12, r13
.check_smudge:
- ; TODO fix whatever is going on with PNO and this
- pspush r12
- pspush r13
- pspop r13
- pspop r12
-
add r13, 8
mov r9b, byte [r13]
test r9b, smudge_mask