summaryrefslogtreecommitdiff
path: root/twasm
diff options
context:
space:
mode:
Diffstat (limited to 'twasm')
-rw-r--r--twasm/README.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/twasm/README.md b/twasm/README.md
index b414770..c7dc833 100644
--- a/twasm/README.md
+++ b/twasm/README.md
@@ -6,6 +6,11 @@ this will be a self hosted, very minimal subset of nasm-style 64 bit asm
I want to compile Bootler and Twasm with the Twasm assembler
+### reading
+
+- [instructions](https://www.felixcloutier.com/x86/)
+- [opcodes,ModR/M,SIB](http://ref.x86asm.net/coder64.html) (no secure site available)
+
### memory map
```
@@ -197,3 +202,30 @@ hlt
0xFE0A ; newline
0xFE00 ; null terminator
```
+
+#### nasm output with the above example program, bits 64
+
+```nasm
+0x31 ; XOR r/m16/32/64 r16/32/64
+0xC0 ; ModR/M byte
+ ; mod 11b ; directly address the following:
+ ; reg 000b ; EAX
+ ; r/m 000b ; EAX
+
+0x48 ; 64 Bit Operand Size prefix
+0xFF ; with `reg` from ModR/M byte 000b:
+ ; INC r/m16/32/64
+0xC0 ; ModR/M byte
+ ; mod 11b ; direct addressing
+ ; reg 000b ; RAX
+ ; r/m 000b ; RAX
+
+0x48 ; 64 Bit Operand Size prefix
+0x89 ; MOV r/m16/32/64 r16/32/64
+0x10 ; ModR/M byte
+ ; mod 00b ; indirect addressing, no displacement
+ ; reg 010b ; RDX
+ ; r/m 000b ; [RAX]
+
+0xF4 ; HLT
+```