summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--quine.asm22
1 files changed, 6 insertions, 16 deletions
diff --git a/quine.asm b/quine.asm
index 2f8e91d..a97b460 100644
--- a/quine.asm
+++ b/quine.asm
@@ -1988,19 +1988,6 @@ cold_start:
   dq pack_next
   dq lit, 8, packalign
   dq roll3, swap, early_here_store, swap
-; it seems to be outputting the lea correctly but then it's supposed to
-; move the contents of rsi into the address in rbp, which is a weird
-; addressing mode, and it winds up encoded wrong
-;(gdb) disassemble/r 0x10000100f8,+24
-;Dump of assembler code from 0x10000100f8 to 0x1000010110:
-;   0x00000010000100f8:  48 8d 6d f8             lea    -0x8(%rbp),%rbp
-;   0x00000010000100fc:  48 89 35 48 83 c0 08    mov    %rsi,0x8c08348(%rip)        # 0x1008c1844b
-;   0x0000001000010103:  48 89 c6                mov    %rax,%rsi
-;   0x0000001000010106:  48 ad                   lods   %ds:(%rsi),%rax
-;   0x0000001000010108:  ff 20                   jmp    *(%rax)
-;   0x000000100001010a:  00 00                   add    %al,(%rax)
-;   0x000000100001010c:  00 00                   add    %al,(%rax)
-;   0x000000100001010e:  00 00                   add    %al,(%rax)
   ; Now the interpreter snippet is in-place and "here" points after it, so
   ; that future allocation won't step on it. We also still have a copy of its
   ; start address, which we will now pass to early_variable.
@@ -2011,6 +1998,10 @@ cold_start:
   ; store, but the only thing early_variable is doing is returning an
   ; address.)
 
+  dq litstring, "exit", early_create, early_self_codeword, early_here, fetch
+  dq rsi, pack_popcontrol, pack_next
+  dq lit, 8, packalign, early_here_store
+
   ;;; For triage's sake, here's an inventory of everything else in the file.
   ;;;
   ;;; Macros:
@@ -2082,7 +2073,6 @@ cold_start:
   ;;;   self_raw
   ;;;     self-reference
   ;;;
-  dq hlt
   dq quit
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3271,8 +3261,8 @@ defword pack_pushcontrol, 0
 ;   new base address
 defword pack_popcontrol, 0
   dq docol
-  dq rbp, swap, mov_reg64_indirect_reg64
-  dq rbp, lit, -8, rbp, lea_reg64_disp8_reg64
+  dq rbp, lit, 0, roll3, mov_reg64_disp8_reg64
+  dq rbp, lit, 8, rbp, lea_reg64_disp8_reg64
   dq exit
 
 ;   Now we're back to heap idioms again.