diff options
| author | 0x221E <0x221E@0xinfinity.dev> | 2026-06-11 20:10:31 +0200 |
|---|---|---|
| committer | 0x221E <0x221E@0xinfinity.dev> | 2026-06-11 20:11:56 +0200 |
| commit | 6d559b7e50dbab428d324b4ddaed9db7a8ced887 (patch) | |
| tree | c2e807a19d2d0b6054e13a6d3ece16750796198d /lib/printk.c | |
| download | tmpbootloader-master.tar.gz | |
Diffstat (limited to 'lib/printk.c')
| -rw-r--r-- | lib/printk.c | 36 |
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++; + } + + } +} |
