🏗️」 wip(str*): working on them, strcmp doesn't work the rest does i think

This commit is contained in:
y-syo
2025-12-04 23:19:20 +01:00
parent ac373af745
commit 5d5c7aba23
4 changed files with 108 additions and 0 deletions

32
src/str/ft_strcmp.s Normal file
View File

@@ -0,0 +1,32 @@
section .text
global ft_strcmp
; int ft_strcmp(const char *s1, const char *s2)
ft_strcmp:
mov rax, 0
cmp rdi, 0
je .ret
cmp rsi, 0
je .ret
.loop:
mov r10b, BYTE [rdi]
cmp r10b, BYTE [rsi]
je .end
cmp BYTE [rdi], 0
je .end
cmp BYTE [rsi], 0
je .end
inc rsi
inc rdi
jmp .loop
.end:
mov al, BYTE [rsi]
mov r10b, BYTE [rdi]
sub rax, r10
.ret:
ret