diff options
Diffstat (limited to 'nasm/helloworld.asm')
-rwxr-xr-x | nasm/helloworld.asm | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/nasm/helloworld.asm b/nasm/helloworld.asm index 3016f58..48755fb 100755 --- a/nasm/helloworld.asm +++ b/nasm/helloworld.asm @@ -1,17 +1,14 @@ -SECTION .data -msg db "Hello World!", 0Ah ; - -SECTION .text -global _start - -_start: - - mov edx, 13 ; number of bytes to write - mov ecx, msg ; move memory address of 'msg' to ecx - mov ebx, 1 ; write to the file STDOUT - mov eax, 4 ; invoke SYS_WRITE (kernel opcode 4) - int 80h - - mov ebx, 0 ; - mov eax, 1 ; - int 80h + global _start + + section .text +_start: mov rax, 1 ; system call for write + mov rdi, 1 ; file handle 1 is stdout + mov rsi, msg ; address of string to output + mov rdx, 13 ; number of bytes + syscall ; invoke operating system to do the write + mov rax, 60 ; system call for exit + xor rdi, rdi ; exit code 0; + syscall ; invoke operating system to exit + + section .data +msg db "hello, world",10 ; note the new line at end |