summary refs log tree commit diff
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-04-21 02:33:13 -0700
committerIrene Knapp <ireneista@irenes.space>2026-04-21 02:33:13 -0700
commit1a766dde1518cd9c208544ce0f4afd2f9ab61f0a (patch)
tree1ce2e208bc798032b98fdb00ef66f5cc2864e3e8
parent5d8c9d601d93b7c8dc740921c39b3ca410702b81 (diff)
re-verify that nothing on the heap depends on the text segment
this was done with early_describe_all, as before. both word addresses and string addresses were checked.

there were a couple fixes needed to make that run properly; they have been applied

Force-Push: yes
Change-Id: Idb89d04ab0deb42ef14220b2ef0e958657d75c63
-rw-r--r--quine.asm24
1 files changed, 20 insertions, 4 deletions
diff --git a/quine.asm b/quine.asm
index 70ae3fb..70f5e8a 100644
--- a/quine.asm
+++ b/quine.asm
@@ -5627,6 +5627,7 @@ cold_start:
   dq lit, 0xFFFFFFFFFFFFFF00, early_comma
   dq litstring, "and", early_find, entry_to_execution_token, early_comma
   dq litstring, "or", early_find, entry_to_execution_token, early_comma
+  dq litstring, "swap", 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
@@ -6267,9 +6268,23 @@ cold_start:
 
   ;;; Here we have some imperative code that runs immediately, to initialize
   ;;; some runtime data structures.
+
+  ; First, we insert a metadata word header to delimit the space. Otherwise
+  ; "describe" would crash when attempting to describe
+  ; "attach-string-to-input-buffer".
+  ; (heap pointer)
+  dq litstring, "main-input-buffer-metadata", early_create
+  dq litstring, "main-input-buffer-metadata", early_find
+  dq lit, 1, store_entry_flags
+
+  ; Having done that, now we do the runtime allocation.
   ; (heap pointer)
   dq litstring, "allocate-input-buffer-metadata", early_find
   dq entry_to_execution_token, execute
+
+  ; We also initialize the metadata here, pointing it to the boot source as
+  ; its backing store. We could do that later, but it's convenient to do it
+  ; here.
   ; (heap pointer, metadata pointer)
   dq swap, litstring, "attach-string-to-input-buffer", early_find
   ; (metadata pointer, heap pointer, entry pointer)
@@ -6281,6 +6296,9 @@ cold_start:
   ; (heap pointer, metadata pointer, metadata pointer, string pointer,
   ;  execution token)
   dq execute
+
+  ; Finally, we define the named variable "main-input-buffer" so we can find
+  ; it again.
   ; (heap pointer, metadata pointer)
   dq swap, litstring, "variable", 0, early_find, entry_to_execution_token
   ; (metadata pointer, heap pointer, execution token)
@@ -9763,7 +9781,7 @@ defword store_entry_flags, 0
   ; (new flags byte, address of flags byte, old flags byte + context)
   dq roll3, lit, 0xFF, and
   dq swap, lit, 0xFFFFFFFFFFFFFF00, and, or
-  dq store
+  dq swap, store
   dq exit
 
 defword entry_to_name, 0
@@ -10517,9 +10535,7 @@ defword self_raw, 0
   dq exit
 
 
-defword foo, 0
-  dq docol, litstring, "ia ia ftaghn", emitstring, exit
-defword boot_source, 0
+defword boot_source, 1
   dq "6 7 * ."
   dq 0