summaryrefslogtreecommitdiff
path: root/nasm/helloworld.asm
blob: 48755fb479dabc01f8e7f88971cde74afc0e51b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    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