1 2; char *strncpy(char * restrict s1, const char * restrict s2, size_t n) 3 4SECTION code_clib 5SECTION code_string 6 7PUBLIC strncpy 8 9EXTERN asm_strncpy 10 11strncpy: 12IF __CPU_GBZ80__ | __CPU_INTEL__ 13 ld hl,sp+2 14 ld c,(hl) 15 inc hl 16 ld b,(hl) 17 inc hl 18 ld e,(hl) 19 inc hl 20 ld d,(hl) 21 inc hl 22 ld a,(hl+) 23 ld h,(hl) 24 ld l,e 25 ld e,a 26 ld a,d 27 ld d,h 28 ld h,a 29 call asm_strncpy 30 ld d,h 31 ld e,l 32 ret 33ELSE 34 35 pop af 36 pop bc 37 pop hl 38 pop de 39 40 push de 41 push hl 42 push bc 43 push af 44 jp asm_strncpy 45ENDIF 46 47 48; SDCC bridge for Classic 49IF __CLASSIC 50PUBLIC _strncpy 51defc _strncpy = strncpy 52ENDIF 53 54