diff --git a/CMakeLists.txt b/CMakeLists.txt index d8fbc06..792af58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,4 +14,4 @@ set(CMAKE_ASM_NASM_LINK_EXECUTABLE "gcc add_link_options(-fno-pie -m64 -no-pie -pedantic-errors) #Make a EXE with cpp and asm files -add_executable(case case.asm) +add_executable(length length.asm) diff --git a/length.asm b/length.asm new file mode 100644 index 0000000..93cc779 --- /dev/null +++ b/length.asm @@ -0,0 +1,45 @@ +extern puts +extern printf +default rel +%include "/home/zombie/Documents/bigdocs/redownloadables/gitshit/nbrooks211/zombie-core-utils/length_func.inc" + + + + +section .rodata + format db "%#x", 10, 0 + +section .data + text db "rEEEeee!EEeeeEeEEeE!EEEEEeEEE$eeeEE)EEeEeEEeeeEeEEEEEeeeEeeEeeEeeeeeEeEeEeeE",0 + textlength db 76 +section .text + global main + +main: + sub rsp, 8 ;enter + + + + push text + call length_func + pop r8 + + + + + mov rdi, text + cld + call puts ;this is the puts way of printing a string + + + mov rsi, r8 + lea rdi, [rel format] + xor eax, eax ; AL=0 no FP args in XMM regs + call printf + + + + +_end: + add rsp, 8 ;exit + ret diff --git a/length_func.inc b/length_func.inc new file mode 100644 index 0000000..187ec1c --- /dev/null +++ b/length_func.inc @@ -0,0 +1,20 @@ + +length_func: + pop r8 +_loop67865432: + + + mov r9b, [r8] + cmp r9b, 0 + jz _exitloop4323567 + inc r8 + + jmp _loop67865432 +_exitloop4323567: + dec r8 ; idk how to do it properly do im doing this instead + + + + + push r8 + ret