made diff its own function

This commit is contained in:
zombie maniac 2021-09-19 12:44:18 -04:00
parent 015f460d7f
commit 1ffb79454b
2 changed files with 40 additions and 27 deletions

View file

@ -1,47 +1,24 @@
extern puts extern puts
%include "../inc/diff_func.inc"
section .data section .data
text db "REEEEEEEEEE",0 text db "REEEEEEEEEE",0
text2 db "REEEEEEErEE",0 text2 db "REEEEEEErEE",0
differ db "they differ",0 differ db "they differ",0
notdiffer db "they do not differ",0 notdiffer db "they do not differ",0
textlength dq 0
text2length dq 0
section .text section .text
global main global main
main: main:
sub rsp, 8 ;enter 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 mov r8, text
add r8, rcx
mov r9, text2 mov r9, text2
add r9, rcx call diff_func
mov r10b, [r8]
mov r11b, [r9]
cmp r10b, r11b
jne _differ
cmp r10b, 0 cmp r10b, 0
je _notdiffer jz _notdiffer
cmp r11b, 0
je _notdiffer
inc rcx
jmp _loop
_differ: _differ:

36
inc/diff_func.inc Normal file
View file

@ -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