(MESS) megadriv.c: fixed FRAM saving in Sonic 3 (got lost in some copy&paste I did before the commit :( ).

also fixed access to last byte of SRAM. no whatsnew.
This commit is contained in:
Fabio Priuli 2013-02-11 15:37:34 +00:00
parent 497661c016
commit da5163f0a7
2 changed files with 9 additions and 2 deletions

View File

@ -285,7 +285,7 @@ READ16_MEMBER(md_rom_sram_device::read)
// we access nvram only if m_nvram_handlers_installed has been turned on
if (m_nvram_handlers_installed)
{
if (offset >= m_nvram_start/2 && offset < m_nvram_end/2 && m_nvram_active)
if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active)
return m_nvram[offset - m_nvram_start/2];
}
if (offset < 0x400000/2)
@ -326,7 +326,7 @@ WRITE16_MEMBER(md_rom_sram_device::write_a13)
READ16_MEMBER(md_rom_fram_device::read)
{
if (offset >= m_nvram_start/2 && offset < m_nvram_end/2 && m_nvram_active)
if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active)
return m_nvram[offset - m_nvram_start/2];
if (offset < 0x400000/2)
return m_rom[MD_ADDR(offset)];
@ -334,6 +334,12 @@ READ16_MEMBER(md_rom_fram_device::read)
return 0xffff;
}
WRITE16_MEMBER(md_rom_fram_device::write)
{
if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active)
m_nvram[offset - m_nvram_start/2] = data;
}
WRITE16_MEMBER(md_rom_fram_device::write_a13)
{
if (offset == 0xf0/2)

View File

@ -56,6 +56,7 @@ public:
// reading and writing
virtual DECLARE_READ16_MEMBER(read);
virtual DECLARE_WRITE16_MEMBER(write);
virtual DECLARE_READ16_MEMBER(read_a13);
virtual DECLARE_WRITE16_MEMBER(write_a13);
};