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
23 sta ptr3 ; remember for function return
26 tay ; low byte as offset in Y
27 .if (.cpu .bitand ::CPU_ISET_65SC02)
31 stx ptr2 ; destination on page boundary
43 ; end found, apply offset to dest ptr and reset y
46 ; copy src. We've put the ones complement of the count into the counter, so
47 ; we'll increment the counter on top of the loop
50 ldx tmp1 ; low counter byte
65 ; done, set the trailing zero and return pointer to dest