summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/m92.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/m92.c')
-rw-r--r--src/mame/drivers/m92.c78
1 files changed, 38 insertions, 40 deletions
diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c
index 9894f1325f4..cec72909fc7 100644
--- a/src/mame/drivers/m92.c
+++ b/src/mame/drivers/m92.c
@@ -207,7 +207,7 @@ psoldier dip locations still need verification.
#define M92_IRQ_0 ((state->m_irq_vectorbase+0)/4) /* VBL interrupt */
#define M92_IRQ_1 ((state->m_irq_vectorbase+4)/4) /* Sprite buffer complete interrupt */
#define M92_IRQ_2 ((state->m_irq_vectorbase+8)/4) /* Raster interrupt */
-#define M92_IRQ_3 ((state->m_irq_vectorbase+12)/4) /* Sound cpu interrupt */
+#define M92_IRQ_3 ((m_irq_vectorbase+12)/4) /* Sound cpu interrupt */
/*****************************************************************************/
@@ -250,40 +250,40 @@ static TIMER_DEVICE_CALLBACK( m92_scanline_interrupt )
/*****************************************************************************/
-static READ16_HANDLER( m92_eeprom_r )
+READ16_MEMBER(m92_state::m92_eeprom_r)
{
- UINT8 *RAM = space->machine().region("eeprom")->base();
-// logerror("%05x: EEPROM RE %04x\n",cpu_get_pc(&space->device()),offset);
+ UINT8 *RAM = machine().region("eeprom")->base();
+// logerror("%05x: EEPROM RE %04x\n",cpu_get_pc(&space.device()),offset);
return RAM[offset] | 0xff00;
}
-static WRITE16_HANDLER( m92_eeprom_w )
+WRITE16_MEMBER(m92_state::m92_eeprom_w)
{
- UINT8 *RAM = space->machine().region("eeprom")->base();
-// logerror("%05x: EEPROM WR %04x\n",cpu_get_pc(&space->device()),offset);
+ UINT8 *RAM = machine().region("eeprom")->base();
+// logerror("%05x: EEPROM WR %04x\n",cpu_get_pc(&space.device()),offset);
if (ACCESSING_BITS_0_7)
RAM[offset] = data;
}
-static WRITE16_HANDLER( m92_coincounter_w )
+WRITE16_MEMBER(m92_state::m92_coincounter_w)
{
if (ACCESSING_BITS_0_7)
{
- coin_counter_w(space->machine(), 0, data & 0x01);
- coin_counter_w(space->machine(), 1, data & 0x02);
+ coin_counter_w(machine(), 0, data & 0x01);
+ coin_counter_w(machine(), 1, data & 0x02);
/* Bit 0x8 is Motor(?!), used in Hook, In The Hunt, UCops */
/* Bit 0x8 is Memcard related in RTypeLeo */
/* Bit 0x40 set in Blade Master test mode input check */
}
}
-static WRITE16_HANDLER( m92_bankswitch_w )
+WRITE16_MEMBER(m92_state::m92_bankswitch_w)
{
if (ACCESSING_BITS_0_7)
{
- memory_set_bank(space->machine(), "bank1", (data & 0x06) >> 1);
+ memory_set_bank(machine(), "bank1", (data & 0x06) >> 1);
if (data & 0xf9)
- logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space->device()), data);
+ logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data);
}
}
@@ -295,40 +295,38 @@ static CUSTOM_INPUT( m92_sprite_busy_r )
/*****************************************************************************/
-static WRITE16_HANDLER( m92_soundlatch_w )
+WRITE16_MEMBER(m92_state::m92_soundlatch_w)
{
- cputag_set_input_line(space->machine(), "soundcpu", NEC_INPUT_LINE_INTP1, ASSERT_LINE);
+ cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, ASSERT_LINE);
soundlatch_w(space, 0, data & 0xff);
}
-static READ16_HANDLER( m92_sound_status_r )
+READ16_MEMBER(m92_state::m92_sound_status_r)
{
- m92_state *state = space->machine().driver_data<m92_state>();
-//logerror("%06x: read sound status\n",cpu_get_pc(&space->device()));
- return state->m_sound_status;
+//logerror("%06x: read sound status\n",cpu_get_pc(&space.device()));
+ return m_sound_status;
}
-static READ16_HANDLER( m92_soundlatch_r )
+READ16_MEMBER(m92_state::m92_soundlatch_r)
{
- cputag_set_input_line(space->machine(), "soundcpu", NEC_INPUT_LINE_INTP1, CLEAR_LINE);
+ cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, CLEAR_LINE);
return soundlatch_r(space, offset) | 0xff00;
}
-static WRITE16_HANDLER( m92_sound_irq_ack_w )
+WRITE16_MEMBER(m92_state::m92_sound_irq_ack_w)
{
- cputag_set_input_line(space->machine(), "soundcpu", NEC_INPUT_LINE_INTP1, CLEAR_LINE);
+ cputag_set_input_line(machine(), "soundcpu", NEC_INPUT_LINE_INTP1, CLEAR_LINE);
}
-static WRITE16_HANDLER( m92_sound_status_w )
+WRITE16_MEMBER(m92_state::m92_sound_status_w)
{
- m92_state *state = space->machine().driver_data<m92_state>();
- COMBINE_DATA(&state->m_sound_status);
- cputag_set_input_line_and_vector(space->machine(), "maincpu", 0, HOLD_LINE, M92_IRQ_3);
+ COMBINE_DATA(&m_sound_status);
+ cputag_set_input_line_and_vector(machine(), "maincpu", 0, HOLD_LINE, M92_IRQ_3);
}
-static WRITE16_HANDLER( m92_sound_reset_w )
+WRITE16_MEMBER(m92_state::m92_sound_reset_w)
{
- cputag_set_input_line(space->machine(), "soundcpu", INPUT_LINE_RESET, (data) ? CLEAR_LINE : ASSERT_LINE);
+ cputag_set_input_line(machine(), "soundcpu", INPUT_LINE_RESET, (data) ? CLEAR_LINE : ASSERT_LINE);
}
/*****************************************************************************/
@@ -363,15 +361,15 @@ static ADDRESS_MAP_START( m92_portmap, AS_IO, 16, m92_state )
AM_RANGE(0x02, 0x03) AM_READ_PORT("COINS_DSW3")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
AM_RANGE(0x06, 0x07) AM_READ_PORT("P3_P4")
- AM_RANGE(0x08, 0x09) AM_READ_LEGACY(m92_sound_status_r) /* answer from sound CPU */
- AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(m92_soundlatch_w)
- AM_RANGE(0x02, 0x03) AM_WRITE_LEGACY(m92_coincounter_w)
+ AM_RANGE(0x08, 0x09) AM_READ(m92_sound_status_r) /* answer from sound CPU */
+ AM_RANGE(0x00, 0x01) AM_WRITE(m92_soundlatch_w)
+ AM_RANGE(0x02, 0x03) AM_WRITE(m92_coincounter_w)
AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
AM_RANGE(0x80, 0x87) AM_WRITE_LEGACY(m92_pf1_control_w)
AM_RANGE(0x88, 0x8f) AM_WRITE_LEGACY(m92_pf2_control_w)
AM_RANGE(0x90, 0x97) AM_WRITE_LEGACY(m92_pf3_control_w)
AM_RANGE(0x98, 0x9f) AM_WRITE_LEGACY(m92_master_control_w)
- AM_RANGE(0xc0, 0xc1) AM_WRITE_LEGACY(m92_sound_reset_w)
+ AM_RANGE(0xc0, 0xc1) AM_WRITE(m92_sound_reset_w)
ADDRESS_MAP_END
static WRITE16_DEVICE_HANDLER( oki_bank_w )
@@ -384,10 +382,10 @@ static ADDRESS_MAP_START( ppan_portmap, AS_IO, 16, m92_state )
AM_RANGE(0x02, 0x03) AM_READ_PORT("COINS_DSW3")
AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
AM_RANGE(0x06, 0x07) AM_READ_PORT("P3_P4")
- AM_RANGE(0x08, 0x09) AM_READ_LEGACY(m92_sound_status_r) /* answer from sound CPU */
+ AM_RANGE(0x08, 0x09) AM_READ(m92_sound_status_r) /* answer from sound CPU */
AM_RANGE(0x10, 0x11) AM_DEVWRITE_LEGACY("oki", oki_bank_w)
AM_RANGE(0x18, 0x19) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
- AM_RANGE(0x02, 0x03) AM_WRITE_LEGACY(m92_coincounter_w)
+ AM_RANGE(0x02, 0x03) AM_WRITE(m92_coincounter_w)
AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */
AM_RANGE(0x80, 0x87) AM_WRITE_LEGACY(m92_pf1_control_w)
AM_RANGE(0x88, 0x8f) AM_WRITE_LEGACY(m92_pf2_control_w)
@@ -403,8 +401,8 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, m92_state )
AM_RANGE(0xa0000, 0xa3fff) AM_RAM
AM_RANGE(0xa8000, 0xa803f) AM_DEVREADWRITE8_LEGACY("irem", irem_ga20_r, irem_ga20_w, 0x00ff)
AM_RANGE(0xa8040, 0xa8043) AM_DEVREADWRITE8_LEGACY("ymsnd", ym2151_r, ym2151_w, 0x00ff)
- AM_RANGE(0xa8044, 0xa8045) AM_READWRITE_LEGACY(m92_soundlatch_r, m92_sound_irq_ack_w)
- AM_RANGE(0xa8046, 0xa8047) AM_WRITE_LEGACY(m92_sound_status_w)
+ AM_RANGE(0xa8044, 0xa8045) AM_READWRITE(m92_soundlatch_r, m92_sound_irq_ack_w)
+ AM_RANGE(0xa8046, 0xa8047) AM_WRITE(m92_sound_status_w)
AM_RANGE(0xffff0, 0xfffff) AM_ROM AM_REGION("soundcpu", 0x1fff0)
ADDRESS_MAP_END
@@ -2099,7 +2097,7 @@ static DRIVER_INIT( m92_bank )
UINT8 *ROM = machine.region("maincpu")->base();
memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x80000], 0x20000);
- machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x20, 0x21, FUNC(m92_bankswitch_w));
+ machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),state));
state->m_game_kludge = 0;
state->m_irq_vectorbase = 0x80;
@@ -2112,10 +2110,10 @@ static DRIVER_INIT( majtitl2 )
UINT8 *ROM = machine.region("maincpu")->base();
memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x80000], 0x20000);
- machine.device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x20, 0x21, FUNC(m92_bankswitch_w));
+ machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),state));
/* This game has an eeprom on the game board */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xf0000, 0xf3fff, FUNC(m92_eeprom_r), FUNC(m92_eeprom_w));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0000, 0xf3fff, read16_delegate(FUNC(m92_state::m92_eeprom_r),state), write16_delegate(FUNC(m92_state::m92_eeprom_w),state));
state->m_game_kludge = 2;
state->m_irq_vectorbase = 0x80;