hellostr: .ascii "Hello world!\n" # 'Hello world!' plus a linefeed character .equ helloLen, .-hellostr # Length of the 'Hello world!' string .globl _start _start: movq $1, %rax # The system call for write (sys_write) movq $1, %rdi # File descriptor 1 - standard output movq $hellostr, %rsi # Put the offset of hello in ecx movq $helloLen, %rdx # helloLen is a constant, so we don't need to say # mov edx,[helloLen] to get it's actual value syscall # Call the kernel movq $60, %rax # The system call for exit (sys_exit) xorq %rdi, %rdi # Exit with return code of 0 (no error) syscall