diff options
| author | andromeda <andromeda@lenovo> | 2026-03-23 23:54:27 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-23 23:54:27 +0100 |
| commit | 8b0e4759beaa550f7b1d19a44cf86a9ae04268f7 (patch) | |
| tree | db4353d76170f8ae23ad7a81b5f30bf3e6fbbdce | |
| parent | b607bd13f39ef0e6cb77e455129b0050fa4584f5 (diff) | |
update example in readme
| -rw-r--r-- | twasm/README.md | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/twasm/README.md b/twasm/README.md index 3b63414..dfb198d 100644 --- a/twasm/README.md +++ b/twasm/README.md @@ -340,8 +340,10 @@ this program doesn't do anything useful, it's just a test ```nasm xor eax, eax -inc rax -mov [ rax ], rdx +inc rax ; inline comment +; one line comment +mov rdx, [rax] +mov [rax], rdx hlt ``` @@ -350,30 +352,19 @@ hlt ```nasm 0x0053 ; xor -0xFE20 ; space 0x0010 ; eax -0xFE2C ; comma -0xFE20 ; space 0x0010 ; eax -0xFE0A ; newline 0x0054 ; inc -0xFE20 ; space 0x0000 ; rax -0xFE0A ; newline 0x0056 ; mov -0xFE20 ; space -0x1004 ; open bracket (4) -0xFE20 ; space |1 -0x0000 ; rax |2 -0xFE20 ; space |3 -0x0052 ; close bracket |4 -0xFE2C ; comma -0xFE20 ; space 0x0003 ; rdx -0xFE0A ; newline +0x1000 ; memory address: register +0x0000 ; rax +0x0056 ; mov +0x1000 ; memory address: register +0x0000 ; rax +0x0003 ; rdx 0x004F ; hlt -0xFE0A ; newline -0xFE00 ; null terminator ``` #### nasm output with the above example program, bits 64 @@ -394,6 +385,13 @@ hlt ; r/m 000b ; RAX 0x48 ; 64 Bit Operand Size prefix +0x8B ; MOV r16/32/64 r/m16/32/64 +0x10 ; ModR/M byte + ; mod 00b ; indirect addressing, no displacement + ; reg 010b ; RDX + ; 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 |
