aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2023-06-15 19:31:35 +0200
committerMarvin Borner2023-06-15 19:32:23 +0200
commitf7638fc25078314e1b64134436af7bcbf9a9c2ee (patch)
tree0fb7b743b89c08e35125e5c85127348a8bd17710
Initial commit
-rw-r--r--.gitignore2
-rw-r--r--license13
-rw-r--r--makefile6
-rw-r--r--readme.md8
-rw-r--r--sort.asm29
5 files changed, 58 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a7f05ec
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+sort
+sort.o
diff --git a/license b/license
new file mode 100644
index 0000000..1fb6990
--- /dev/null
+++ b/license
@@ -0,0 +1,13 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+Copyright (C) 2023 Marvin Borner <develop@marvinborner.de>
+
+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.
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..e7e2ee3
--- /dev/null
+++ b/makefile
@@ -0,0 +1,6 @@
+SRC = sort.asm
+OBJ = sort.o
+
+all:
+ @nasm -f elf64 -o $(OBJ) $(SRC)
+ @gcc -no-pie -o sort $(OBJ)
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..6d096c0
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,8 @@
+# Sleepsort
+
+> efficiently sleeping
+
+## Installation
+
+ make
+ ./sort
diff --git a/sort.asm b/sort.asm
new file mode 100644
index 0000000..b576889
--- /dev/null
+++ b/sort.asm
@@ -0,0 +1,29 @@
+; Copyright (c) 2023 Marvin Borner
+
+global main
+extern printf
+
+bits 64
+
+main:
+ push rbp
+ mov ecx, size
+
+print:
+ mov rdi, format
+ mov rsi, [array + (ecx - 1) * 4]
+ xor rax, rax
+ push rcx
+ call printf WRT ..plt
+ pop rcx
+ dec ecx
+ jnz print
+
+end:
+ pop rbp
+ mov rax, 0
+ ret
+
+array: dd 1, 5, 3, 7, 2, 6
+size: equ ($-array)/4
+format: db "%d", 10, 0