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

Subversion Repositories forwardcom

[/] [forwardcom/] [libraries/] [print_string_light.as] - Blame information for rev 160

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

Line No. Rev Author Line
1 99 Agner
/*********************************  print_string_light.as *****************************
2
* Author:        Agner Fog
3
* date created:  2021-05-16
4
* Last modified: 2021-05-16
5
* Version:       1.11
6
* Project:       ForwardCom library libc_light.li
7
* Description:   puts: print a string to stdout. Does not append linefeed
8
* This version is for CPUs with limited capabilities
9
* C declaration: const char * print_string (const char * str);
10
*
11
* Copyright 2021 GNU General Public License http://www.gnu.org/licenses
12
******************************************************************************/
13
 
14
code section execute align = 4                   // code section
15
 
16
// Prints a string to stdout. Same as _puts, but does not append newline
17
// Returns a pointer to the first character after the string
18
 
19
_print_string function public reguse=3,0
20
if (int64 r0 != 0) {  // check for null pointer
21
    while (true) {    // loop through string
22
        int8 r1 = [r0]             // read character
23
        int64 r0++                 // next character
24
        if (int8 r1 == 0) {break}  // end of string
25
        int8 output(r1, r1, 10);   // output character
26
    }
27
}
28
return
29
_print_string end
30
 
31
 
32
code end

powered by: WebSVN 2.1.0

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