diff options
Diffstat (limited to 'src/kernel/graphics')
-rw-r--r-- | src/kernel/graphics/font.c | 12 | ||||
-rw-r--r-- | src/kernel/graphics/font.h | 15 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.c | 8 |
3 files changed, 16 insertions, 19 deletions
diff --git a/src/kernel/graphics/font.c b/src/kernel/graphics/font.c index b2971ec..1e4e666 100644 --- a/src/kernel/graphics/font.c +++ b/src/kernel/graphics/font.c @@ -1,17 +1,17 @@ #include <kernel/fs/marfs/marfs.h> #include <kernel/paging/paging.h> #include <kernel/io/io.h> +#include <kernel/graphics/font.h> #include <mlibc/stdlib/liballoc.h> +#include <kernel/fs/ata_pio.h> void font_install() { uint8_t boot_drive_id = (uint8_t) (*((uint8_t *) 0x9000)); if (boot_drive_id != 0xE0) { - uint32_t *font = (uint32_t *) kmalloc(0x18326); // High quality shit - marfs_read_whole_file(4, (uint8_t *) (font + 4096)); + struct ata_interface *primary_master = new_ata(1, 0x1F0); + marfs_init(primary_master); - for (int i = 0; i < 10; i++) { - serial_write_hex(font[i]); - serial_write("\n"); - } + font = (struct font *) kmalloc(100000); // High quality shit + marfs_read_whole_file(4, (uint8_t *) font); } }
\ No newline at end of file diff --git a/src/kernel/graphics/font.h b/src/kernel/graphics/font.h index 819f882..7778979 100644 --- a/src/kernel/graphics/font.h +++ b/src/kernel/graphics/font.h @@ -7,16 +7,13 @@ #include <stdint.h> -uint16_t cursor[19] = { -}; - -uint8_t font_16[758][16] = { -}; - -uint16_t font_24[758][24] = { -}; +struct font *font; -uint16_t font_32[758][32] = { +struct font { + uint16_t font_32[758][32]; + uint16_t font_24[758][24]; + uint8_t font_16[758][16]; + uint16_t cursor[19]; }; #endif diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index 65d65a5..9563f4f 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -291,9 +291,9 @@ void vesa_draw_char(char ch) uint16_t bitmap = 0; for (int cy = 0; cy <= font_height; cy++) { - if (font_height == 16) bitmap = font_16[ch - 32][cy]; - else if (font_height == 24) bitmap = font_24[ch - 32][cy] >> 4; - else if (font_height == 32) bitmap = font_32[ch - 32][cy]; + if (font_height == 16) bitmap = font->font_16[ch - 32][cy]; + else if (font_height == 24) bitmap = font->font_24[ch - 32][cy] >> 4; + else if (font_height == 32) bitmap = font->font_32[ch - 32][cy]; for (int cx = 0; cx <= font_width + 1; cx++) { if (bitmap & ((1 << font_width) >> cx)) { // Side effect: Smoothness factor! draw[vbe_bpl * cx] = terminal_color[2]; @@ -395,7 +395,7 @@ void vesa_draw_cursor(int x, int y) prev[vbe_bpl * cx] = draw[vbe_bpl * cx]; prev[vbe_bpl * cx + 1] = draw[vbe_bpl * cx + 1]; prev[vbe_bpl * cx + 2] = draw[vbe_bpl * cx + 2]; - if (cursor[cy] & ((1 << 12) >> cx)) { + if (font->cursor[cy] & ((1 << 12) >> cx)) { draw[vbe_bpl * cx] = terminal_color[2]; draw[vbe_bpl * cx + 1] = terminal_color[1]; draw[vbe_bpl * cx + 2] = terminal_color[0]; |