mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Bird from egypt
This commit is contained in:
@@ -34,8 +34,6 @@
|
||||
|
||||
// Font area 0x4000 - 0x4fff
|
||||
#define FONT_LOC 0x4000
|
||||
#define FONT_WIDTH (FONT_LOC)
|
||||
#define FONT_HEIGHT (FONT_LOC + 1)
|
||||
|
||||
// VBE Info Area 0x6000 - 0x6fff
|
||||
#define MODE_INFO_BLOCK_LOC 0x6000 // 512 Bytes
|
||||
|
||||
+12
-4
@@ -7,12 +7,20 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t width;
|
||||
uint8_t height
|
||||
} __attribute__ ((packed)) info;
|
||||
uint8_t data[4096];
|
||||
} __attribute__ ((packed)) font_t;
|
||||
|
||||
// TODO: Reimplement larger text
|
||||
void drawChar(char c, uint32_t x, uint32_t y, uint32_t fgColor, uint32_t bgColor) {
|
||||
// Font info
|
||||
char* font = (char*)FONT_LOC;
|
||||
uint8_t charWidth = *(uint8_t*)FONT_WIDTH;
|
||||
uint8_t charHeight = *(uint8_t*)FONT_HEIGHT;
|
||||
font_t* font = (font_t*)FONT_LOC;
|
||||
uint8_t charWidth = font->info.width;
|
||||
uint8_t charHeight = font->info.height;
|
||||
// uint8_t bitmapRowLen = (charWidth - 1) / 8 + 1; // TODO: Larger font support
|
||||
|
||||
// Video stuff
|
||||
@@ -20,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[((c % 128) - 1) * charHeight];
|
||||
char* 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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -93,7 +93,8 @@ void main() {
|
||||
// Run Interactive Shell Program
|
||||
// TODO: Make it in another file
|
||||
while (1) {
|
||||
printf("\e[6M\x7f\x80\n");
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user