-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathprintint32.as
More file actions
29 lines (24 loc) · 1.04 KB
/
printint32.as
File metadata and controls
29 lines (24 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/********************************* printint32.as *****************************
* Author: Agner Fog
* date created: 2018-03-23
* Last modified: 2018-03-23
* Version: 1.00
* Project: ForwardCom library libc.li
* Description: printint32: print integer to stdout
* C declaration: void printint32 (int32_t x)
*
* Copyright 2018 GNU General Public License http://www.gnu.org/licenses
*****************************************************************************/
data section datap align = 8
parlist: int64 0 // parameter list
format: int8 "%i",0 // format string
data end
extern _printf: function
code section execute align = 4 // code section
_printint32 function public
int32 [parlist] = r0 // save x in parameter list
int64 r0 = address([format]) // first parameter is format string
int64 r1 = address([parlist]) // parameter list
jump _printf // tail call to _printf
_printint32 end
code end