Skip to content

Commit

Permalink
Hello world
Browse files Browse the repository at this point in the history
  • Loading branch information
rsore committed Dec 19, 2023
0 parents commit 35643b3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
13 changes: 13 additions & 0 deletions LICENSE
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.
10 changes: 10 additions & 0 deletions README.md
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
```
17 changes: 17 additions & 0 deletions br.asm
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
14 changes: 14 additions & 0 deletions makefile
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

0 comments on commit 35643b3

Please sign in to comment.