global _start
;
; CONSTANTS
;
SYS_WRITE equ 1
SYS_EXIT equ 60
STDOUT equ 1
;
; Initialised data goes here
;
SECTION .data
hello db "Hello World!", 10 ; char *
hello_len equ $-hello ; size_t
;
; Code goes here
;
SECTION .text
_start:
; syscall(SYS_WRITE, STDOUT, hello, hello_len);
mov rax, SYS_WRITE
mov rdi, STDOUT
mov rsi, hello
mov rdx, hello_len
syscall
push rax
; syscall(SYS_EXIT, <sys_write return value> - hello_len);
mov rax, SYS_EXIT
pop rdi
sub rdi, hello_len
syscall
Z2xvYmFsIF9zdGFydAoKOwo7IENPTlNUQU5UUwo7ClNZU19XUklURSAgIGVxdSAxClNZU19FWElUICAgIGVxdSA2MApTVERPVVQgICAgICBlcXUgMQoKOwo7IEluaXRpYWxpc2VkIGRhdGEgZ29lcyBoZXJlCjsKU0VDVElPTiAuZGF0YQpoZWxsbyAgICAgICAgICAgZGIgICJIZWxsbyBXb3JsZCEiLCAxMCAgICAgIDsgY2hhciAqCmhlbGxvX2xlbiAgICAgICBlcXUgJC1oZWxsbyAgICAgICAgICAgICAgICAgOyBzaXplX3QKCjsKOyBDb2RlIGdvZXMgaGVyZQo7ClNFQ1RJT04gLnRleHQKCl9zdGFydDoKICAgIDsgc3lzY2FsbChTWVNfV1JJVEUsIFNURE9VVCwgaGVsbG8sIGhlbGxvX2xlbik7CiAgICBtb3YgICAgIHJheCwgU1lTX1dSSVRFCiAgICBtb3YgICAgIHJkaSwgU1RET1VUCiAgICBtb3YgICAgIHJzaSwgaGVsbG8KICAgIG1vdiAgICAgcmR4LCBoZWxsb19sZW4KICAgIHN5c2NhbGwKICAgIHB1c2ggICAgcmF4CgogICAgOyBzeXNjYWxsKFNZU19FWElULCA8c3lzX3dyaXRlIHJldHVybiB2YWx1ZT4gLSBoZWxsb19sZW4pOwogICAgbW92ICAgICByYXgsIFNZU19FWElUCiAgICBwb3AgICAgIHJkaQogICAgc3ViICAgICByZGksIGhlbGxvX2xlbgogICAgc3lzY2FsbA==