summary refs log tree commit diff
path: root/quine.asm
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-05-09 20:29:14 -0700
committerIrene Knapp <ireneista@irenes.space>2026-05-09 20:29:14 -0700
commit51e63deb372598185562858dbcb744114e2b1359 (patch)
treeb01758a702a4d2dfce617dba42c1e7ec375b8866 /quine.asm
parent6aded817e2ed13143db15040d88e86d0649f4e85 (diff)
implement "create" in interpret.e
memmove never had a heap-based implementation, probably due to excessive hurrying when it was first written. it has now been added. it's identical to the original static implementation.

a minor documentation error in evoke.e was discovered while coding this, and is now fixed.

Force-Push: yes
Change-Id: I55ff09712a992410167a53cd83e96a452ed49744
Diffstat (limited to 'quine.asm')
-rw-r--r--quine.asm35
1 files changed, 28 insertions, 7 deletions
diff --git a/quine.asm b/quine.asm
index e86e61c..12a45f8 100644
--- a/quine.asm
+++ b/quine.asm
@@ -2459,6 +2459,27 @@ cold_start:
   dq rdx, rsi, mov_reg64_reg64
   dq pack_next, lit, 8, packalign, early_here_store
 
+  dq litstring, "memmove", early_create, early_self_codeword
+  dq early_here, fetch
+  dq rsi, rdx, mov_reg64_reg64
+  dq rcx, pop_reg64
+  dq rsi, pop_reg64
+  dq rdi, pop_reg64
+  dq rsi, rax, mov_reg64_reg64
+  dq rdi, rax, cmp_reg64_reg64
+  dq lit, 4, cc_below, jmp_cc_rel_imm8
+  dq rep_movs8
+  dq lit, 16, jmp_rel_imm8
+  dq rcx, rsi, add_reg64_reg64
+  dq rsi, dec_reg64
+  dq rcx, rdi, add_reg64_reg64
+  dq rdi, dec_reg64
+  dq std
+  dq rep_movs8
+  dq cld
+  dq rdx, rsi, mov_reg64_reg64
+  dq pack_next, lit, 8, packalign, early_here_store
+
   dq litstring, "stringlen", early_create, early_self_codeword
   dq early_here, fetch
   dq rdi, pop_reg64
@@ -11790,14 +11811,14 @@ defword boot_source, 0x40
   ; We'll have logical and real soon now, be patient... :)
   dq ": is-in-heap dup heap @ <= swap here @ > & ;                    "
 
-  dq ": unlink-pre-heap-words                                         "
-  dq "  latest @                                                      "
-  dq "  dup { dup is-in-heap 0 = { drop exit } if }                   "
-  dq "      { drop exit } if-else                                     "
-  dq "  { dup @ is-in-heap } { @ } while                              "
-  dq "  0 swap ! ;                                                    "
+;  dq ": unlink-pre-heap-words                                         "
+;  dq "  latest @                                                      "
+;  dq "  dup { dup is-in-heap 0 = { drop exit } if }                   "
+;  dq "      { drop exit } if-else                                     "
+;  dq "  { dup @ is-in-heap } { @ } while                              "
+;  dq "  0 swap ! ;                                                    "
   ; Do it immediately, so that we don't accidentally rely on any of that.
-  dq "unlink-pre-heap-words                                           "
+  ;dq "unlink-pre-heap-words                                           "
 
   ; Now some fancier stack combinators.
   ;