view 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 source

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;
    }
}