summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--quine.asm23
1 files changed, 15 insertions, 8 deletions
diff --git a/quine.asm b/quine.asm
index 0525f23..b8b65fe 100644
--- a/quine.asm
+++ b/quine.asm
@@ -2213,13 +2213,22 @@ cold_start:
   dq pack_next, lit, 8, packalign, early_here_store
 
   dq litstring, "lit", early_create, early_self_codeword, early_here, fetch
-  ; TODO
-  dq lit, 8, packalign, early_here_store
+  dq lods64
+  dq rax, push_reg64
+  dq pack_next, lit, 8, packalign, early_here_store
 
   dq litstring, "litstring", early_create, early_self_codeword, early_here
   dq fetch
-  ; TODO
-  dq lit, 8, packalign, early_here_store
+  dq rsi, push_reg64
+  dq rsi, rdi, mov_reg64_reg64
+  dq rax, rax, xor_reg64_reg64
+  dq rcx, rcx, xor_reg64_reg64
+  dq rcx, not_reg64
+  dq repnz_scas8
+  dq rdi, rsi, mov_reg64_reg64
+  dq lit, 7, rsi, add_reg64_imm8
+  dq lit, 0xF8, rsi, and_reg64_imm8
+  dq pack_next, lit, 8, packalign, early_here_store
 
   ; This is "store", but since we're finally in Forth we're no longer limited
   ; by flatassembler's syntax, so we call it by its usual Forth name.
@@ -3962,11 +3971,9 @@ defword push_reg64, 0
 defword pop_reg64, 0
   dq docol, reg64, lit, 0x58, opcodereg, exit
 
-; TODO: Contemplate renaming this to lods64.
-;
 ; Stack:
 ;   output point
-defword lodsq, 0
+defword lods64, 0
   dq docol, rex_w, lit, 0xAD, pack8, exit
 
 ;   We break with the Intel mnemonics, which are movsb/movsw/movsd/movsq,
@@ -4385,7 +4392,7 @@ defword early_here_store, 0
 ; Stack out:
 ;   new base address
 defword pack_next, 0
-  dq docol, lodsq, rax, jmp_abs_indirect_reg64, exit
+  dq docol, lods64, rax, jmp_abs_indirect_reg64, exit
 
 ;   This is another helper "macro" that we'll use in defining assembly words
 ; from Forth. As before, see the flatassembler version for more explanation.