summary refs log tree commit diff
path: root/quine.asm
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-08-28 22:21:52 -0700
committerIrene Knapp <ireneista@irenes.space>2026-08-28 22:21:52 -0700
commita41c6444d30f9ad561d95a1776f796581338df16 (patch)
treeec8b878efec4f37d330aff1098d46e20960b7f01 /quine.asm
parent6e0227328154e18810d8dfa4489bf84c9c15cbf7 (diff)
make read-to-buffer take its delimiter as a parameter
since the recommended invocation to build Evocation (hehe) does the heavy lifting in interpreted mode, this required a new helper, allocate-string, which takes a string in the scratch space and properly allocates it so it won't be overwritten by future allocations

Force-Push: yes
Change-Id: Ia73612a65fd7c11af5fe110c573c23c16b777112
Diffstat (limited to 'quine.asm')
-rw-r--r--quine.asm25
1 files changed, 25 insertions, 0 deletions
diff --git a/quine.asm b/quine.asm
index f11b435..28f97d1 100644
--- a/quine.asm
+++ b/quine.asm
@@ -6255,6 +6255,31 @@ cold_start:
   dq litstring, "exit", early_find, entry_to_execution_token, early_comma
   dq early_here, fetch, lit, 8, packalign, early_here_store
 
+  ;   Takes a string pointer which must be equal to the current value of
+  ; "here", ; indicating it is in the temporary allocation space, and
+  ; allocates it permanently by advancing "here" to the next aligned address
+  ; after it.
+  ;
+  ; In:
+  ;   string pointer
+  ; Out:
+  ;   string pointer
+  dq litstring, "allocate-string", early_create, early_docol_codeword
+  dq litstring, "dup", early_find, entry_to_execution_token, early_comma
+  dq litstring, "dup", early_find, entry_to_execution_token, early_comma
+  dq litstring, "stringlen", early_find, entry_to_execution_token, early_comma
+  dq litstring, "lit", early_find, entry_to_execution_token, early_comma
+  dq lit, 1, early_comma
+  dq litstring, "+", early_find, entry_to_execution_token, early_comma
+  dq litstring, "+", early_find, entry_to_execution_token, early_comma
+  dq litstring, "lit", early_find, entry_to_execution_token, early_comma
+  dq lit, 8, early_comma
+  dq litstring, "packalign", early_find, entry_to_execution_token, early_comma
+  dq litstring, "here", early_find, entry_to_execution_token, early_comma
+  dq litstring, "!", early_find, entry_to_execution_token, early_comma
+  dq litstring, "exit", early_find, entry_to_execution_token, early_comma
+  dq early_here, fetch, lit, 8, packalign, early_here_store
+
   ; In:
   ;   pointer to buffer metadata
   ; Out: