summaryrefslogtreecommitdiff
path: root/lib/printk.c
blob: e2ae61211040f24e096e41653a28546cdfa38216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <printk.h>

#include <string.h>
#include <vga.h>

#include <stddef.h>

void write(char *s, uint8_t color)
{
	static size_t x BLSEC_DATA = 0;
	static size_t y BLSEC_DATA = 0;
	
	size_t len = strlen(s);
	for (size_t i = 0; i < len; i++) {

		if (s[i] == '\n') {
			y++;
			x = 0;
			continue;
		}
	
		vga_put(x, y, s[i], color);

		if (y >= MAX_HEIGHT)
			return; //TODO: To be implemented.

	
		if (x >= MAX_WIDTH) {
			y++;
			x = 0;
		} else {
			x++;
		}

	}
}