From 1ffb79454bfe3c1c542ca958681cb9a74ac7fa4a Mon Sep 17 00:00:00 2001 From: zombie Date: Sun, 19 Sep 2021 12:44:18 -0400 Subject: [PATCH] made diff its own function --- diff.asm | 31 ++++--------------------------- inc/diff_func.inc | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 inc/diff_func.inc diff --git a/diff.asm b/diff.asm index 69da75b..0e6ea39 100644 --- a/diff.asm +++ b/diff.asm @@ -1,47 +1,24 @@ extern puts +%include "../inc/diff_func.inc" + section .data text db "REEEEEEEEEE",0 text2 db "REEEEEEErEE",0 differ db "they differ",0 notdiffer db "they do not differ",0 - textlength dq 0 - text2length dq 0 section .text global main main: sub rsp, 8 ;enter - - xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before) -_loop: -;loop tings - mov r8, text - add r8, rcx - mov r9, text2 - add r9, rcx + call diff_func - mov r10b, [r8] - mov r11b, [r9] - - - - cmp r10b, r11b - jne _differ cmp r10b, 0 - je _notdiffer - cmp r11b, 0 - je _notdiffer - - - - inc rcx - jmp _loop - - + jz _notdiffer _differ: diff --git a/inc/diff_func.inc b/inc/diff_func.inc new file mode 100644 index 0000000..e8ac4b4 --- /dev/null +++ b/inc/diff_func.inc @@ -0,0 +1,36 @@ + +diff_func: + xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before) +_loopwasp12bsharknado: +;loop tings + + add r8, rcx + add r9, rcx + + mov r10b, [r8] + mov r11b, [r9] + + + + 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