2 ; Ullrich von Bassewitz, 31.05.1998
3 ; Christian Krueger: 12-Aug-2013, minor optimizations
5 ; char* strncat (char* dest, const char* src, size_t n);
10 .importzp ptr1, ptr2, ptr3, tmp1, tmp2
13 eor #$FF ; one's complement to count upwards
24 sta ptr3 ; remember for function return
27 tay ; low byte as offset in Y
28 .if (.cpu .bitand ::CPU_ISET_65SC02)
32 stx ptr2 ; destination on page boundary
44 ; end found, apply offset to dest ptr and reset y
47 ; copy src. We've put the ones complement of the count into the counter, so
48 ; we'll increment the counter on top of the loop
51 ldx tmp1 ; low counter byte
66 ; done, set the trailing zero and return pointer to dest