From c5c8474c6f218372774493927fe9366fef7de26b Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 12 Apr 2024 15:22:24 +0200 Subject: msx ink: fix regression with flash read --- src/devices/bus/msx/cart/ink.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/devices/bus/msx/cart/ink.cpp b/src/devices/bus/msx/cart/ink.cpp index 81861415b99..1704fac3ded 100644 --- a/src/devices/bus/msx/cart/ink.cpp +++ b/src/devices/bus/msx/cart/ink.cpp @@ -35,6 +35,7 @@ protected: private: required_device m_flash; + template u8 read_page(offs_t offset); template void write_page(offs_t offset, u8 data); }; @@ -65,10 +66,10 @@ std::error_condition msx_cart_ink_device::initialize_cartridge(std::string &mess u8 *flash = memregion("flash")->base(); memcpy(flash, cart_rom_region()->base(), size); - page(0)->install_rom(0x0000, 0x3fff, flash); - page(1)->install_rom(0x4000, 0x7fff, flash + 0x4000); - page(2)->install_rom(0x8000, 0xbfff, flash + 0x8000); - page(3)->install_rom(0xc000, 0xffff, flash + 0xc000); + page(0)->install_read_handler(0x0000, 0x3fff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::read_page<0>))); + page(1)->install_read_handler(0x4000, 0x7fff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::read_page<1>))); + page(2)->install_read_handler(0x8000, 0xbfff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::read_page<2>))); + page(3)->install_read_handler(0xc000, 0xffff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::read_page<3>))); page(0)->install_write_handler(0x0000, 0x3fff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::write_page<0>))); page(1)->install_write_handler(0x4000, 0x7fff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::write_page<1>))); page(2)->install_write_handler(0x8000, 0xbfff, emu::rw_delegate(*this, FUNC(msx_cart_ink_device::write_page<2>))); @@ -77,6 +78,12 @@ std::error_condition msx_cart_ink_device::initialize_cartridge(std::string &mess return std::error_condition(); } +template +u8 msx_cart_ink_device::read_page(offs_t offset) +{ + return m_flash->read(offset | (Page * 0x4000)); +} + template void msx_cart_ink_device::write_page(offs_t offset, u8 data) { -- cgit v1.2.3