Adds strclr()
This commit is contained in:
@@ -4,6 +4,7 @@ section .text
|
||||
global strlen
|
||||
global strcpy
|
||||
global strcat
|
||||
global strclr
|
||||
|
||||
;----- strlen(*str[]) -----;
|
||||
; Gets the length of given string
|
||||
@@ -85,3 +86,19 @@ strcat:
|
||||
mov byte [rdi], EOS
|
||||
mov rax, r8
|
||||
ret
|
||||
|
||||
;----- strclr(*str[], maxLength) -----;
|
||||
; Clears a string by placing [maxLength] EOS into string.
|
||||
; Thus DANGEROUS function: MAKE SURE maxLength IS SIZE OF str[] - greater values WILL cause issues and eventually crashes
|
||||
; Return value: N/A
|
||||
; Used registers:
|
||||
; rdi* (arg) Pointer to str[]
|
||||
; rsi (arg) Length of str[]
|
||||
; rcx* Counter for STOSB
|
||||
; rax* Character storage (AL) for STOSB
|
||||
strclr:
|
||||
mov rcx, rsi
|
||||
xor al, al
|
||||
cld
|
||||
rep stosb
|
||||
ret
|
||||
|
Reference in New Issue
Block a user