kvisc/dos/str/strrev.k

37 lines
480 B
Plaintext
Raw Normal View History

2019-05-30 18:31:50 +02:00
; The OS/K Team licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
;
; void strrev(char *buf, const char *str)
;
strrev:
test b[ax1], b[ax1]
cmovz b[ax0], 0
jz .4
2019-05-30 18:36:06 +02:00
; save str's location
mov rdx, ax1
2019-05-30 18:31:50 +02:00
.1:
test b[ax1+1], b[ax1+1]
jz .2
inc ax1
jmp .1
.2:
mov b[ax0], b[ax1]
2019-05-30 18:36:06 +02:00
cmp ax1, rdx
je .3
2019-05-30 18:31:50 +02:00
inc ax0
dec ax1
jmp .2
.3:
mov b[ax0+1], 0
.4:
ret