EttinOS/source/cmpstr.inc

32 lines
368 B
PHP

;Compares strings from si and di and sets the carry flag if they are equal and clears it if not.
cmpstr:
;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 cmpstr
.neq:
;Clear the carry flag
clc
ret
.eq:
;Set the carry flag
stc
ret