OpenCores
URL https://opencores.org/ocsvn/forwardcom/forwardcom/trunk

Subversion Repositories forwardcom

[/] [forwardcom/] [libraries/] [strcat.as] - Blame information for rev 121

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 114 Agner
/*********************************  strcat.as  ********************************
2
* Author:        Agner Fog
3
* date created:  2018-03-25
4
* Last modified: 2018-03-25
5
* Version:       1.00
6
* Project:       ForwardCom library libc.li
7
* Description:   strcat function. Copy zero-terminated string src to the end of string dest
8
* C declaration: char *strcat(char *dest, const char *src)
9
*
10
* Copyright 2018 GNU General Public License http://www.gnu.org/licenses
11
*****************************************************************************/
12
 
13
extern _strlen: function, reguse = 0xF, 0x7
14
extern _memcpy: function, reguse = 0x1F, 1
15
 
16
code section execute align = 4
17
 
18
// r0 = destination
19
// r1 = source
20
_strcat function public reguse = 0xBF, 0x7
21
int64 r5 = r0                // save destination
22
int64 r4 = r1                // save source
23
call _strlen                 // length of destination
24
int64 r7 = r5 + r0           // end of destination
25
int64 r0 = r4
26
call _strlen                 // length of source
27
int64 r2 = r0 + 1            // add 1 for terminating zero
28
int64 r0 = r7
29
int64 r1 = r4
30
call _memcpy
31
int64 r0 = r5                // return destination
32
return
33
_strcat end
34
 
35
code end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.