kern

view 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 source
1 #include <string.h>
2 #include "vid.h"
4 #define WIDTH 80
5 #define HEIGHT 25
6 static uint16_t *vmem = (uint16_t*)0xb8000;
8 void clear_scr(void)
9 {
10 memset(vmem, 0, WIDTH * HEIGHT * 2);
11 }
13 void set_cursor(int x, int y)
14 {
15 if(x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) {
16 /* disable cursor */
17 return;
18 }
19 /* set cursor position */
20 }
22 void put_char(char c, int x, int y, int fg, int bg)
23 {
24 uint16_t attr = (fg & 0xf) | ((bg & 7) << 4);
25 vmem[y * 80 + x] = (uint16_t)c | (attr << 8);
26 }