diff --git a/README.md b/README.md index e1ef171..d1bf7ec 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ After that, you can build iceOS just by running the command listed below. 2. Type `make run` to start it in QEMU or `make bochs` to start it with bochs(only for debug purposes). You can also find a ISO file -[here](https://github.com/ice-bit/iceOS/raw/master/imgs/iceOS.iso)(md5sum: `342691301699a73102fa6a57abea6989`) +[here](https://github.com/ice-bit/iceOS/raw/master/imgs/iceOS.iso)(md5sum: `5a969460e63eb5c4dcfa943dc2a3f39f`) ## Features iceOS has the following features: @@ -48,7 +48,7 @@ iceOS has the following features: - [ ] Usermode ## Tutorial -I'm also writing a tutorial about this project. If you are interested about OS development and you're looking for a detailed _step-by-step_ tutorial, have a look at my [website](https://osdev.marcocetica.com). +I'm also writing a tutorial about this project. If you are interested about OS development and you're looking for a detailed _step-by-step_ tutorial, have a look at my [website](https://marcocetica.com/bl). ## License diff --git a/imgs/iceOS.iso b/imgs/iceOS.iso index 8b6e845..073eeae 100644 Binary files a/imgs/iceOS.iso and b/imgs/iceOS.iso differ diff --git a/imgs/screenshot.png b/imgs/screenshot.png index 4ba687f..3b4291f 100644 Binary files a/imgs/screenshot.png and b/imgs/screenshot.png differ diff --git a/kernel/drivers/tty.c b/kernel/drivers/tty.c index 1fe306d..f95fce1 100644 --- a/kernel/drivers/tty.c +++ b/kernel/drivers/tty.c @@ -22,7 +22,7 @@ void move_cursor(uint16_t pos) { outb(VGA_DATA_PORT, pos & 0x00FF); } -void cursor_adv() { +void cursor_adv() { // TODO: specify number of adv. with a parameter if(fb_col < VGA_WIDTH - 1) fb_col++; else @@ -57,6 +57,8 @@ void kprint_c(uint8_t *buf, uint32_t len, uint8_t fg, uint8_t bg) { uint8_t c = buf[i]; if(c == '\n' || c == '\r') newline(); + else if(c == '\t') + tab(); else { pos = fb_col + (fb_row * VGA_WIDTH); write_cell(pos, (uint8_t)c, fg, bg); @@ -125,4 +127,9 @@ void newline() { fb_col = 1; move_cursor(fb_col + (fb_row * VGA_WIDTH)); -} \ No newline at end of file +} + +void tab() { + for(uint8_t i = 0; i < 4; i++) + cursor_adv(); // Increment cursor 4 times +} diff --git a/kernel/drivers/tty.h b/kernel/drivers/tty.h index 67cb7e2..2ae4fe5 100644 --- a/kernel/drivers/tty.h +++ b/kernel/drivers/tty.h @@ -46,7 +46,8 @@ enum TTY_COLORS { #define VGA_HIGH_BYTE 14 #define VGA_LOW_BYTE 15 -/* Kernel's VGA API */ +/* Kernel's VGA API */ +// FIXME: Set these functions to static void write_cell(int16_t i, uint8_t c, uint8_t fg, uint8_t bg); void move_cursor(uint16_t pos); void cursor_adv(); @@ -59,5 +60,6 @@ void clear_prompt(); void clear_row(uint8_t row); void scroll(); // Scroll one row void newline(); +void tab(); -#endif \ No newline at end of file +#endif diff --git a/kernel/kernel_main.c b/kernel/kernel_main.c index 659628c..495aef5 100644 --- a/kernel/kernel_main.c +++ b/kernel/kernel_main.c @@ -18,43 +18,45 @@ #include +#define PRTOK printf("\n["); printf_color(" OK ", LIGHT_GREEN, BLACK); printf("]"); // Ugly hack to print "[ OK ]" +#define PRTAT printf("\n["); printf_color(" ** ", LIGHT_BROWN, BLACK); printf("]"); // Ugly hack to print "[ * ]" + void kernel_main() { - printf_color("\n[STATUS]", LIGHT_GREEN, BLACK); - printf_color(" - Loading kernel, wait please...", WHITE, BLACK); + printf("Loading kernel, wait please..."); gdt_setup(); // Setup Global Descriptor Table - printf_color("\n[INFO]", LIGHT_CYAN, BLACK); - printf_color(" - Loaded GDT", WHITE, BLACK); + PRTOK + printf(" - Loaded GDT"); idt_setup(); // Setup Interrupt Descriptor Table - printf_color("\n[INFO]", LIGHT_CYAN, BLACK); - printf_color(" - Loaded IDT", WHITE, BLACK); + PRTOK + printf(" - Loaded IDT"); init_timer(1); // Initialize PIT driver - printf_color("\n[INFO]", LIGHT_CYAN, BLACK); - printf_color(" - Loaded PIT", WHITE, BLACK); + PRTOK + printf(" - Loaded PIT"); init_keyboard(); // Initialize keyboard driver - printf_color("\n[INFO]", LIGHT_CYAN, BLACK); - printf_color(" - Loaded PS/2 driver", WHITE, BLACK); + PRTOK + printf(" - Loaded PS/2 driver"); init_paging(); // Initialize paging - printf_color("\n[INFO]", LIGHT_CYAN, BLACK); - printf_color(" - Loaded Paging", WHITE, BLACK); + PRTOK + printf(" - Loaded Paging"); - printf_color("\n[TEST]", LIGHT_BROWN, BLACK); // Testing heap - printf_color(" - Testing heap..\n", LIGHT_BROWN, BLACK); + PRTAT + printf(" - Testing heap...\t"); uint32_t x = kmalloc(32), y = kmalloc(32); printf("x: %x, y: %x", x, y); kfree((void*)y); uint32_t z = kmalloc(8); - printf(", z: %x\n", z); // If z is equal to y, heap's anti-fragmentation algorithm works + printf(", z: %x", z); // If z is equal to y, heap's anti-fragmentation algorithm works ASSERT(z == y); kfree((void*)z), kfree((void*)x); - printf_color("[STATUS]", LIGHT_GREEN, BLACK); - printf_color(" - Heap works!", WHITE, BLACK); + PRTOK + printf(" - Heap works!"); iceos_ascii_logo(); init_prompt(); // Initialize frame buffer diff --git a/kernel/shell/shell.c b/kernel/shell/shell.c index 9351ec5..aa498ca 100644 --- a/kernel/shell/shell.c +++ b/kernel/shell/shell.c @@ -120,10 +120,10 @@ void processCommand(uint8_t *cmd) { void iceos_ascii_logo() { printf_color("\n\n" - "##############################################\n#", + "###################################################\n#", LIGHT_BLUE, BLACK); - printf_color(" iceOS - developed by Marco Cetica (c) 2019 ", + printf_color(" iceOS - developed by Marco Cetica (c) 2019-2020 ", LIGHT_MAGENTA, BLACK); - printf_color("#\n##############################################\n", + printf_color("#\n###################################################\n", LIGHT_BLUE, BLACK); -} \ No newline at end of file +}