From bf18c8b3b830e682ce3dc74a87de3923fbc6975d Mon Sep 17 00:00:00 2001 From: zombie Date: Sun, 3 Oct 2021 08:02:46 -0400 Subject: [PATCH] removed inc and the old strnum --- inc/atoi_func.inc | 82 -------------------------------------- inc/length_func.inc | 18 --------- monkie/strnum.asm | 96 --------------------------------------------- 3 files changed, 196 deletions(-) delete mode 100644 inc/atoi_func.inc delete mode 100644 inc/length_func.inc delete mode 100644 monkie/strnum.asm diff --git a/inc/atoi_func.inc b/inc/atoi_func.inc deleted file mode 100644 index d3a5d78..0000000 --- a/inc/atoi_func.inc +++ /dev/null @@ -1,82 +0,0 @@ -%include "../inc/length_func.inc" -atoi_func: - - mov r8, rdi - - - - mov r8, text ;loop setup - - xor r9, r9 - -_loopasd23: - - mov r9b, [r8] - - cmp r9, 0 ;check and see if we have reached the end of the string - jz _exitloopasd12 - - sub r9, 48 - - mov [r8], r9b - inc r8 - jmp _loopasd23 - -_exitloopasd12: - - - - call length_func - mov r8, rax - mov r11, rax - - add r8, rdi - - - mov rcx, 1 -_loop2asd12: - dec r8 - mov al, [r8] - - - mul rcx - mov [r8], al - - - mov rax, rcx - mov r10, 10 - mul r10 - mov rcx, rax - - cmp r8, rdi - je _exitloop2asd12 - jmp _loop2asd12 -_exitloop2asd12: - - mov r8, rdi - mov r9, rdi - inc r9 - -_loop3asd12: - - mov r11b, [r9] - mov r10b, [r8] - cmp r11, 0 - jz _endasdasd23123 - - add r11, r10 - - mov [r9], r11b - mov [r8], r10b - - - inc r8 - inc r9 - - jmp _loop3asd12 - - -_endasdasd23123: - mov rax, [r8] - ret - diff --git a/inc/length_func.inc b/inc/length_func.inc deleted file mode 100644 index 8eb89da..0000000 --- a/inc/length_func.inc +++ /dev/null @@ -1,18 +0,0 @@ - -length_func: - - mov r10, rdi - xor r9, r9 -_loop67865432: - - mov r9, [rdi] - cmp r9, 0 - jz _exitloop4323567 - inc rdi - - jmp _loop67865432 -_exitloop4323567: - - sub rdi, r10 - mov rax, rdi - ret diff --git a/monkie/strnum.asm b/monkie/strnum.asm deleted file mode 100644 index 6a98f1a..0000000 --- a/monkie/strnum.asm +++ /dev/null @@ -1,96 +0,0 @@ -extern puts - -%include "../inc/length_func.inc" - -section .data - text db "42",0 -section .text - global main - -main: - sub rsp, 8 - - - mov rdi, text - call length_func - mov r9, rax - mov r11, r9 - - mov r8, text - - xor r10, r10 - xor r11, r11 -_loop: - mov r10, [r8] - cmp r10, 0 - jz _exitloop ;if its zero we have reached the end of the string - - - mov r10, [r8] - sub r10, 48 ; change "0" into 0 - mov [r8], r10 - - - add r8, 1 - jmp _loop - - - xor rcx, rcx - add rcx, 1 -_exitloop: - cmp r9, r8 - je _addvalues - - - - mov r10, r9 - - mov rax, r10 - mul rcx - mov r10, rax - - mov [r9], r10 - - sub r9, 1 - - mov rdi, 10 - mov rax, rcx - mul rdi - mov rcx, rax - - jmp _exitloop - - add r9, 1 -_addvalues: - cmp r9, r11 - je _end - - - mov r10, [r8] - mov r11, [r9] - add r11, r10 - mov [r9], r11 - - - - add r8, 1 - add r9, 1 - - jmp _addvalues - ;this returns the r8 pointer - - - - ;mov rdi, text - ;cld - ;call puts ;this is the put s way of printing a string - -_end: - add rsp, 8 - ret - -; mov rax, 60 ; exit -; mov edi, 1 ; error 1 dont need the exit anymore beacue libc or somthing -; syscall - -