diff options
| author | andromeda <andromeda@lenovo> | 2026-03-08 13:47:12 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-08 13:47:12 +0100 |
| commit | 002100bd7086bc1b05120e846b09d3e44b65f6f4 (patch) | |
| tree | 91417b6933a65a3829e302c270be1f250adb85ab | |
| parent | e10d77174328c8527893d936e266ff6b12a48932 (diff) | |
add resources to README
| -rw-r--r-- | twasm/README.md | 32 |
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 +``` |
