-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35643b3
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
|
||
Copyright (C) 2023 Ruben Sørensen | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# brasm | ||
|
||
**[Brainfuck](https://en.wikipedia.org/wiki/Brainfuck#:~:text=Brainfuck%20is%20an%20esoteric%20programming,Esoteric%2C%20imperative%2C%20structured)** compiler written in x86_64 assembly | ||
|
||
## Quick start | ||
|
||
```console | ||
make | ||
./build/brasm | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
section .rodata | ||
msg db 'Hello, world!',0xa ; Hello world string | ||
len equ $ - msg ; Length of string | ||
|
||
section .text | ||
global _start ; Export _start, our entrypoint | ||
|
||
_start: ; Entry point | ||
mov eax, 4 ; sys_write | ||
mov ebx, 1 ; file descriptor (stdout) | ||
mov ecx, msg ; message to write | ||
mov edx, len ; message length | ||
int 0x80 ; call kernel | ||
|
||
mov eax, 1 ; sys_exit | ||
xor ebx, ebx ; process' exit code | ||
int 0x80 ; call kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
default: build/brasm | ||
|
||
build/: | ||
mkdir -p build/ | ||
|
||
build/brasm.o: build/ br.asm | ||
nasm -f elf64 br.asm -o build/brasm.o | ||
|
||
build/brasm: build/brasm.o | ||
ld -m elf_x86_64 -s -nostdlib -N build/brasm.o -o build/brasm | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf build |