From e8fd09abf68b944b05554c82adb577514cad5ca5 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Wed, 18 Jan 2017 23:37:07 +0900 Subject: improve FMDSP and enable title display on win32 --- fmdsp/font_rom.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 fmdsp/font_rom.c (limited to 'fmdsp/font_rom.c') diff --git a/fmdsp/font_rom.c b/fmdsp/font_rom.c new file mode 100644 index 0000000..de6bc19 --- /dev/null +++ b/fmdsp/font_rom.c @@ -0,0 +1,24 @@ +#include "font.h" + +static const void *font_rom_get(const struct fmdsp_font *font, + uint16_t jis, enum fmdsp_font_type type) { + const uint8_t *fontdata = font->data; + const uint8_t *fontptr; + if (type == FMDSP_FONT_ANK) { + fontptr = fontdata + 0x800 + (jis<<4); + } else { + uint8_t row = jis >> 8; + uint8_t cell = jis; + fontptr = fontdata + (0x800 + (0x60*16*2*(row-0x20)) + (cell<<5)); + if (type == FMDSP_FONT_JIS_RIGHT) fontptr += 16; + } + if ((fontptr + (16*16/8)) > (fontdata + FONT_ROM_FILESIZE)) fontptr = 0; + return fontptr; +} + +void fmdsp_font_from_font_rom(struct fmdsp_font *font, const void *data) { + font->data = data; + font->width_half = 8; + font->height = 16; + font->get = font_rom_get; +} -- cgit v1.2.3