summary refs log tree commit diff
path: root/quine.asm
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2025-11-02 19:31:18 -0800
committerIrene Knapp <ireneista@irenes.space>2025-11-02 19:31:18 -0800
commit97574977ac5f8ce4595c2bbf4eba4ee49877ba23 (patch)
tree65918e3414c078f33af68ba66ec52a7135252f61 /quine.asm
parentde144faea9d0940cdad07b237dfe72f46110188a (diff)
those ;codeword comments were unnecessarily verbose
and the 0x in front of the 8 was silly

Force-Push: yes
Change-Id: I23a8ffd6aeec1d78ee7362c1f97d99e94947e5b6
Diffstat (limited to 'quine.asm')
-rw-r--r--quine.asm110
1 files changed, 55 insertions, 55 deletions
diff --git a/quine.asm b/quine.asm
index 206c6a7..800d232 100644
--- a/quine.asm
+++ b/quine.asm
@@ -1945,7 +1945,7 @@ latest_word = 0
 defword_unlabeled DOCOL, 0
 DOCOL_constant:
   ; Evaluated as a word, DOCOL is a constant which returns a pointer.
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   mov.qreg.qimm rax, DOCOL
   push.qreg rax
   NEXT
@@ -1967,7 +1967,7 @@ latest_word = DOCOL_name
 ;;; do the next thing the caller wants to do, by inlining NEXT.
 ;;;
 defword EXIT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   POPCONTROL rsi
   NEXT
 
@@ -1986,7 +1986,7 @@ defword EXIT, 0
 ;;;
 
 defword SWAP, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   pop.qreg rbx
   push.qreg rax
@@ -1994,12 +1994,12 @@ defword SWAP, 0
   NEXT
 
 defword DROP, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   NEXT
 
 defword DROP2, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   pop.qreg rax
   NEXT
@@ -2010,7 +2010,7 @@ defword DROP2, 0
 ; instruction that exists to optimize C's memcpy(). The details of setting
 ; that up are complex; see below.
 defword ROLL, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
 
   ;   Pop our parameter. The rep instruction takes rcx as its count, so we
   ; reduce copying by using it to hold our count, as well.
@@ -2080,7 +2080,7 @@ defword ROLL, 0
 ; instruction that exists to optimize C's memcpy(). The details of setting
 ; that up are complex; see below.
 defword UNROLL, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
 
   ;   Pop our parameter. The rep instruction takes rcx as its count, so we
   ; reduce copying by using it to hold our count, as well.
@@ -2136,7 +2136,7 @@ defword UNROLL, 0
 
 ; Rotates "up" (third item becomes current item)
 defword ROLL3, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   pop.qreg rbx
   pop.qreg rcx
@@ -2147,7 +2147,7 @@ defword ROLL3, 0
 
 ; Rotates "down" (current item becomes third item)
 defword UNROLL3, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   pop.qreg rbx
   pop.qreg rcx
@@ -2157,7 +2157,7 @@ defword UNROLL3, 0
   NEXT
 
 defword DUP, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   push.qreg rax
   push.qreg rax
@@ -2172,7 +2172,7 @@ defword DUP, 0
 ;;;
 
 defword ADD, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   add.qreg.qreg rax, rbx
@@ -2180,7 +2180,7 @@ defword ADD, 0
   NEXT
 
 defword SUB, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   sub.qreg.qreg rax, rbx
@@ -2188,7 +2188,7 @@ defword SUB, 0
   NEXT
 
 defword MUL, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   pop.qreg rbx
   mul.rax.qreg rbx
@@ -2196,7 +2196,7 @@ defword MUL, 0
   NEXT
 
 defword DIVMOD, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   xor.qreg.qreg rdx, rdx         ; rdx is the high bits of the input; zero it
   pop.qreg rbx
   pop.qreg rax
@@ -2211,7 +2211,7 @@ defword DIVMOD, 0
 ;;;
 
 defword EQ, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   cmp.qreg.qreg rax, rbx
