From 5fca3627c638b2dd42c1dff9ca91786ce48666a1 Mon Sep 17 00:00:00 2001 From: nanshiki Date: Sat, 28 Sep 2024 10:12:42 +0900 Subject: [PATCH] Fixed reading NEC specific character font data. --- src/hardware/vga_memory.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/hardware/vga_memory.cpp b/src/hardware/vga_memory.cpp index efae49f756..43b92e9ff7 100644 --- a/src/hardware/vga_memory.cpp +++ b/src/hardware/vga_memory.cpp @@ -1617,6 +1617,7 @@ class VGA_PC98_TEXT_PageHandler : public PageHandler { }; extern uint16_t a1_font_load_addr; +extern uint8_t a1_font_char_offset; /* A4000-A4FFF character generator memory-mapped I/O */ /* 0xA4000-0xA4FFF is word-sized access to the character generator. @@ -1639,8 +1640,16 @@ class VGA_PC98_CG_PageHandler : public PageHandler { public: VGA_PC98_CG_PageHandler() : PageHandler(PFLAG_NOCODE) {} uint8_t readb(PhysPt addr) override { - return pc98_font_char_read(a1_font_load_addr,(addr >> 1) & 0xF,addr & 1); - } + uint8_t high = a1_font_load_addr & 0xff; + if((high >= 0x09 && high <= 0x0b) || (high >= 0x0c && high <= 0x0f) || (high >= 0x58 && high <= 0x5f)) { + if(addr & 1) { + return pc98_font_char_read(a1_font_load_addr,(addr >> 1) & 0xF, (a1_font_char_offset & 0x20) ? 0 : 1); + } else { + return 0; + } + } + return pc98_font_char_read(a1_font_load_addr,(addr >> 1) & 0xF,addr & 1); + } void writeb(PhysPt addr,uint8_t val) override { if ((a1_font_load_addr & 0x007E) == 0x0056 && (a1_font_load_addr & 0xFF00) != 0x0000) pc98_font_char_write(a1_font_load_addr,(addr >> 1) & 0xF,addr & 1,val);