summary refs log tree commit diff
path: root/quine.asm
diff options
context:
space:
mode:
Diffstat (limited to 'quine.asm')
-rw-r--r--quine.asm28
1 files changed, 28 insertions, 0 deletions
diff --git a/quine.asm b/quine.asm
index c13744f..990f0ae 100644
--- a/quine.asm
+++ b/quine.asm
@@ -4878,6 +4878,34 @@ defword find_in, 0
   ; If we're here, it's a match. Clean up our working state and exit.
   dq swap, drop, exit
 
+; Stack in:
+;   heap address
+;   entry address
+; Stack out:
+;   entry address or 0
+defword early_next_newer_entry, 0
+  dq docol
+  dq swap, early_latest, fetch, swap, unroll3, swap, next_newer_entry_in
+  dq exit
+
+; Stack in:
+;   dictionary to search within
+;   entry address
+; Stack out:
+;   entry address or 0
+defword next_newer_entry_in, 0
+  dq docol
+  ; Dictionary pointer on top
+  dq swap
+  ; Exit if null
+  dq dup, lit, 0, eq, zbranch, 4*8, swap, drop, exit
+  ; Test if it's a match
+  dq dup2, fetch, ne, zbranch, 4*8
+  ; Non-match case; loop
+  dq fetch, branch, -16*8
+  ; Match case; return
+  dq swap, drop, exit
+
 ;   Jonesforth calls this "TFCA" and ">CFA"; its author speculates that the
 ; original meaning is "code field address".
 defword entry_to_execution_token, 0