slightly more defensive ram & rom mapping (nw)

This commit is contained in:
smf- 2013-05-24 18:11:39 +00:00
parent 08bf20d586
commit d3f09b6ff8

View File

@ -1355,8 +1355,13 @@ void psxcpu_device::update_ram_config()
UINT32 ram_size = m_ram->size();
UINT8 *pointer = m_ram->pointer();
assert( window_size != 0 );
if( ram_size > window_size )
{
ram_size = window_size;
}
if( ram_size > 0 )
{
int start = 0;
while( start < window_size )
{
@ -1366,6 +1371,7 @@ void psxcpu_device::update_ram_config()
start += ram_size;
}
}
m_program->install_readwrite_handler( 0x00000000 + window_size, 0x1effffff, read32_delegate( FUNC(psxcpu_device::berr_r), this ), write32_delegate( FUNC(psxcpu_device::berr_w), this ) );
m_program->install_readwrite_handler( 0x80000000 + window_size, 0x9effffff, read32_delegate( FUNC(psxcpu_device::berr_r), this ), write32_delegate( FUNC(psxcpu_device::berr_w), this ) );
@ -1384,13 +1390,13 @@ void psxcpu_device::update_rom_config()
UINT32 rom_size = m_rom->bytes();
UINT8 *pointer = m_rom->base();
if( rom_size > max_window_size )
if( rom_size > window_size )
{
rom_size = max_window_size;
rom_size = window_size;
}
assert( window_size != 0 );
if( rom_size > 0 )
{
int start = 0;
while( start < window_size )
{
@ -1400,6 +1406,7 @@ void psxcpu_device::update_rom_config()
start += rom_size;
}
}
if( window_size < max_window_size )
{