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
14 eor #$FF ; one's complement to count upwards
25 sta ptr3 ; remember for function return
28 tay ; low byte as offset in Y
29 .if (.cpu .bitand ::CPU_ISET_65SC02)
33 stx ptr2 ; destination on page boundary
45 ; end found, apply offset to dest ptr and reset y
48 ; copy src. We've put the ones complement of the count into the counter, so
49 ; we'll increment the counter on top of the loop
52 ldx tmp1 ; low counter byte
67 ; done, set the trailing zero and return pointer to dest