aboutsummaryrefslogtreecommitdiff
path: root/src/inc
diff options
context:
space:
mode:
authorMarvin Borner2020-07-25 17:41:54 +0200
committerMarvin Borner2020-07-25 17:41:54 +0200
commit6e8fd8c61a77e4eb08d859f8e0fc42226cc4c7f3 (patch)
treeb0b23183affa278eff2c7c142e89e47dc40d9dd9 /src/inc
parentbe9ade5ac65209277dc18f8eb9b03a55e2b9e6ad (diff)
Added very basic PSF parser
Version 1 works; Version 2 not so much
Diffstat (limited to 'src/inc')
-rw-r--r--src/inc/psf.h48
-rw-r--r--src/inc/vesa.h7
2 files changed, 54 insertions, 1 deletions
diff --git a/src/inc/psf.h b/src/inc/psf.h
new file mode 100644
index 0000000..3394f9c
--- /dev/null
+++ b/src/inc/psf.h
@@ -0,0 +1,48 @@
+// MIT License, Copyright (c) 2020 Marvin Borner
+// PSF parser
+
+#ifndef PSF_H
+#define PSF_H
+
+#include <def.h>
+
+/**
+ * PSF version 1
+ */
+
+#define PSF1_MAGIC_0 0x36
+#define PSF1_MAGIC_1 0x04
+#define PSF1_MODE_256 0
+#define PSF1_MODE_512 1
+#define PSF1_MODE_256_UNICODE 2
+#define PSF1_MODE_512_UNICODE 3
+
+struct psf1_header {
+ u8 magic[2];
+ u8 file_mode;
+ u8 font_height;
+};
+
+/**
+ * PSF version 2
+ */
+
+#define PSF2_MAGIC_0 0x72
+#define PSF2_MAGIC_1 0xb5
+#define PSF2_MAGIC_2 0x4a
+#define PSF2_MAGIC_3 0x86
+
+struct psf2_header {
+ u8 magic[4];
+ u32 version;
+ u32 size;
+ u32 flags;
+ u32 glyph_count;
+ u32 bytes_per_glyph;
+ u32 height;
+ u32 width;
+};
+
+char *psf_parse(char *data);
+
+#endif
diff --git a/src/inc/vesa.h b/src/inc/vesa.h
index c4863f1..e1ea521 100644
--- a/src/inc/vesa.h
+++ b/src/inc/vesa.h
@@ -44,7 +44,12 @@ struct vbe {
};
struct vbe *vbe;
+int vbe_bpl;
+int vbe_pitch;
+u8 *fb;
-void vesa_fill(const u8 color[3]);
+void vesa_fill(const u32 color[3]);
+void vesa_set_pixel(u16 x, u16 y, const u32 color[3]);
+void vesa_init(struct vbe *info);
#endif