update example in readme

This commit is contained in:
andromeda
2026-03-23 23:54:27 +01:00
parent b607bd13f3
commit 8b0e4759be

View File

@@ -340,7 +340,9 @@ this program doesn't do anything useful, it's just a test
```nasm ```nasm
xor eax, eax xor eax, eax
inc rax inc rax ; inline comment
; one line comment
mov rdx, [rax]
mov [rax], rdx mov [rax], rdx
hlt hlt
@@ -350,30 +352,19 @@ hlt
```nasm ```nasm
0x0053 ; xor 0x0053 ; xor
0xFE20 ; space
0x0010 ; eax 0x0010 ; eax
0xFE2C ; comma
0xFE20 ; space
0x0010 ; eax 0x0010 ; eax
0xFE0A ; newline
0x0054 ; inc 0x0054 ; inc
0xFE20 ; space
0x0000 ; rax 0x0000 ; rax
0xFE0A ; newline
0x0056 ; mov 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 0x0003 ; rdx
0xFE0A ; newline 0x1000 ; memory address: register
0x0000 ; rax
0x0056 ; mov
0x1000 ; memory address: register
0x0000 ; rax
0x0003 ; rdx
0x004F ; hlt 0x004F ; hlt
0xFE0A ; newline
0xFE00 ; null terminator
``` ```
#### nasm output with the above example program, bits 64 #### nasm output with the above example program, bits 64
@@ -393,6 +384,13 @@ hlt
; reg 000b ; RAX ; reg 000b ; RAX
; r/m 000b ; RAX ; 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 0x48 ; 64 Bit Operand Size prefix
0x89 ; MOV r/m16/32/64 r16/32/64 0x89 ; MOV r/m16/32/64 r16/32/64
0x10 ; ModR/M byte 0x10 ; ModR/M byte