Added new startup logger, tab support and new iso image
This commit is contained in:
parent
50dc3ab1c7
commit
0728dc0dbc
|
@ -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).
|
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
|
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
|
## Features
|
||||||
iceOS has the following features:
|
iceOS has the following features:
|
||||||
|
@ -48,7 +48,7 @@ iceOS has the following features:
|
||||||
- [ ] Usermode
|
- [ ] Usermode
|
||||||
|
|
||||||
## Tutorial
|
## 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
|
## License
|
||||||
|
|
BIN
imgs/iceOS.iso
BIN
imgs/iceOS.iso
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -22,7 +22,7 @@ void move_cursor(uint16_t pos) {
|
||||||
outb(VGA_DATA_PORT, pos & 0x00FF);
|
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)
|
if(fb_col < VGA_WIDTH - 1)
|
||||||
fb_col++;
|
fb_col++;
|
||||||
else
|
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];
|
uint8_t c = buf[i];
|
||||||
if(c == '\n' || c == '\r')
|
if(c == '\n' || c == '\r')
|
||||||
newline();
|
newline();
|
||||||
|
else if(c == '\t')
|
||||||
|
tab();
|
||||||
else {
|
else {
|
||||||
pos = fb_col + (fb_row * VGA_WIDTH);
|
pos = fb_col + (fb_row * VGA_WIDTH);
|
||||||
write_cell(pos, (uint8_t)c, fg, bg);
|
write_cell(pos, (uint8_t)c, fg, bg);
|
||||||
|
@ -125,4 +127,9 @@ void newline() {
|
||||||
|
|
||||||
fb_col = 1;
|
fb_col = 1;
|
||||||
move_cursor(fb_col + (fb_row * VGA_WIDTH));
|
move_cursor(fb_col + (fb_row * VGA_WIDTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tab() {
|
||||||
|
for(uint8_t i = 0; i < 4; i++)
|
||||||
|
cursor_adv(); // Increment cursor 4 times
|
||||||
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ enum TTY_COLORS {
|
||||||
#define VGA_HIGH_BYTE 14
|
#define VGA_HIGH_BYTE 14
|
||||||
#define VGA_LOW_BYTE 15
|
#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 write_cell(int16_t i, uint8_t c, uint8_t fg, uint8_t bg);
|
||||||
void move_cursor(uint16_t pos);
|
void move_cursor(uint16_t pos);
|
||||||
void cursor_adv();
|
void cursor_adv();
|
||||||
|
@ -59,5 +60,6 @@ void clear_prompt();
|
||||||
void clear_row(uint8_t row);
|
void clear_row(uint8_t row);
|
||||||
void scroll(); // Scroll one row
|
void scroll(); // Scroll one row
|
||||||
void newline();
|
void newline();
|
||||||
|
void tab();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,43 +18,45 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#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() {
|
void kernel_main() {
|
||||||
printf_color("\n[STATUS]", LIGHT_GREEN, BLACK);
|
printf("Loading kernel, wait please...");
|
||||||
printf_color(" - Loading kernel, wait please...", WHITE, BLACK);
|
|
||||||
|
|
||||||
gdt_setup(); // Setup Global Descriptor Table
|
gdt_setup(); // Setup Global Descriptor Table
|
||||||
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
PRTOK
|
||||||
printf_color(" - Loaded GDT", WHITE, BLACK);
|
printf(" - Loaded GDT");
|
||||||
|
|
||||||
idt_setup(); // Setup Interrupt Descriptor Table
|
idt_setup(); // Setup Interrupt Descriptor Table
|
||||||
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
PRTOK
|
||||||
printf_color(" - Loaded IDT", WHITE, BLACK);
|
printf(" - Loaded IDT");
|
||||||
|
|
||||||
init_timer(1); // Initialize PIT driver
|
init_timer(1); // Initialize PIT driver
|
||||||
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
PRTOK
|
||||||
printf_color(" - Loaded PIT", WHITE, BLACK);
|
printf(" - Loaded PIT");
|
||||||
|
|
||||||
init_keyboard(); // Initialize keyboard driver
|
init_keyboard(); // Initialize keyboard driver
|
||||||
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
PRTOK
|
||||||
printf_color(" - Loaded PS/2 driver", WHITE, BLACK);
|
printf(" - Loaded PS/2 driver");
|
||||||
|
|
||||||
init_paging(); // Initialize paging
|
init_paging(); // Initialize paging
|
||||||
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
PRTOK
|
||||||
printf_color(" - Loaded Paging", WHITE, BLACK);
|
printf(" - Loaded Paging");
|
||||||
|
|
||||||
printf_color("\n[TEST]", LIGHT_BROWN, BLACK); // Testing heap
|
PRTAT
|
||||||
printf_color(" - Testing heap..\n", LIGHT_BROWN, BLACK);
|
printf(" - Testing heap...\t");
|
||||||
|
|
||||||
uint32_t x = kmalloc(32), y = kmalloc(32);
|
uint32_t x = kmalloc(32), y = kmalloc(32);
|
||||||
printf("x: %x, y: %x", x, y);
|
printf("x: %x, y: %x", x, y);
|
||||||
kfree((void*)y);
|
kfree((void*)y);
|
||||||
uint32_t z = kmalloc(8);
|
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);
|
ASSERT(z == y);
|
||||||
kfree((void*)z), kfree((void*)x);
|
kfree((void*)z), kfree((void*)x);
|
||||||
|
|
||||||
printf_color("[STATUS]", LIGHT_GREEN, BLACK);
|
PRTOK
|
||||||
printf_color(" - Heap works!", WHITE, BLACK);
|
printf(" - Heap works!");
|
||||||
|
|
||||||
iceos_ascii_logo();
|
iceos_ascii_logo();
|
||||||
init_prompt(); // Initialize frame buffer
|
init_prompt(); // Initialize frame buffer
|
||||||
|
|
|
@ -120,10 +120,10 @@ void processCommand(uint8_t *cmd) {
|
||||||
|
|
||||||
void iceos_ascii_logo() {
|
void iceos_ascii_logo() {
|
||||||
printf_color("\n\n"
|
printf_color("\n\n"
|
||||||
"##############################################\n#",
|
"###################################################\n#",
|
||||||
LIGHT_BLUE, BLACK);
|
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);
|
LIGHT_MAGENTA, BLACK);
|
||||||
printf_color("#\n##############################################\n",
|
printf_color("#\n###################################################\n",
|
||||||
LIGHT_BLUE, BLACK);
|
LIGHT_BLUE, BLACK);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue