aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/assets/font.c8
-rw-r--r--src/kernel/graphics/font.c12
-rw-r--r--src/kernel/graphics/font.h15
-rw-r--r--src/kernel/graphics/vesa.c8
4 files changed, 20 insertions, 23 deletions
diff --git a/src/assets/font.c b/src/assets/font.c
index 6d89d64..02699d4 100644
--- a/src/assets/font.c
+++ b/src/assets/font.c
@@ -29,7 +29,7 @@ uint16_t cursor[19] = {
uint8_t font_16[758][16] = {
// 32 $20 'SPACE'
// width 8, bbx 0, bby -4, bbw 8, bbh 16
- {0x74, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
// 33 $21 'EXCLAMATION'
// width 8, bbx 0, bby -4, bbw 8, bbh 16
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00},
@@ -2306,7 +2306,7 @@ uint8_t font_16[758][16] = {
uint16_t font_24[758][24] = {
// 32 $20 'SPACE'
// width 12, bbx 0, bby -5, bbw 12, bbh 24
- {0x74, 0x65, 0x73, 0x74, 0x31, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+ {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
// 33 $21 'EXCLAMATION'
// width 12, bbx 0, bby -5, bbw 12, bbh 24
{0x0000, 0x0000, 0x0000, 0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0000, 0x0000, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
@@ -4583,7 +4583,7 @@ uint16_t font_24[758][24] = {
uint16_t font_32[758][32] = {
// 32 $20 'SPACE'
// width 16, bbx 0, bby -6, bbw 16, bbh 32
- {0x74, 0x65, 0x73, 0x74, 0x32, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+ {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
// 33 $21 'EXCLAMATION'
// width 16, bbx 0, bby -6, bbw 16, bbh 32
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
@@ -6855,4 +6855,4 @@ uint16_t font_32[758][32] = {
// 57523 $e0b3 'char57520'
// width 16, bbx 0, bby -6, bbw 16, bbh 32
{0x0001, 0x0003, 0x0006, 0x000C, 0x0018, 0x0030, 0x0060, 0x00C0, 0x0180, 0x0300, 0x0600, 0x0C00, 0x1800, 0x3000, 0x6000, 0xC000, 0xC000, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006, 0x0003, 0x0001}
-};
+}; \ No newline at end of file
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];