annotate user/lib/lib.c3 @ 402:0fb6633c42f6

Moved several files to logical locations
author Windel Bouwman
date Thu, 19 Feb 2015 00:13:07 +0100
parents user/lib.c3@6ae782a085e0
children 6aa9743ed362
rev   line source
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
1 module lib;
315
084cccaa5deb Added console and screen
Windel Bouwman
parents: 313
diff changeset
2 import ipc;
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
3
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
4 /*
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
5 Runtime library.
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
6 */
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
7
393
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
8 // Hack until something better exists:
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
9 function void putc(int c)
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
10 {
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
11 var int *UART0DR;
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
12 UART0DR = cast<int*>(0x109000); // UART0 DR register when remapped at 1MB
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
13 *UART0DR = c;
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
14 }
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
15
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
16 function void print(string txt)
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
17 {
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
18 // TODO
315
084cccaa5deb Added console and screen
Windel Bouwman
parents: 313
diff changeset
19 var ipc.Msg msg;
084cccaa5deb Added console and screen
Windel Bouwman
parents: 313
diff changeset
20 ipc.SendMessage(&msg);
393
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
21
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
22 // TBD: send text to putc or via send message??
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
23 var int i;
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
24 i = 0;
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
25
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
26 while (i < txt->len)
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
27 {
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
28 putc(cast<int>(txt->txt[i]));
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
29 i = i + 1;
6ae782a085e0 Added init program
Windel Bouwman
parents: 315
diff changeset
30 }
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
31 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
32
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
33