2019-05-30 12:44:56 +02:00
|
|
|
; The OS/K Team licenses this file to you under the MIT license.
|
2019-05-29 19:05:06 +02:00
|
|
|
; See the LICENSE file in the project root for more information.
|
2019-05-22 18:39:46 +02:00
|
|
|
|
2019-05-29 18:26:28 +02:00
|
|
|
;
|
2019-05-30 18:31:50 +02:00
|
|
|
; int strlen(char *)
|
2019-05-29 18:26:28 +02:00
|
|
|
;
|
2019-05-30 18:31:50 +02:00
|
|
|
strlen:
|
|
|
|
xor rax, rax
|
2019-05-29 16:57:22 +02:00
|
|
|
|
2019-05-30 11:19:16 +02:00
|
|
|
.1:
|
2019-05-30 11:20:09 +02:00
|
|
|
test b[ax0], b[ax0]
|
2019-05-30 11:19:16 +02:00
|
|
|
jz .2
|
2019-05-30 18:31:50 +02:00
|
|
|
|
|
|
|
inc rax
|
2019-05-29 18:26:28 +02:00
|
|
|
inc ax0
|
2019-05-30 18:31:50 +02:00
|
|
|
jmp .1
|
2019-05-29 16:57:22 +02:00
|
|
|
|
2019-05-30 11:19:16 +02:00
|
|
|
.2:
|
2019-05-29 16:57:22 +02:00
|
|
|
ret
|
|
|
|
|
2019-05-29 18:26:28 +02:00
|
|
|
;
|
2019-05-30 18:31:50 +02:00
|
|
|
; int strnlen(char *, int)
|
2019-05-29 18:26:28 +02:00
|
|
|
;
|
2019-05-30 18:31:50 +02:00
|
|
|
strnlen:
|
|
|
|
xor rax, rax
|
2019-05-30 12:19:38 +02:00
|
|
|
mov rcx, ax1
|
2019-05-30 18:31:50 +02:00
|
|
|
jcxz .2
|
|
|
|
dec rcx
|
2019-05-29 18:26:28 +02:00
|
|
|
|
2019-05-30 11:19:16 +02:00
|
|
|
.1:
|
2019-05-30 18:31:50 +02:00
|
|
|
test b[ax0], b[ax0]
|
|
|
|
jz .2
|
|
|
|
|
|
|
|
inc rax
|
2019-05-29 16:57:22 +02:00
|
|
|
inc ax0
|
2019-05-30 11:19:16 +02:00
|
|
|
loop .1
|
2019-05-29 18:26:28 +02:00
|
|
|
|
2019-05-30 18:31:50 +02:00
|
|
|
.2:
|
2019-05-22 18:39:46 +02:00
|
|
|
ret
|