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