From 63ef11c99046022088747e63cb43ee4ce8e1f52b Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Thu, 3 Nov 2011 07:19:12 +0000 Subject: [PATCH] fixed a bunch of crashes reported by Tafoid. no whatsnew. --- src/mame/drivers/maygay1b.c | 3 ++- src/mame/drivers/mpu4.c | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mame/drivers/maygay1b.c b/src/mame/drivers/maygay1b.c index ae3321b50e5..85c93a22dea 100644 --- a/src/mame/drivers/maygay1b.c +++ b/src/mame/drivers/maygay1b.c @@ -3843,8 +3843,9 @@ static DRIVER_INIT( m1 ) // if there is no OKI region disable writes here, the rom might be missing, so alert user UINT8 *okirom = machine.region( "oki" )->base(); + UINT8 *msm6376rom = machine.region( "msm6376" )->base(); - if (!okirom) + if (!okirom && !msm6376rom) machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2420, 0x2421, FUNC(m1ab_no_oki_w)); // print out the rom id / header info to give us some hints diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c index 55bca688c64..d558c6c8fe2 100644 --- a/src/mame/drivers/mpu4.c +++ b/src/mame/drivers/mpu4.c @@ -468,7 +468,7 @@ static MACHINE_RESET( mpu4 ) memory_configure_bank(machine, "bank1", 0, 8, &rom[0x01000], 0x10000); - memory_set_bank(machine, "bank1",0); + memory_set_bank(machine, "bank1", 0); machine.device("maincpu")->reset(); } } @@ -522,8 +522,8 @@ static WRITE8_HANDLER( bankswitch_w ) mpu4_state *state = space->machine().driver_data(); // printf("bank %02x\n", data); - state->m_pageval=(data&0x03); - memory_set_bank(space->machine(), "bank1",state->m_pageval + (state->m_pageset?4:0)); + state->m_pageval = (data & 0x03); + memory_set_bank(space->machine(), "bank1", (state->m_pageval + (state->m_pageset ? 4 : 0)) & 0x07); } @@ -536,8 +536,8 @@ static READ8_HANDLER( bankswitch_r ) static WRITE8_HANDLER( bankset_w ) { mpu4_state *state = space->machine().driver_data(); - state->m_pageval=(data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design? - memory_set_bank(space->machine(), "bank1",state->m_pageval + (state->m_pageset?4:0)); + state->m_pageval = (data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design? + memory_set_bank(space->machine(), "bank1", (state->m_pageval + (state->m_pageset ? 4 : 0)) & 0x07); } @@ -1561,9 +1561,8 @@ static WRITE_LINE_DEVICE_HANDLER( pia_gb_cb2_w ) //Some BWB games use this to drive the bankswitching if (mstate->m_bwb_bank) { - mstate->m_pageval=state; - - memory_set_bank(device->machine(), "bank1",mstate->m_pageval + (mstate->m_pageset?4:0)); + mstate->m_pageval = state; + memory_set_bank(device->machine(), "bank1", (state->m_pageval + (state->m_pageset ? 4 : 0)) & 0x07); } }