aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-21 05:04:37 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-21 05:04:37 +0100
commit3eae1d082fbd86d48a8f9ee2c57b8931a468cb59 (patch)
tree7325f5683ee3ac012c4f246681cd0dd43a0dbd3e
downloadlibasm-3eae1d082fbd86d48a8f9ee2c57b8931a468cb59.tar.gz
libasm-3eae1d082fbd86d48a8f9ee2c57b8931a468cb59.tar.bz2
libasm-3eae1d082fbd86d48a8f9ee2c57b8931a468cb59.zip
Initial commit (i cant even compile this shit)
-rw-r--r--.gitignore2
-rw-r--r--ft_read.s0
-rw-r--r--ft_strcmp.s12
-rw-r--r--ft_strcpy.s11
-rw-r--r--ft_strdup.s11
-rw-r--r--ft_strlen.s12
-rw-r--r--ft_write.s4
-rw-r--r--main.c12
-rw-r--r--subject.en.pdfbin0 -> 1305522 bytes
9 files changed, 64 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1a687bd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.o
+a.out
diff --git a/ft_read.s b/ft_read.s
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ft_read.s
diff --git a/ft_strcmp.s b/ft_strcmp.s
new file mode 100644
index 0000000..4c5aee7
--- /dev/null
+++ b/ft_strcmp.s
@@ -0,0 +1,12 @@
+_ft_strcmp:
+ mov eax, sp
+ mov ebx, sp + 8
+ FT_STRCMP_LOOP:
+ cmp eax, 0
+ jneq FT_STRCMP_LOOP
+ cmp ebx, 0
+ jneq FT_STRCMP_LOOP
+ cmp eax, ebx
+ jeq FT_STRCMP_LOOP
+ sub eax, ebx
+ ret
diff --git a/ft_strcpy.s b/ft_strcpy.s
new file mode 100644
index 0000000..44a098d
--- /dev/null
+++ b/ft_strcpy.s
@@ -0,0 +1,11 @@
+_ft_strcpy:
+ pop ax
+ pop bx
+ mov ecx, eax ; copy
+ FT_STRCPY_LOOP:
+ mov [ecx], ebx
+ inc ebx
+ inc ecx
+ cmp ebx, 0
+ jneq FT_STRCPY_LOOP
+ ret
diff --git a/ft_strdup.s b/ft_strdup.s
new file mode 100644
index 0000000..a10f383
--- /dev/null
+++ b/ft_strdup.s
@@ -0,0 +1,11 @@
+_ft_strdup:
+ pop eax
+ push eax
+ call _ft_strlen
+ inc eax
+ push eax
+ call _malloc
+ call _ft_strcpy
+ ret
+
+
diff --git a/ft_strlen.s b/ft_strlen.s
new file mode 100644
index 0000000..32eaf0c
--- /dev/null
+++ b/ft_strlen.s
@@ -0,0 +1,12 @@
+ft_strlen:
+ pop bx
+ mov eax, 0h
+FT_STRLEN_LOOP:
+ mov ecx, [ebx]
+ cmp ecx, 0
+ je FT_STRLEN_RET
+ inc eax
+ inc ebx
+ jmp FT_STRLEN_LOOP
+FT_STRLEN_RET:
+ ret
diff --git a/ft_write.s b/ft_write.s
new file mode 100644
index 0000000..a21ec45
--- /dev/null
+++ b/ft_write.s
@@ -0,0 +1,4 @@
+_ft_write:
+ mov eax, 4
+ int 0x80
+ ret
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..b1c30b7
--- /dev/null
+++ b/main.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int ft_strlen(char *);
+
+
+int main()
+{
+
+ /* extern ft_strlen("bonjour"); */
+ printf("%d\n", ft_strlen("bonjour"));
+ return 0;
+}
diff --git a/subject.en.pdf b/subject.en.pdf
new file mode 100644
index 0000000..ead704a
--- /dev/null
+++ b/subject.en.pdf
Binary files differ