diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/user/lib/lib.c3	Thu Feb 19 00:13:07 2015 +0100
@@ -0,0 +1,33 @@
+module lib;
+import ipc;
+
+/*
+Runtime library.
+*/
+
+// Hack until something better exists:
+function void putc(int c)
+{
+    var int *UART0DR;
+    UART0DR = cast<int*>(0x109000); // UART0 DR register when remapped at 1MB
+    *UART0DR = c;
+}
+
+function void print(string txt)
+{
+    // TODO
+    var ipc.Msg msg;
+    ipc.SendMessage(&msg);
+
+    // TBD: send text to putc or via send message??
+    var int i;
+    i = 0;
+
+    while (i < txt->len)
+    {
+        putc(cast<int>(txt->txt[i]));
+        i = i + 1;
+    }
+}
+
+