diff --git a/.gitignore b/.gitignore index 8a3d186..f6da99a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ .DS_Store +# Config +make.config + # Binaries bin/ *.bin @@ -7,9 +10,14 @@ makedisk # Object files *.o +*.out *.obj *.elf +# Font source files +src/fonts/**.asm + # Vim swap files *.swp +*.swo diff --git a/include/screen/text.h b/include/screen/text.h index e13f44f..c8fdd07 100644 --- a/include/screen/text.h +++ b/include/screen/text.h @@ -10,8 +10,8 @@ typedef union { struct { uint8_t width; - uint8_t height - } __attribute__ ((packed)) info; + uint8_t height; + }; uint8_t data[4096]; } __attribute__ ((packed)) font_t; @@ -19,8 +19,8 @@ typedef union { void drawChar(char c, uint32_t x, uint32_t y, uint32_t fgColor, uint32_t bgColor) { // Font info font_t* font = (font_t*)FONT_LOC; - uint8_t charWidth = font->info.width; - uint8_t charHeight = font->info.height; + uint8_t charWidth = font->width; + uint8_t charHeight = font->height; // uint8_t bitmapRowLen = (charWidth - 1) / 8 + 1; // TODO: Larger font support // Video stuff @@ -28,7 +28,7 @@ void drawChar(char c, uint32_t x, uint32_t y, uint32_t fgColor, uint32_t bgColor uint8_t* vidmem = (uint8_t*)gfxMode->physicalBasePtr; uint32_t offset = (gfxMode->xRes * y * charHeight + x * charWidth) * bytesPerPx; - char* bitmap = &font.data[(c - 1) * charHeight]; + uint8_t* bitmap = &font->data[(c - 1) * charHeight]; for (uint8_t i = 0; i < charHeight; i++) { // Rows char bitmapRow = bitmap[i]; uint32_t color = convertColor((bitmapRow & 0x80) ? fgColor : bgColor); @@ -48,7 +48,7 @@ void drawChar(char c, uint32_t x, uint32_t y, uint32_t fgColor, uint32_t bgColor } void scroll() { // TODO: Make this faster (still kinda slow, but memcpy32() helped alot) - uint8_t charHeight = *(uint8_t*)FONT_HEIGHT; + uint8_t charHeight = ((font_t*)FONT_LOC)->height; if (terminal->y+1 < terminal->height) { return; } // Check if we should scroll uint32_t bytesPerLine = charHeight * gfxMode->bytesPerScanline; diff --git a/include/terminal/terminal.h b/include/terminal/terminal.h index 02113e7..793222d 100644 --- a/include/terminal/terminal.h +++ b/include/terminal/terminal.h @@ -24,8 +24,8 @@ terminal_t* terminal = (terminal_t*)TERMINAL_INFO_LOC; #include // This needs to be here because it uses 'terminal' and otherwise it would be undeclared int32_t terminalWrite(const void* buf, uint32_t len) { - terminal->width = gfxMode->xRes / *(uint8_t*)FONT_WIDTH; - terminal->height = gfxMode->yRes / *(uint8_t*)FONT_HEIGHT; + terminal->width = gfxMode->xRes / *(uint8_t*)(FONT_LOC); + terminal->height = gfxMode->yRes / *(uint8_t*)(FONT_LOC+1); char* str = (char*)buf; uint32_t i; diff --git a/kern.iso b/kern.iso index 5f7c6d2..0d4121c 100644 Binary files a/kern.iso and b/kern.iso differ diff --git a/src/kernel.c b/src/kernel.c index 6bd4468..daa0d5c 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -93,8 +93,6 @@ void main() { // Run Interactive Shell Program // TODO: Make it in another file while (1) { - for (size_t i = 0; i < 0x20; i++) drawChar(0x70+i, i, 0, FG_COLOR, BG_COLOR); - printf("\e[6M\x80"); printf("\e[6M\e[8N%s \e[2M%s \e[8M", cwd, PROMPT); char input[256]; char* inputPtr = input;