diff options
| author | Irene Knapp <ireneista@irenes.space> | 2025-11-08 17:32:27 -0800 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2025-11-08 17:32:27 -0800 |
| commit | 3065f9ec64a9e1fa81face0f9c36cf80aa33932b (patch) | |
| tree | 36077a571eff0a1d35d159c5aa3c48eb8b120150 /quine.asm | |
| parent | 3c5dc89e436d15e598c279db5ec67f39417c03ca (diff) | |
lit, litstring as asm-in-Forth. give repnz_scas8 the correct name.
Force-Push: yes Change-Id: I6e34fef69b8d254e215eb377f7a50df57190eed0
Diffstat (limited to 'quine.asm')
| -rw-r--r-- | quine.asm | 23 |
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. |