summary refs log tree commit diff
path: root/evoke.e
diff options
context:
space:
mode:
Diffstat (limited to 'evoke.e')
-rw-r--r--evoke.e42
1 files changed, 31 insertions, 11 deletions
diff --git a/evoke.e b/evoke.e
index 9bc6979..4252e91 100644
--- a/evoke.e
+++ b/evoke.e
@@ -1,6 +1,7 @@
 ~ (cat labels.e elf.e transform.e execution.e \
 ~  echo 131072 read-to-buffer; \
-~  cat core.e core-plus.e linux.e amd64.e execution-support.e log-load.e; \
+~  cat core.e core-plus.e linux.e output.e \
+~      amd64.e execution-support.e log-load.e; \
 ~  echo pyrzqxgl; \
 ~  cat evoke.e) \
 ~     | ./quine > evoke && chmod 755 evoke && ./evoke
@@ -9,6 +10,8 @@ s" source-to-precompile" variable
 
 ~ : fooze 4 . ; fooze
 1024 read-to-buffer
+~   We begin by outputting the actual docol routine, the one that codewords
+~ should point to. Note that this is before we've done any word header.
 here @
 dup L!' docol-codeword-value
 :rsi pack-pushcontrol
@@ -18,20 +21,37 @@ pack-next
 8 packalign
 here !
 
-: docol
-  [ here @
-    L@' docol-codeword-value :rax mov-reg64-imm64
-    :rax push-reg64
-    here ! ] ;asm
+~   We can't use colon to create docol, not even the part that's a word,
+~ because colon tries to dynamically invoke docol to fill in the codeword.
+s" docol" create
+here @
+dup 8 + pack64
+L@' docol-codeword-value :rax mov-reg64-imm64
+:rax push-reg64
+pack-next
+8 packalign
+here !
+
 
-: exit
-  [ here @
-    :rsi pack-popcontrol
-    here ! ] ;asm
+s" exit" create
+here @
+dup 8 + pack64
+:rsi pack-popcontrol
+here !
+
+: foo [ crash 1 2 + ;
 
-: foo 1 2 + ;
 0 sys-exit
+
+~   Now that we have docol, colon will work and we can define exit the normal
+~ way.
+~ : exit
+~   [ here @
+~     :rsi pack-popcontrol
+~     here ! ] ;asm
+
 pyrzqxgl
+~ 0 sys-exit
 s" source-to-copy-to-log" variable
 
 ~ (output memory start, current output point