asmtutorials/hello64.s

31 lines
727 B
ArmAsm
Raw Normal View History

;; Hello World Program #1
;; Compile with: nasm -f elf64 hello.s
;; Link with: ld -o hello hello.o
;; Run with: ./hello
2018-04-25 15:41:35 +00:00
;; sys/unistd_64.h
%define SYS_write 1
%define SYS_exit 60
;; unistd.h
%define STDOUT 1
section .data
msg db "Hello You Beautiful Human", 0Ah
len equ $-msg ; NASM-supplied macro
section .text
global _start
_start:
mov rdx, len ; Length of the message
mov rsi, msg ; Address of the message
mov rdi, STDOUT ; using STDOUT (see definition above)
mov rax, SYS_write ; Using WRITE in 32-bit mode?
syscall
mov rdi, 0
mov rax, SYS_exit
syscall