diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-10-03 18:00:45 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-10-03 18:00:45 -0700 |
| commit | 353e1c687eddf3f310e3f159715d910272b9f7ed (patch) | |
| tree | 4bf59319a27d3ce20ab1afbd5e29885261c740b6 | |
| parent | 7dbf0442609a2a58b83e651d400bc806652e41bf (diff) | |
add a historical file of notes about assembly
now it's no longer clutter ;) Force-Push: yes Change-Id: I2d2c950a0b2694c33ea4e658828f9d516678a082
| -rw-r--r-- | historical/asm-notes.txt | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/historical/asm-notes.txt b/historical/asm-notes.txt new file mode 100644 index 0000000..100c681 --- /dev/null +++ b/historical/asm-notes.txt @@ -0,0 +1,88 @@ + This was a very early file, working notes that were part of bringing up the +earliest drafts of the flatassembler version of Evocation. It's here in case +it's of historical interest. + + +HLT will drop you into the debugger + db 0xf4 ; HLT DO NOT SUBMIT + +or perhaps you want to do a clean exit() + mov.b rax, 60 ; DO NOT SUBMIT + mov.b rdi, 0 ; DO NOT SUBMIT + syscall ; DO NOT SUBMIT + + + ; opcode c7 is Ev, Iz. c6 is Eb, Ib + ; Eb: ModR/M to follow, byte + ; consider 1100 011w : 11 000 reg : imm + ; also consider 1011 w reg : imm for bytes + +32-bit target, 8-bit source + match =eax?, target + db 0xB8 + dd source + else match =edi?, target + db 0xBF + dd source + +64-bit target, 32-bit source + match =rax?, target ; mov rax, 0x1234 + db 0x48, 0xC7, 0xC0 + dd source +; 48 eAX REX.W prefix +; (DEC is the 32-bit meaning, ignore it) +; eAX -> register identifier, +; width depends on operand +; REX.W -> set 64-bit operand mode +; c7 Grp 11^1A - MOV Ev, Iz +; immediate to register +; 1A -> bits 5,4,3 of ModR/M are opcode +; extension +; E -> modR/M byte to follow for operand +; v -> word of appropriate size +; I -> immediate data +; z -> 32-bit operand +; c0 ModR/M byte +; 0b11000000 +; 11 mod: always 11 +; 000 op/reg: Mov Ev, Iz +; 00x w absent +; 0 w (ignored) + + + + match =rdi, target ; mov rdi, 0x1234 + db 0x48, 0xC7, 0xC7 + dd source +; 7: 48 c7 c7 2a 00 00 00 mov $0x2a,%rdi +; 48 eAX REX.W prefix +; (DEC is the 32-bit meaning, ignore it) +; c7 Grp 11^1A - MOV Ev, Iz +; immediate to register +; 1A -> bits 5,4,3 of ModR/M are opcode +; extension +; Ev -> ModR/M to follow for 32-bit operand +; Iz -> Immediate data, 32-bits +; c7 ModR/M byte +; 0b11000111 +; 11 mod: always 11 +; 000 op/reg: Mov Ev, Iz +; 11x w present +; 1 w true; use EDI + + + +64-bit target, 64-bi source + + match =rdi, target ; mov rdi, 0x1234 + db 0x48, 0xB8, 0x38 + dq source + + match =rsi, target + db 0x48, 0xB8, 0x30 + dq source + ; opcode c7 is Ev, Iz. c6 is Eb, Ib + ; Eb: ModR/M to follow, byte + ; consider 1100 011w : 11 000 reg : imm + ; also consider 1011 w reg : imm for bytes + |