This repository has been archived on 2021-01-14. You can view files and clone it, but cannot push or open issues or pull requests.
xed/lib/___strreverse.s
2020-09-19 22:16:34 +02:00

31 lines
373 B
ArmAsm

#code _CODE
;
;void __reverse(char *beg, char *end);
;
___strreverse::
pop bc
pop de
pop hl
push hl
push de
push bc
;
;in: HL - pointer to end of string (null symbol), DE - pointer to start of string
;
___strreverse_reg::
jr 110$
100$:
add hl, de
ld a, (de)
ld c, (hl)
ld (hl), a
ld a, c
ld (de), a
inc de
110$:
dec hl
or a, a
sbc hl, de
jr NC, 100$
ret