@@ -2221,7 +2221,7 @@ defword EQ, 0
   NEXT
 
 defword NE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   cmp.qreg.qreg rax, rbx
@@ -2231,7 +2231,7 @@ defword NE, 0
   NEXT
 
 defword GT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   cmp.qreg.qreg rax, rbx
@@ -2242,7 +2242,7 @@ defword GT, 0
 
 ; Is the top of the stack less than the second item in the stack?
 defword LT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   cmp.qreg.qreg rax, rbx
@@ -2252,7 +2252,7 @@ defword LT, 0
   NEXT
 
 defword GE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   set.breg.cc al, greater.equal
@@ -2261,7 +2261,7 @@ defword GE, 0
   NEXT
 
 defword LE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   set.breg.cc al, less.equal
@@ -2275,7 +2275,7 @@ defword LE, 0
 ;;;
 
 defword AND, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   and.qreg.qreg rax, rbx
@@ -2283,7 +2283,7 @@ defword AND, 0
   NEXT
 
 defword OR, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   or.qreg.qreg rax, rbx
@@ -2291,7 +2291,7 @@ defword OR, 0
   NEXT
 
 defword XOR, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   xor.qreg.qreg rax, rbx
@@ -2300,7 +2300,7 @@ defword XOR, 0
 
 ; The HP overloads the name "not", so we follow the Forth convention.
 defword INVERT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   not.qreg rax
   push.qreg rax
@@ -2312,7 +2312,7 @@ defword INVERT, 0
 ;;;
 
 defword LIT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   lodsq
   push.qreg rax
   NEXT
@@ -2328,14 +2328,14 @@ defword LIT, 0
 
 ; Address on the top of the stack, value in the second position
 defword STORE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   mov.indirect.qreg.qreg rbx, rax
   NEXT
 
 defword FETCH, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   mov.qreg.indirect.qreg rax, rax
   push.qreg rax
@@ -2345,56 +2345,56 @@ defword FETCH, 0
 ; I might have done it the other way, but this is what Jonesforth does and it
 ; seems reasonable enough.
 defword ADDSTORE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   add.indirect.qreg.qreg rbx, rax
   NEXT
 
 defword SUBSTORE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   sub.indirect.qreg.qreg rbx, rax
   NEXT
 
 defword STORE8, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   mov.indirect.qreg.breg rbx, al
   NEXT
 
 defword FETCH8, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   xor.qreg.qreg rax, rax
   mov.breg.indirect.qreg al, rbx
   NEXT
 
 defword STORE16, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   mov.indirect.qreg.wreg rbx, ax
   NEXT
 
 defword FETCH16, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   xor.qreg.qreg rax, rax
   mov.wreg.indirect.qreg ax, rbx
   NEXT
 
 defword STORE32, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   pop.qreg rax
   mov.indirect.qreg.dreg rbx, eax
   NEXT
 
 defword FETCH32, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rbx
   xor.qreg.qreg rax, rax
   mov.dreg.indirect.qreg eax, rbx
@@ -2415,7 +2415,7 @@ defword FETCH32, 0
 ;   length
 ; (top)
 defword CCOPY, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   ; We need to save and restore rsi; the other registers we can trample.
   mov.qreg.qreg rdx, rsi
   pop.qreg rcx
@@ -2437,13 +2437,13 @@ defword CCOPY, 0
 ;   The offset is relative to the start of the word the number of bytes is in,
 ; so, make sure to have it skip itself.
 defword BRANCH, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   add.qreg.indirect.qreg rsi, rsi
   NEXT
 
 ; This should probably be 0BRANCH, but right now the auto-label code is picky.
 defword ZBRANCH, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rax
   test.qreg.qreg rax, rax
   ; Please notice the 8-bit branch to the nearby word.
@@ -2516,7 +2516,7 @@ defword early_here, 0
 ;;; top-level word that stays running forever, is called "quit".
 ;;;
 defword QUIT, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
 
   ;;;
   ;;; Although we initialized rbp already, we do so again because we'll want
