diff user/lib.c3 @ 393:6ae782a085e0

Added init program
author Windel Bouwman
date Sat, 17 May 2014 21:17:40 +0200
parents 084cccaa5deb
children
line wrap: on
line diff
--- a/user/lib.c3	Fri May 16 13:05:10 2014 +0200
+++ b/user/lib.c3	Sat May 17 21:17:40 2014 +0200
@@ -3,14 +3,31 @@
 
 /*
 Runtime library.
-
 */
 
-function void print(int txt)
+// 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;
+    }
 }