From: Jonas Hvid Date: Wed, 13 Nov 2019 20:53:45 +0000 (+0100) Subject: Hello world in FASM X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=69a2f0a24cc7698bc49648d7419c3292140fc869;p=rrq%2Fjonasforth.git Hello world in FASM --- 69a2f0a24cc7698bc49648d7419c3292140fc869 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95811e0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/main diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..70cb7cd --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +main: main.asm + fasm $< $@ + +.PHONY: clean +clean: + rm -f main diff --git a/main.asm b/main.asm new file mode 100644 index 0000000..acb119a --- /dev/null +++ b/main.asm @@ -0,0 +1,25 @@ +format ELF64 executable + +struc with_length string& { + . db string + .length = $ - . +} + +macro write_stdout string_label { + mov rax, 1 + mov rdi, 1 + mov rsi, string_label + mov rdx, string_label#.length + syscall +} + +segment readable executable + +start: + write_stdout message + + jmp $ + +segment readable + +message with_length 'Hello, world!',$A diff --git a/notes b/notes new file mode 100644 index 0000000..c50b57b --- /dev/null +++ b/notes @@ -0,0 +1,7 @@ +FASM: +- https://flatassembler.net/docs.php?article=fasmg (Introduction) +- https://flatassembler.net/docs.php?article=fasmg_manual (Manual) +- https://flatassembler.net/docs.php?article=manual (Other manual) + +JONESFORTH: +- https://github.com/nornagon/jonesforth/blob/master/jonesforth.S