URL
https://opencores.org/ocsvn/forwardcom/forwardcom/trunk
Subversion Repositories forwardcom
[/] [forwardcom/] [libraries/] [strcpy.as] - Rev 117
Go to most recent revision | Compare with Previous | Blame | View Log
/********************************* strcpy.as ********************************* Author: Agner Fog* date created: 2018-03-25* Last modified: 2018-03-25* Version: 1.00* Project: ForwardCom library libc.li* Description: strcpy function. Copy zero-terminated string* C declaration: char *strcpy(char *dest, const char *src)** Copyright 2018 GNU General Public License http://www.gnu.org/licenses*****************************************************************************/extern _strlen: function, reguse = 0xF, 0x7extern _memcpy: function, reguse = 0x1F, 1code section execute align = 4// r0 = destination// r1 = source_strcpy function public reguse = 0x1F, 0x7push (r0, r1) // save source and destinationint64 r0 = r1call _strlen // length of sourceint64 r2 = r0 + 1 // length including terminating zeropop (r1, r0)jump _memcpy // tail call. return dest in r0 unchanged_strcpy endcode end
Go to most recent revision | Compare with Previous | Blame | View Log
