Parent Directory | Revision Log
0.3.4
1 | /* MIPS Hello World for GXemul */ |
2 | |
3 | /* Note: The cast to a signed int causes the address to be sign-extended |
4 | correctly to 0xffffffffb00000xx when compiled in 64-bit mode */ |
5 | #define PUTCHAR_ADDRESS ((signed int)0xb0000000) |
6 | #define HALT_ADDRESS ((signed int)0xb0000010) |
7 | |
8 | void printchar(char ch) |
9 | { |
10 | *((volatile unsigned char *) PUTCHAR_ADDRESS) = ch; |
11 | } |
12 | |
13 | void halt(void) |
14 | { |
15 | *((volatile unsigned char *) HALT_ADDRESS) = 0; |
16 | } |
17 | |
18 | void printstr(char *s) |
19 | { |
20 | while (*s) |
21 | printchar(*s++); |
22 | } |
23 | |
24 | void f(void) |
25 | { |
26 | printstr("Hello world\n"); |
27 | halt(); |
28 | } |
ViewVC Help | |
Powered by ViewVC 1.1.26 |