EttinOS/source/cmpstr.inc

43 lines
488 B
PHP

;Compares strings from si and di and sets the carry flag if they are equal and clears it if not.
cmpstr:
;Store the initial registers in the stack
pusha
.loop:
;Load characters
mov al, [si]
mov bl, [di]
;Compare the characters
cmp al, bl
;Check for difference
jne .neq
;Check for the string end
cmp al, 0x0
je .eq
;Repeat
inc si
inc di
jmp .loop
.neq:
;Clear the carry flag
clc
jmp .done
.eq:
;Set the carry flag
stc
.done:
;Load the initial registers from the stack
popa
ret