From d246f09f3710980aa19296377afad8939b72d342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Fri, 3 Jun 2016 02:16:13 +0200 Subject: [PATCH] Added source files. --- Makefile | 14 ++++++++++++++ src/HelloWorld.asm | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Makefile create mode 100644 src/HelloWorld.asm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..12500a5 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +AS=as +LINKER=ld +OBJ=src/HelloWorld.o + +%.o: %.asm + $(AS) -o $@ $< + +helloworld: $(OBJ) + $(LINKER) -o $@ $^ + +.PHONY: clean + +clean: + rm $(OBJ) diff --git a/src/HelloWorld.asm b/src/HelloWorld.asm new file mode 100644 index 0000000..6501f07 --- /dev/null +++ b/src/HelloWorld.asm @@ -0,0 +1,17 @@ +.section .data + hello: + .ascii "Hello, World.\n" + +.section .text + .global _start + +_start: + mov $1, %rax + mov $1, %rdi + mov $hello, %rsi + mov $14, %rdx + syscall + + mov $60, %rax + xor %rdi, %rdi + syscall