From e6d0d6aebcb11d87b1a343f530a83190f39a787f Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 2 Oct 2021 13:33:46 -0400 Subject: [PATCH] Balls --- .gitmodules | 3 +++ CMakeLists.txt | 9 +++++++-- case.asm | 5 ++--- diff.asm | 11 +++++------ inc/case_func.inc | 33 --------------------------------- inc/diff_func.inc | 42 ------------------------------------------ inc/length_func.inc | 17 ----------------- length.asm | 6 ++---- lib/zombie-lib | 1 + 9 files changed, 20 insertions(+), 107 deletions(-) create mode 100644 .gitmodules delete mode 100644 inc/case_func.inc delete mode 100644 inc/diff_func.inc delete mode 100644 inc/length_func.inc create mode 160000 lib/zombie-lib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ce228fe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/zombie-lib"] + path = lib/zombie-lib + url = ssh://git@play.qtechofficial.com:9940/ZNG_Zombie-Not-GNU/zombie-lib.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 0eb9155..d6cfb38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project (yes) +project (zombie-core-utils) #set(CMAKE_ASM_NASM_LINK_EXECUTABLE ld) @@ -13,6 +13,7 @@ set(CMAKE_ASM_NASM_LINK_EXECUTABLE "gcc add_compile_options(-g) +add_subdirectory(lib/zombie-lib) add_link_options(-fno-pie -m64 -no-pie -pedantic-errors) @@ -21,4 +22,8 @@ add_executable(length length.asm) add_executable(yes yes.asm) add_executable(case case.asm) add_executable(diff diff.asm) -add_executable(arg arg.asm) +# add_executable(arg arg.asm) + +target_link_libraries(length z) +target_link_libraries(case z) +target_link_libraries(diff z) diff --git a/case.asm b/case.asm index 8e6c6dc..8a6962b 100644 --- a/case.asm +++ b/case.asm @@ -1,6 +1,5 @@ extern puts -%include "../inc/case_func.inc" -global case_func +extern libz_tolower section .data @@ -23,7 +22,7 @@ main: mov rdi, [tempstore] - call case_func ;case_func modifies the text you send it + call libz_tolower ;libz_tolower modifies the text you send it mov rdi, [tempstore] cld diff --git a/diff.asm b/diff.asm index 521b709..a41be61 100644 --- a/diff.asm +++ b/diff.asm @@ -1,6 +1,5 @@ extern puts - -%include "../inc/diff_func.inc" +extern libz_strcmp section .data tempstore db 0 @@ -28,12 +27,12 @@ main: mov rdi, [tempstore] mov rsi, [tempstore2] - call diff_func + call libz_strcmp cmp r10b, 1 ;why tf did i make ut r10b as the return like tf?!?!?!? jz _notdiffer - + _differ: mov rdi, differ cld @@ -48,10 +47,10 @@ _notdiffer: _end: add rsp, 8 ;exit ret - + _argument_error: mov rdi, argument_error cld call puts - + jmp _end diff --git a/inc/case_func.inc b/inc/case_func.inc deleted file mode 100644 index b6c28f6..0000000 --- a/inc/case_func.inc +++ /dev/null @@ -1,33 +0,0 @@ -%include "../inc/length_func.inc" - -case_func: - mov r11, rdi - - ;length_funcx accepts r8 - call length_func - mov r10, rax - - - xor rcx, rcx ;we do this to clear rcx incase it had garbage in it before -_loop: - ;do loop things - - mov r9, r11 - add r9, rcx - - mov r8b, [r9] ;this block here makes sure that our character is a capital letter and if its not a capital letter do nothing and return - cmp r8b, 90 - ja _endloop - cmp r8b, 65 - jb _endloop - - add r8b, 32 ;make the letter capital - mov [r9], r8b - -_endloop: - ;end loop - inc rcx - cmp rcx, r10 - jle _loop - - ret diff --git a/inc/diff_func.inc b/inc/diff_func.inc deleted file mode 100644 index b125093..0000000 --- a/inc/diff_func.inc +++ /dev/null @@ -1,42 +0,0 @@ - -diff_func: - xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before) - mov r8, rdi - mov r9, rsi -_loopwasp12bsharknado: -;loop tings - - mov rdi, r8 - mov rsi, r9 - - - add rdi, rcx - add rsi, rcx - - mov r10b, [rdi] - mov r11b, [rsi] - - - - cmp r10b, r11b - jne _differiwikeassembwy - cmp r10b, 0 - je _notdifferiwikeassembwy - cmp r11b, 0 - je _notdifferiwikeassembwy - - - inc rcx - jmp _loopwasp12bsharknado - - - - -_differiwikeassembwy: - mov r10b, 1 - jmp _end123432345 - -_notdifferiwikeassembwy: - mov r10b, 0 -_end123432345: - ret diff --git a/inc/length_func.inc b/inc/length_func.inc deleted file mode 100644 index a61ba72..0000000 --- a/inc/length_func.inc +++ /dev/null @@ -1,17 +0,0 @@ - -length_func: - - mov r10, rdi -_loop67865432: - - mov r9b, [rdi] - cmp r9b, 0 - jz _exitloop4323567 - inc rdi - - jmp _loop67865432 -_exitloop4323567: - - sub rdi, r10 - mov rax, rdi - ret diff --git a/length.asm b/length.asm index e5c83b0..a9eb37f 100644 --- a/length.asm +++ b/length.asm @@ -1,9 +1,7 @@ extern puts extern printf +extern libz_strlen default rel -%include "../inc/length_func.inc" - - section .rodata @@ -30,7 +28,7 @@ main: mov rdi, [tempstore] - call length_func + call libz_strlen mov [testasd], rax diff --git a/lib/zombie-lib b/lib/zombie-lib new file mode 160000 index 0000000..b5e1d53 --- /dev/null +++ b/lib/zombie-lib @@ -0,0 +1 @@ +Subproject commit b5e1d53f010a65710144608018bd0274315988a5