kern

diff src/vid.c @ 0:662ff2170531

starting the kernel
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 01 Dec 2010 22:02:42 +0200
parents
children ebe5e0e44a9d
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/vid.c	Wed Dec 01 22:02:42 2010 +0200
     1.3 @@ -0,0 +1,26 @@
     1.4 +#include <string.h>
     1.5 +#include "vid.h"
     1.6 +
     1.7 +#define WIDTH	80
     1.8 +#define HEIGHT	25
     1.9 +static uint16_t *vmem = (uint16_t*)0xb8000;
    1.10 +
    1.11 +void clear_scr(void)
    1.12 +{
    1.13 +	memset(vmem, 0, WIDTH * HEIGHT * 2);
    1.14 +}
    1.15 +
    1.16 +void set_cursor(int x, int y)
    1.17 +{
    1.18 +	if(x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) {
    1.19 +		/* disable cursor */
    1.20 +		return;
    1.21 +	}
    1.22 +	/* set cursor position */
    1.23 +}
    1.24 +
    1.25 +void put_char(char c, int x, int y, int fg, int bg)
    1.26 +{
    1.27 +	uint16_t attr = (fg & 0xf) | ((bg & 7) << 4);
    1.28 +	vmem[y * 80 + x] = (uint16_t)c | (attr << 8);
    1.29 +}