/[gxemul]/upstream/0.3.4/doc/hello_mips.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /upstream/0.3.4/doc/hello_mips.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (hide annotations)
Mon Oct 8 16:18:31 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 543 byte(s)
0.3.4
1 dpavlin 2 /* 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