summaryrefslogtreecommitdiff
path: root/lib/printk.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/printk.c')
-rw-r--r--lib/printk.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/printk.c b/lib/printk.c
new file mode 100644
index 0000000..e2ae612
--- /dev/null
+++ b/lib/printk.c
@@ -0,0 +1,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++;
+ }
+
+ }
+}