Files
ace-dent 9ca506ed15 programs/system: Post-SVN tidy (part 2) (#410)
- Move source code from `trunk` into root directory for each program.
- Update build files and ASM include paths. Add SPDX license header where appropriate.
- Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden.

(Work towards #75, point 3)

Reviewed-on: KolibriOS/kolibrios#410
Reviewed-by: Ivan B <dunkaist@gmail.com>
Reviewed-by: Burer <burer@kolibrios.org>
Co-authored-by: Andrew <dent.ace@gmail.com>
Co-committed-by: Andrew <dent.ace@gmail.com>
2026-04-09 18:57:52 +00:00

95 lines
2.3 KiB
FASM

;****************************************
;* input: esi = pointer to string *
;* output: ecx = length of the string *
;****************************************
strlen:
push eax esi
xor ecx, ecx
@@:
lodsb
or al, al
jz @f
inc ecx
jmp @b
@@:
pop esi eax
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;* ecx = number of bytes to copy *
;*************************************************
strncpy:
push eax ecx esi edi
@@:
lodsb
stosb
or al, al
jz @f
dec ecx
jz @f
jmp @b
@@:
pop edi esi ecx eax
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;*************************************************
strcpy:
push esi edi
rep movsb
pop edi esi
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;*************************************************
strcat:
push esi
call strlen
add esi, ecx
call strcpy
pop esi
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;* ecx = number of bytes to copy *
;*************************************************
strncat:
push edi
push ecx esi
mov esi, edi
call strlen
add edi, ecx
pop esi ecx
call strncpy
pop edi
ret
;*************************************************
;* input: edi = pointer to the dest string *
;* al = byte to set the string to *
;*************************************************
;strset:
; push edi
; rep stosb
; pop edi
; ret
;*************************************************
;* input: edi = pointer to the dest string *
;* al = byte to set the string to *
;* ecx = number of bytes to set *
;*************************************************
strnset:
push edi ecx
rep stosb
pop ecx edi
ret