summary refs log tree commit diff
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-04-13 12:37:00 -0700
committerIrene Knapp <ireneista@irenes.space>2026-04-13 12:37:00 -0700
commit137c62aa2e11e98c642a89ac788ed60b71fc9613 (patch)
treeb80b4a3c25435431d66b07040d8b9383b27fa8df
parent67af5f27f4a63a1539a6835924d9101bca396c70 (diff)
fix "describe" to work on both data segment and heap
the hard part was figuring out the generic test for docol. it doesn't really test for docol, it tests for self-codewords and treats everything else as if it uses docol... not ideal, but good enough for now

this also involved hardcoding the name "0branch" as an alternative to "zbranch". again, not a long-term strategy, but the long-term strategy is to remove flatassembler entirely, at which point the old names will go away because we'll be using our own lexer.

there were also a couple small code-validity things that either broke the "describe" output, or became evident because of it, which are now fixed as well.

Force-Push: yes
Change-Id: If6641bb27f4fb0308f6fd4a2f4885215187ec8d9
-rw-r--r--quine.asm28
1 files changed, 15 insertions, 13 deletions
diff --git a/quine.asm b/quine.asm
index e2703a4..ceb2c9e 100644
--- a/quine.asm
+++ b/quine.asm
@@ -3913,6 +3913,7 @@ cold_start:
   dq lit, "bp.", early_comma
   dq litstring, "emitstring", early_find, entry_to_execution_token
   dq early_comma
+  dq litstring, "lit", early_find, entry_to_execution_token, early_comma
   dq lit, 1, early_comma
   dq litstring, "sys-exit", 0, early_find, entry_to_execution_token, early_comma
   dq early_here, fetch, lit, 8, packalign, early_here_store
@@ -7107,7 +7108,7 @@ defword reg8, 0
   dq dup, ch, eq, zbranch, 5*8, drop, lit, 5, exit
   dq dup, dh, eq, zbranch, 5*8, drop, lit, 6, exit
   dq dup, bh, eq, zbranch, 5*8, drop, lit, 7, exit
-  dq litstring, "Parameter to reg8 is not a reg8.", emitstring
+  dq litstring, "Parameter to reg8 is not a reg8.", 0, emitstring
   dq lit, 1, sys_exit
 
 ; Stack in:
@@ -8297,22 +8298,23 @@ defword show_source_between, 0
   dq dup, emitstring, litstring, " ", emitstring
   dq swap, lit, 8, add, swap
 
-  dq dup, litstring, "lit", stringcmp, zbranch, 51*8          ; 6 words
-  dq dup, litstring, "litpack8", 0, stringcmp, zbranch, 44*8  ; 7 words
-  dq dup, litstring, "litpack16", stringcmp, zbranch, 37*8    ; 7 words
-  dq dup, litstring, "litpack32", stringcmp, zbranch, 30*8    ; 7 words
-  dq dup, litstring, "litpack64", stringcmp, zbranch, 23*8    ; 7 words
-  dq dup, litstring, "branch", stringcmp, zbranch, 17*8       ; 6 words
-  dq dup, litstring, "zbranch", stringcmp, zbranch, 11*8      ; 6 words
+  dq dup, litstring, "lit", stringcmp, zbranch, 57*8          ; 6 words
+  dq dup, litstring, "litpack8", 0, stringcmp, zbranch, 50*8  ; 7 words
+  dq dup, litstring, "litpack16", stringcmp, zbranch, 43*8    ; 7 words
+  dq dup, litstring, "litpack32", stringcmp, zbranch, 36*8    ; 7 words
+  dq dup, litstring, "litpack64", stringcmp, zbranch, 29*8    ; 7 words
+  dq dup, litstring, "branch", stringcmp, zbranch, 23*8       ; 6 words
+  dq dup, litstring, "zbranch", stringcmp, zbranch, 17*8      ; 6 words
+  dq dup, litstring, "0branch", stringcmp, zbranch, 11*8      ; 6 words
   dq dup, litstring, "litstring", stringcmp, zbranch, 16*8    ; 7 words
 
   ; This is the plain, non-lit branch.
-  dq drop, branch, -76*8
+  dq drop, branch, -82*8
 
   ; This is the lit branch that expects to be followed by a single word.
   dq drop, dup, fetch, dot, litstring, " ", emitstring
   dq lit, 8, add
-  dq branch, -88*8
+  dq branch, -94*8
 
   ; This is the lit branch that expects to be followed by a string. First, we
   ; print the string...
@@ -8331,7 +8333,7 @@ defword show_source_between, 0
   ; (end address, current address, n words including padding)
   dq lit, 8, mul, add
 
-  dq branch, -120*8
+  dq branch, -126*8
 
 ;   This is the backend for early_show_source_or_hex; it will eventually also
 ; be the backend for a non-early version.
@@ -8347,9 +8349,9 @@ defword show_source_or_hex_between, 0
 
   dq swap, dup, unroll3, swap, roll3
   ; (entry address, end address, entry address)
-  dq entry_to_execution_token, fetch, lit, docol, eq, zbranch, 3*8
-  dq show_source_between, exit
+  dq entry_to_execution_token, dup, fetch, lit, 8, sub, eq, zbranch, 3*8
   dq show_hex_between, exit
+  dq show_source_between, exit
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;