x86-64helloworld/src/helloworld.asm

20 lines
645 B
NASM
Raw Normal View History

2016-06-03 02:16:13 +02:00
.section .data
2016-09-18 21:06:35 +02:00
hello:
.ascii "Hello, World!\n" # the string
hello_end:
.equ hello_len, hello_end - hello
2016-06-03 02:16:13 +02:00
.section .text
.global _start
_start:
2016-06-03 02:35:31 +02:00
mov $1, %rax # Define write syscall
mov $1, %rdi # Define stdout
mov $hello, %rsi # Give string
2016-09-18 21:06:35 +02:00
mov $hello_len, %rdx # Give size of the string
2016-06-03 02:35:31 +02:00
syscall # Call the kernel to do work for us
2016-06-03 02:16:13 +02:00
2016-06-03 02:35:31 +02:00
mov $60, %rax # Define exit syscall
2016-09-18 21:06:35 +02:00
mov $0, %rdi # Give return value
2016-06-03 02:35:31 +02:00
syscall # Call the kernel to do work for us