From 6e8fd8c61a77e4eb08d859f8e0fc42226cc4c7f3 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 25 Jul 2020 17:41:54 +0200 Subject: Added very basic PSF parser Version 1 works; Version 2 not so much --- src/inc/psf.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/inc/vesa.h | 7 ++++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/inc/psf.h (limited to 'src/inc') 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 + +/** + * 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 -- cgit v1.2.3