@@ -2562,7 +2562,7 @@ defword QUIT, 0
 ;;;   This does the Linux exit() system call, passing it exit code zero.
 ;;;
 defword SYS_EXIT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
 
   mov.qreg.qimm rax, 60          ; syscall number
   mov.qreg.qimm rdi, 0           ; exit code
@@ -2583,7 +2583,7 @@ defword SYS_EXIT, 0
 ;;; little juggling.
 ;;;
 defword SYS_WRITE, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   pop.qreg rcx                   ; address from stack
   pop.qreg rdx                   ; length from stack, passed directly
   push.qreg rsi                  ; save rsi
@@ -2602,19 +2602,19 @@ defword SYS_WRITE, 0
 ; In: base address, value
 ; Out: new base address
 defword PACK64, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
   dq SWAP, DUP, UNROLL3, STORE, LIT, 8, ADD
   dq EXIT
 defword PACK32, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
   dq SWAP, DUP, UNROLL3, STORE32, LIT, 4, ADD
   dq EXIT
 defword PACK16, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
   dq SWAP, DUP, UNROLL3, STORE16, LIT, 2, ADD
   dq EXIT
 defword PACK8, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
   dq SWAP, DUP, UNROLL3, STORE8, LIT, 1, ADD
   dq EXIT
 
@@ -2622,22 +2622,22 @@ defword PACK8, 0
 ; to PACK* invocations, we define words that combine LIT with PACK*. This
 ; shaves roughly 700 bytes as of when it was added.
 defword LITPACK64, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   lodsq
   push.qreg rax
   BEFORENEXT PACK64
 defword LITPACK32, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   lodsq
   push.qreg rax
   BEFORENEXT PACK32
 defword LITPACK16, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   lodsq
   push.qreg rax
   BEFORENEXT PACK16
 defword LITPACK8, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   lodsq
   push.qreg rax
   BEFORENEXT PACK8
@@ -2651,7 +2651,7 @@ defword LITPACK8, 0
 ;;; the file is fully assembled, we output it.
 ;;;
 defword QUINE, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
 
   ; We still have HEAP on the stack, so we can call early_here. Add a constant
   ; to HERE in-place, keeping a copy of the pointer ...
@@ -2779,7 +2779,7 @@ defword SET_LABEL, 0
 
 
 defword HLT, 0
-  dq $ + 0x8                     ; codeword
+  dq $ + 8
   hlt
 
 
@@ -2788,7 +2788,7 @@ defword HLT, 0
 ;
 ; It also makes use of label stuff, further back on the stack.
 defword ALL_CONTENTS, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
   dq ELF_FILE_HEADER, ELF_PROGRAM_HEADER
   dq OUTPUT_START_ROUTINE
   dq SELF_RAW
@@ -2802,7 +2802,7 @@ defword ALL_CONTENTS, 0
 ;;; exactly one of this header, which is always at the start of the file.
 ;;;
 defword ELF_FILE_HEADER, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
 
   dq LITPACK32, 0x7f bappend "ELF"          ; magic number
   dq LITPACK8, 2                            ; 64-bit
@@ -2842,7 +2842,7 @@ defword ELF_FILE_HEADER, 0
 ;;; exactly one, and it's always right after the ELF file header.
 ;;;
 defword ELF_PROGRAM_HEADER, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
 
   dq LITPACK32, 1                          ; "loadable" segment type
   dq LITPACK32, 0x05                       ; read+execute permission
@@ -2879,7 +2879,7 @@ defword OUTPUT_START_ROUTINE, 0
 ; write() the machine code by using self-reference
 ; TODO do this in a "real" quine way
 defword SELF_RAW, 0
-  dq DOCOL                       ; codeword
+  dq DOCOL
   dq DUP
   dq LIT, elf_header + 0xc4      ; source
   dq LIT, file_size - 0xc4       ; length