MT 04841: m4exotic, m4jflash, m4madmnc, m4mmm, m4przrfm, m4rhfev, m4spinbt, m4xch, m4xs, m4xtrm: [debug] Crash after OK [Robbbert]

(out of whatsnew): Modified banking so it doesn't try to select a bank beyond the end of memory. There are far too many sets to test to look for regressions elsewhere.
This commit is contained in:
Robbbert 2013-07-02 09:07:19 +00:00
parent 4023c2aad4
commit 64253b59bb
2 changed files with 19 additions and 18 deletions

View File

@ -468,21 +468,8 @@ MACHINE_RESET_MEMBER(mpu4_state,mpu4)
{
UINT8 *rom = memregion("maincpu")->base();
size_t romsize = memregion("maincpu")->bytes();
if (romsize < 0x10000)
fatalerror("maincpu ROM region is < 0x10000 bytes, check ROM\n");
int numbanks = romsize / 0x10000;
m_bank1->configure_entries(0, 8, &rom[0x01000], 0x10000);
// some Bwb games must default to the last bank, does anything not like this
// behavior?
// some Bwb games don't work anyway tho, they seem to dislike something else
// about the way the regular banking behaves, not related to the CB2 stuff
m_bank1->set_entry(numbanks-1);
if (m_numbanks)
m_bank1->set_entry(m_numbanks);
m_maincpu->reset();
}
@ -529,7 +516,7 @@ WRITE8_MEMBER(mpu4_state::bankswitch_w)
// m_pageset is never even set??
m_pageval = (data & 0x03);
m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & m_numbanks);
}
@ -546,7 +533,7 @@ WRITE8_MEMBER(mpu4_state::bankset_w)
// m_pageset is never even set??
m_pageval = (data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design?
m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & m_numbanks);
}
@ -1537,7 +1524,7 @@ WRITE_LINE_MEMBER(mpu4_state::pia_gb_cb2_w)
{
//printf("pia_gb_cb2_w %d\n", state);
m_pageval = state;
m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
m_bank1->set_entry((m_pageval + (m_pageset ? 4 : 0)) & m_numbanks);
}
}
@ -2649,6 +2636,19 @@ DRIVER_INIT_MEMBER(mpu4_state,m4default_big)
m_bwb_bank=1;
space.install_write_handler(0x0858, 0x0858, 0, 0, write8_delegate(FUNC(mpu4_state::bankswitch_w),this));
space.install_write_handler(0x0878, 0x0878, 0, 0, write8_delegate(FUNC(mpu4_state::bankset_w),this));
UINT8 *rom = memregion("maincpu")->base();
m_numbanks = size / 0x10000;
m_bank1->configure_entries(0, m_numbanks, &rom[0x01000], 0x10000);
m_numbanks--;
// some Bwb games must default to the last bank, does anything not like this
// behavior?
// some Bwb games don't work anyway tho, they seem to dislike something else
// about the way the regular banking behaves, not related to the CB2 stuff
m_bank1->set_entry(m_numbanks);
}
}

View File

@ -198,6 +198,7 @@ public:
int m_t1;
int m_t3l;
int m_t3h;
UINT8 m_numbanks;
mpu4_chr_table* m_current_chr_table;
const bwb_chr_table* m_bwb_chr_table1;