diff options
author | Irene Knapp <ireneista@irenes.space> | 2025-10-11 01:41:10 -0700 |
---|---|---|
committer | Irene Knapp <ireneista@irenes.space> | 2025-10-11 01:41:10 -0700 |
commit | 83984885dcd23109a19d93da4789ad447dc4c451 (patch) | |
tree | f6192484b227a8191c9ce75d3215b26da496dfcb | |
parent | a365fd2d8c18a9ceb5babf8e3f512e1a6c72fbcf (diff) |
use qwordreg in another place
Force-Push: yes Change-Id: I0d328c24639b993f8140b18b7b3d4efa450c33c7
-rw-r--r-- | quine.asm | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/quine.asm b/quine.asm index 467613a..f38f3c4 100644 --- a/quine.asm +++ b/quine.asm @@ -1,7 +1,12 @@ ; fasmg hello.asm hello && chmod 755 hello && ./hello; echo $? ; +; ***WARNING*** this version leaves the error message scrolled off the top of +; the screen and you see stale output ; fasmg quine.asm quine && ./quine > quine2; echo "exit code:" $?; echo; hexdump -C quine; echo; hexdump -C quine2; cmp quine quine2; echo; echo "compare:" $? ; ZydisDisasm -64 quine +; +; rm quine2; fasmg quine.asm quine && ./quine > quine2; echo "exit code:" $?; echo; hexdump -C quine; echo; hexdump -C quine2; echo; cmp quine quine2 ; echo $? + macro rex.0 @@ -197,28 +202,12 @@ end macro ; This uses opcode 0x89. macro mov.rel.q target, offset, source match =rsp, target - match =rax, source - rex.w - db 0x89 - modrm 1, 0, 4 - sib 0, 4, 4 - db offset - else match =rdx, source - ;mov.rel.q rsp, 0x60, rdx ; size in file - ; todo doesn't work yet - rex.w - db 0x89 - ;0x44 0100 0100 - ; 01 000 100 - ;0x54 0101 0100 - ; 01 010 100 - - modrm 1, 2, 4 ; <- changing this reg value should do it, but... - sib 0, 4, 4 - db offset - else - assert 0 - end match + qwordreg sreg, source + rex.w + db 0x89 + modrm 1, sreg, 4 + sib 0, 4, 4 + db offset else assert 0 end match |