view lib/alib/strncpy.a @ 2765:0bd16cca86b7

Updated rules.mak for all the os9 format's to format the entire disk. People were having some issues with the disk images not being formatted to their full capacity and preventing some functions from working.
author drencor-xeen
date Thu, 17 Jan 2013 11:03:26 -0600
parents 7d70b7e1cb21
children aaba193af04f
line wrap: on
line source

**********************************

* STRNCPY: copy N bytes of a null terminated string
*          User must ensure there is room in buffer!!!
*          If N>string length only N bytes will be moved

* OTHER MODULES NEEDED: STRLEN, MEMMOVE

* ENTRY: X=start of string to move
*        Y=buffer for copy of string

* EXIT: D = actual number of bytes moved
*       all other regs preserved (except cc)


 nam Copy partial String
 ttl Assembler Library Module


 psect STRNCPY,0,0,0,0,0

STRNCPY:
 pshs d bytes wanted to move
 lbsr STRLEN find length of string
 addd #1 move NULL also
 cmpd ,s get smaller of passed/actual size
 bls skip use actual leng
 ldd ,s use passed leng²²
skip
 lbsr MEMMOVE move it
 leas 2,s
 rts

 endsect