made diff its own function
This commit is contained in:
parent
015f460d7f
commit
1ffb79454b
2 changed files with 40 additions and 27 deletions
31
diff.asm
31
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:
|
||||
|
|
36
inc/diff_func.inc
Normal file
36
inc/diff_func.inc
Normal 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
|
Loading…
Reference in a new issue