URL
https://opencores.org/ocsvn/forwardcom/forwardcom/trunk
[/] [forwardcom/] [examples/] [hello.as] - Blame information for rev 127
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
127 |
Agner |
/**************************** hello.as **************************************
|
2 |
|
|
* Author: Agner Fog
|
3 |
|
|
* date created: 2018-02-23
|
4 |
|
|
* last modified: 2021-08-04
|
5 |
|
|
* Version: 1.11
|
6 |
|
|
* Project: ForwardCom example, assembly code
|
7 |
|
|
* Description: Hello world example
|
8 |
|
|
*
|
9 |
|
|
* Copyright 2018-2021 GNU General Public License http://www.gnu.org/licenses
|
10 |
|
|
*****************************************************************************/
|
11 |
|
|
|
12 |
|
|
extern _puts: function // library function: write string to stdout
|
13 |
|
|
|
14 |
|
|
const section read ip // read-only data section
|
15 |
|
|
hello: int8 "\nHello ForwardCom world!", 0 // char string with terminating zero
|
16 |
|
|
const end
|
17 |
|
|
|
18 |
|
|
code section execute // executable code section
|
19 |
|
|
|
20 |
|
|
_main function public // program start
|
21 |
|
|
|
22 |
|
|
// breakpoint // uncomment this if you want to wait for user to press run
|
23 |
|
|
|
24 |
|
|
int64 r0 = address([hello]) // calculate address of string
|
25 |
|
|
call _puts // call puts. parameter is in r0
|
26 |
|
|
int r0 = 0 // program return value
|
27 |
|
|
return // return from main
|
28 |
|
|
|
29 |
|
|
_main end
|
30 |
|
|
|
31 |
|
|
code end
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.