summary refs log tree commit diff
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-04-13 15:14:27 -0700
committerIrene Knapp <ireneista@irenes.space>2026-04-13 15:14:27 -0700
commita6e2609e4e587e2846523acbcce99ccd232eeca6 (patch)
treef03f2e329667b8581485faaa90e29d68abd17595
parent408727db4ab128e37120d562f4406f8050fc4cc8 (diff)
add some sed scripts to make the output easier to examine
these separate out the data and heap segments; the one for the data
segment also replaces all the flatassembler names with Forth names.

the output of these scripts looks very clean when passed through diff,
showing only important differences

Force-Push: yes
Change-Id: I868ca9817fa41d2c503a8480ae6ceb44c9e10df7
-rw-r--r--describe-data.sed45
-rw-r--r--describe-heap.sed11
2 files changed, 56 insertions, 0 deletions
diff --git a/describe-data.sed b/describe-data.sed
new file mode 100644
index 0000000..4f13e88
--- /dev/null
+++ b/describe-data.sed
@@ -0,0 +1,45 @@
+# ./quine | sed -f describe-data.sed > data.txt
+
+:start
+/0000000008/!d
+/^0000000008/bmain
+bstart
+
+:main
+n
+
+s/_/-/g
+s/\<roll3\>/3roll/g
+s/\<unroll3\>/3unroll/g
+s/\<dup2\>/2dup/g
+s/\<zbranch\>/0branch/g
+s/\<eq\>/=/g
+s/\<ne\>/!=/g
+s/\<gt\>/>/g
+s/\<lt\>/</g
+s/\<ge\>/>=/g
+s/\<le\>/<=/g
+s/\([^a-z]\)-unsigned\>/\1unsigned/g
+s/\<divmod\>\([^-]\)/\/%\1/g
+s/\<mul\>\([^-]\)/*\1/g
+s/\<sub\>\([^-]\)/-\1/g
+s/\<add\>\([^-]\)/+\1/g
+s/\<\([er][acdb]x\)\>/:\1/g
+s/\<\([er]\?\([sb]p\|[sd]i\)\)\>/:\1/g
+s/\<\([acdb][lhx]\)\>/:\1/g
+s/\<\(r[89]\|r1[0-5]\)\>/:\1/g
+s/\([^-]\)\<cc-/\1:cc-/g
+s/^cc-/:cc-/g
+s/\<fetch\(8\|16\|32\|64\)\>/\1@/g
+s/\<store\(8\|16\|32\|64\)\>/\1!/g
+s/\<addstore\>/+!/g
+s/\<substore\>/-!/g
+s/\<fetch-value-stack\>/value@/g
+s/\<store-value-stack\>/value!/g
+s/\<fetch-control-stack\>/control@/g
+s/\<store-control-stack\>/control!/g
+s/\<fetch\>/@/g
+s/\<store\>/!/g
+
+bmain
+
diff --git a/describe-heap.sed b/describe-heap.sed
new file mode 100644
index 0000000..f21781b
--- /dev/null
+++ b/describe-heap.sed
@@ -0,0 +1,11 @@
+# ./quine | sed -f describe-heap.sed > heap.txt
+
+:main
+/^0000000008/bdrop
+n
+bmain
+
+:drop
+s/.*//
+N
+bdrop