From: Lawrence S. <ljs...@us...> - 2020-06-11 01:03:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ff76e28d68ac374e485c9cf6f60032f6158e5a69 (commit) from c5e27069604dc95ff062a1d97ccb05f0dd760f63 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ff76e28d68ac374e485c9cf6f60032f6158e5a69 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jun 10 21:02:57 2020 -0400 Add mini font for use when you really don't want the biosfont for some reason. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/util/Makefile | 12 ++- kernel/arch/dreamcast/util/minifont.c | 55 ++++++++++ kernel/arch/dreamcast/util/minifont.h | 194 ++++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+), 5 deletions(-) create mode 100644 kernel/arch/dreamcast/util/minifont.c create mode 100644 kernel/arch/dreamcast/util/minifont.h diff --git a/kernel/arch/dreamcast/util/Makefile b/kernel/arch/dreamcast/util/Makefile index 7ad99ce..5628834 100644 --- a/kernel/arch/dreamcast/util/Makefile +++ b/kernel/arch/dreamcast/util/Makefile @@ -1,12 +1,14 @@ # KallistiOS ##version## # # arch/dreamcast/util/Makefile -# (c)2001 Dan Potter +# Copyright (C) 2001 Dan Potter # -OBJS = vmu_pkg.o screenshot.o fb_console.o -SUBDIRS = - -include $(KOS_BASE)/Makefile.prefab +OBJS = vmu_pkg.o screenshot.o minifont.o +SUBDIRS = +ifneq ($(KOS_SUBARCH), naomi) + OBJS += fb_console.o +endif +include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/arch/dreamcast/util/minifont.c b/kernel/arch/dreamcast/util/minifont.c new file mode 100644 index 0000000..0b51407 --- /dev/null +++ b/kernel/arch/dreamcast/util/minifont.c @@ -0,0 +1,55 @@ +/* KallistiOS ##version## + + util/minifont.c + Copyright (C) 2020 Lawrence Sebald + +*/ + +#include <string.h> +#include "minifont.h" + +#define CHAR_WIDTH 8 +#define CHAR_HEIGHT 16 + +#define BYTES_PER_CHAR ((CHAR_WIDTH / 8) * CHAR_HEIGHT) + +int minifont_draw(uint16 *buffer, uint32 bufwidth, uint32 c) { + int pos, i, j, k; + uint8 byte; + uint16 *cur; + + if(c < 33 || c > 126) + return (CHAR_WIDTH / 8); + + pos = (c - 33) * BYTES_PER_CHAR; + + for(i = 0; i < CHAR_HEIGHT; ++i) { + cur = buffer; + + for(j = 0; j < CHAR_WIDTH; ++j) { + byte = minifont_data[pos + j]; + + for(k = 0; k < 8; ++k) { + if(byte & (1 << (7 - k))) + *cur++ = 0xFFFF; + else + ++cur; + } + } + + buffer += bufwidth; + } + + return (CHAR_WIDTH / 8); +} + +int minifont_draw_str(uint16 *buffer, uint32 bufwidth, const char *str) { + char c; + int adv = 0; + + while((c = *str++)) { + adv += minifont_draw(buffer + adv, bufwidth, c); + } + + return adv; +} diff --git a/kernel/arch/dreamcast/util/minifont.h b/kernel/arch/dreamcast/util/minifont.h new file mode 100644 index 0000000..f162f66 --- /dev/null +++ b/kernel/arch/dreamcast/util/minifont.h @@ -0,0 +1,194 @@ +static const int minifont_size = 1504; +static const unsigned char minifont_data[1504] = { + 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x36, 0x36, 0x12, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x7e, 0x24, + 0x24, 0x7e, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x38, 0x54, 0x92, 0x90, 0x50, + 0x3c, 0x12, 0x92, 0x54, 0x38, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x54, 0x28, 0x08, + 0x10, 0x14, 0x2a, 0x24, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x28, 0x10, + 0x28, 0x4a, 0x46, 0x44, 0x4c, 0x32, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, + 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, + 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x54, 0x38, + 0x7c, 0x38, 0x54, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, + 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, + 0x10, 0x20, 0x20, 0x40, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x82, 0x82, 0x86, 0x8a, 0x92, + 0xa2, 0xc2, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x04, 0x04, 0x08, 0x08, + 0x10, 0x10, 0x20, 0x20, 0x40, 0x7e, 0x00, 0x00, + 0x00, 0x18, 0x24, 0x42, 0x02, 0x02, 0x04, 0x18, + 0x04, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00, + 0x00, 0x08, 0x48, 0x48, 0x48, 0x48, 0x7c, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, + 0x00, 0x7e, 0x40, 0x40, 0x40, 0x58, 0x64, 0x42, + 0x02, 0x02, 0x02, 0x42, 0x24, 0x18, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x80, 0x80, 0x80, 0x80, 0xb8, + 0xc4, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x7e, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, + 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x00, 0x00, + 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, + 0x24, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x46, 0x3a, + 0x02, 0x02, 0x02, 0x02, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, + 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, + 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0x24, 0x42, 0x02, 0x04, 0x08, + 0x08, 0x08, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x82, 0x92, 0xaa, 0xaa, + 0xa4, 0x98, 0x80, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x10, 0x28, 0x28, 0x28, 0x28, 0x44, 0x44, + 0x7c, 0x44, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + 0x00, 0xf8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, + 0x84, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x82, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0xe0, 0x90, 0x88, 0x84, 0x84, 0x82, 0x82, + 0x82, 0x84, 0x84, 0x88, 0x90, 0xe0, 0x00, 0x00, + 0x00, 0xfe, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + 0x00, 0xfe, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf8, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x8e, 0x84, 0x84, 0x84, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + 0x00, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, + 0x00, 0x3e, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x88, 0x88, 0x70, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x84, 0x84, 0x88, 0x88, 0xf0, + 0x88, 0x88, 0x84, 0x84, 0x82, 0x82, 0x00, 0x00, + 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0xfe, 0x00, 0x00, + 0x00, 0x82, 0xc6, 0xaa, 0xaa, 0xaa, 0xaa, 0x92, + 0x92, 0x92, 0x82, 0x82, 0x82, 0x82, 0x00, 0x00, + 0x00, 0x82, 0xc2, 0xa2, 0xa2, 0x92, 0x92, 0x92, + 0x92, 0x8a, 0x8a, 0x8a, 0x86, 0x82, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0xf8, 0x84, 0x82, 0x82, 0x84, 0xf8, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x8a, 0x44, 0x3a, 0x00, 0x00, + 0x00, 0xf8, 0x84, 0x82, 0x82, 0x84, 0xf8, 0xc0, + 0xa0, 0x90, 0x90, 0x88, 0x84, 0x82, 0x00, 0x00, + 0x00, 0x38, 0x44, 0x82, 0x80, 0x80, 0x40, 0x38, + 0x04, 0x02, 0x02, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x82, 0x44, 0x44, 0x44, 0x44, + 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x92, 0x92, + 0x92, 0xaa, 0xaa, 0xaa, 0xc6, 0x82, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, + 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00, + 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0xfe, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, + 0x10, 0x20, 0x20, 0x40, 0x80, 0xfe, 0x00, 0x00, + 0x00, 0x78, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x78, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x20, 0x10, + 0x10, 0x08, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, + 0x00, 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, + 0x26, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x58, + 0x64, 0x42, 0x42, 0x42, 0x64, 0x58, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, + 0x22, 0x40, 0x40, 0x40, 0x22, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x1a, + 0x26, 0x42, 0x42, 0x42, 0x26, 0x1a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x24, 0x42, 0x7c, 0x40, 0x22, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x40, + 0x40, 0xf0, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, + 0x42, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x44, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, + 0x58, 0x64, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x24, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x42, 0x44, + 0x48, 0x50, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, + 0x6a, 0x4a, 0x4a, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, + 0x62, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, + 0x64, 0x42, 0x42, 0x64, 0x58, 0x40, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, + 0x26, 0x42, 0x42, 0x26, 0x1a, 0x02, 0x02, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, + 0x62, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, + 0x42, 0x40, 0x3c, 0x02, 0x42, 0x3c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x78, + 0x20, 0x20, 0x20, 0x20, 0x22, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x46, 0x3a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x42, 0x42, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x42, 0x42, 0x52, 0x52, 0x52, 0x2c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x24, 0x24, 0x18, 0x24, 0x24, 0x42, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x44, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, + 0x04, 0x08, 0x10, 0x10, 0x20, 0x7e, 0x00, 0x00, + 0x00, 0x1c, 0x20, 0x40, 0x40, 0x20, 0x20, 0x40, + 0x20, 0x20, 0x40, 0x40, 0x20, 0x1c, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, + 0x00, 0x70, 0x08, 0x04, 0x04, 0x08, 0x08, 0x04, + 0x08, 0x08, 0x04, 0x04, 0x08, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x51, 0x8a, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +int minifont_draw(uint16 *buffer, uint32 bufwidth, uint32 c); +int minifont_draw_str(uint16 *buffer, uint32 bufwidth, const char *str); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |