amstrad: restore CPR bank mask, force it to be based on the size of an actual ROM

This commit is contained in:
mahlemiut 2018-05-01 00:25:17 +12:00
parent 1e82f36a94
commit f0e300e234

View file

@ -2936,7 +2936,14 @@ void amstrad_state::enumerate_roms()
if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000)
{
uint8_t *crt = m_region_cart->base();
int bank_num = (m_cart->get_rom_size() / 0x4000);
int bank_mask = 0x7ffff;
if (m_cart->get_rom_size() <= 0x20000)
bank_mask = 0x1ffff;
else if (m_cart->get_rom_size() <= 0x40000)
bank_mask = 0x3ffff;
else if (m_cart->get_rom_size() <= 0x80000)
bank_mask = 0x7ffff;
/* ROMs are stored on the inserted cartridge in the Plus/GX4000 */
for (int i = 0; i < 128; i++) // fill ROM table
@ -2946,7 +2953,7 @@ void amstrad_state::enumerate_roms()
for(int i = 128; i < 160; i++)
{
m_Amstrad_ROM_Table[i] = &crt[((i - 128) % bank_num) * 0x4000];
m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000];
}
m_Amstrad_ROM_Table[7] = &crt[0xc000];
slot7 = true;