From 1395dc42159d52ba36524fabe805897cd20bd01e Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Fri, 15 Oct 2021 22:41:18 +0200 Subject: Adding string.h & printf() --- src/vga.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/vga.c') diff --git a/src/vga.c b/src/vga.c index 71faa1a..f176d70 100644 --- a/src/vga.c +++ b/src/vga.c @@ -1,14 +1,31 @@ #include #include #include -#include"vga.h" +#include"string.h" static const size_t VGA_WIDTH = 80; static const size_t VGA_HEIGHT = 25; extern char ioport_in(uint8_t port); extern void ioport_out(uint8_t port, char data); -bool stringcmp(char *str1,char *str2); +enum vga_color { + VGA_COLOR_BLACK = 0, + VGA_COLOR_BLUE = 1, + VGA_COLOR_GREEN = 2, + VGA_COLOR_CYAN = 3, + VGA_COLOR_RED = 4, + VGA_COLOR_MAGENTA = 5, + VGA_COLOR_BROWN = 6, + VGA_COLOR_LIGHT_GREY = 7, + VGA_COLOR_DARK_GREY = 8, + VGA_COLOR_LIGHT_BLUE = 9, + VGA_COLOR_LIGHT_GREEN = 10, + VGA_COLOR_LIGHT_CYAN = 11, + VGA_COLOR_LIGHT_RED = 12, + VGA_COLOR_LIGHT_MAGENTA = 13, + VGA_COLOR_LIGHT_BROWN = 14, + VGA_COLOR_WHITE = 15, +}; static inline uint8_t vga_entry_color(enum vga_color fg, enum vga_color bg) { @@ -80,6 +97,14 @@ void terminal_writestring(const char* data) for(int i=0;data[i]!='\0';i++) terminal_putchar(data[i]); } +void terminal_writeint(const uint32_t num) +{ + char string[100]; + char *str=string; + itos(str,num); + terminal_writestring(str); +} + void prompt() { terminal_writestring("[user@myos] > "); -- cgit v1.2.3