diff --git a/CMakeLists.txt b/CMakeLists.txt index bfdd970..da22709 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,6 @@ add_compile_options(-g) add_link_options(-fno-pie -m64 -no-pie -pedantic-errors) #Make a EXE with cpp and asm files -add_library(z tolower.asm strlen.asm strcmp.asm atoi.asm hextoi.asm) +add_library(z tolower.asm strlen.asm strcmp.asm atoi.asm) add_executable(example example.asm) target_link_libraries(example z) diff --git a/example.asm b/example.asm index 1528295..510574e 100644 --- a/example.asm +++ b/example.asm @@ -3,6 +3,7 @@ extern libz_strlen extern libz_strcmp extern libz_tolower extern libz_atoi +extern malloc section .data text2 db "asdasdASDd",0 @@ -60,7 +61,7 @@ _differ: mov rdi, differ cld call puts - jmp _end + jmp _afterdiff @@ -69,6 +70,27 @@ _notdiffer: cld call puts +_afterdiff: + + mov rdi, 20 + cld + call malloc +;i think i just malloced (hopefully) + + xor rcx, rcx +_malloctestloop: + mov [rax], rcx + cmp rcx, 20 + je _end + inc rcx + inc rax + jmp _malloctestloop + + + + + + _end: add rsp, 8 ;exit ret