diff options
Diffstat (limited to 'src/mame/drivers/fromance.c')
-rw-r--r-- | src/mame/drivers/fromance.c | 107 |
1 files changed, 50 insertions, 57 deletions
diff --git a/src/mame/drivers/fromance.c b/src/mame/drivers/fromance.c index fa1570462ee..c6e88c4d0f9 100644 --- a/src/mame/drivers/fromance.c +++ b/src/mame/drivers/fromance.c @@ -53,10 +53,9 @@ Memo: * *************************************/ -static READ8_HANDLER( fromance_commanddata_r ) +READ8_MEMBER(fromance_state::fromance_commanddata_r) { - fromance_state *state = space->machine().driver_data<fromance_state>(); - return state->m_commanddata; + return m_commanddata; } @@ -68,42 +67,39 @@ static TIMER_CALLBACK( deferred_commanddata_w ) } -static WRITE8_HANDLER( fromance_commanddata_w ) +WRITE8_MEMBER(fromance_state::fromance_commanddata_w) { /* do this on a timer to let the slave CPU synchronize */ - space->machine().scheduler().synchronize(FUNC(deferred_commanddata_w), data); + machine().scheduler().synchronize(FUNC(deferred_commanddata_w), data); } -static READ8_HANDLER( fromance_busycheck_main_r ) +READ8_MEMBER(fromance_state::fromance_busycheck_main_r) { - fromance_state *state = space->machine().driver_data<fromance_state>(); /* set a timer to force synchronization after the read */ - space->machine().scheduler().synchronize(); + machine().scheduler().synchronize(); - if (!state->m_directionflag) + if (!m_directionflag) return 0x00; // standby else return 0xff; // busy } -static READ8_HANDLER( fromance_busycheck_sub_r ) +READ8_MEMBER(fromance_state::fromance_busycheck_sub_r) { - fromance_state *state = space->machine().driver_data<fromance_state>(); - if (state->m_directionflag) + if (m_directionflag) return 0xff; // standby else return 0x00; // busy } -static WRITE8_HANDLER( fromance_busycheck_sub_w ) +WRITE8_MEMBER(fromance_state::fromance_busycheck_sub_w) { - fromance_state *state = space->machine().driver_data<fromance_state>(); - state->m_directionflag = 0; + m_directionflag = 0; } @@ -114,9 +110,9 @@ static WRITE8_HANDLER( fromance_busycheck_sub_w ) * *************************************/ -static WRITE8_HANDLER( fromance_rombank_w ) +WRITE8_MEMBER(fromance_state::fromance_rombank_w) { - memory_set_bank(space->machine(), "bank1", data); + memory_set_bank(machine(), "bank1", data); } @@ -137,11 +133,10 @@ static WRITE8_DEVICE_HANDLER( fromance_adpcm_reset_w ) } -static WRITE8_HANDLER( fromance_adpcm_w ) +WRITE8_MEMBER(fromance_state::fromance_adpcm_w) { - fromance_state *state = space->machine().driver_data<fromance_state>(); - state->m_adpcm_data = data; - state->m_vclk_left = 2; + m_adpcm_data = data; + m_vclk_left = 2; } @@ -174,28 +169,26 @@ static void fromance_adpcm_int( device_t *device ) * *************************************/ -static WRITE8_HANDLER( fromance_portselect_w ) +WRITE8_MEMBER(fromance_state::fromance_portselect_w) { - fromance_state *state = space->machine().driver_data<fromance_state>(); - state->m_portselect = data; + m_portselect = data; } -static READ8_HANDLER( fromance_keymatrix_r ) +READ8_MEMBER(fromance_state::fromance_keymatrix_r) { - fromance_state *state = space->machine().driver_data<fromance_state>(); int ret = 0xff; - if (state->m_portselect & 0x01) - ret &= input_port_read(space->machine(), "KEY1"); - if (state->m_portselect & 0x02) - ret &= input_port_read(space->machine(), "KEY2"); - if (state->m_portselect & 0x04) - ret &= input_port_read(space->machine(), "KEY3"); - if (state->m_portselect & 0x08) - ret &= input_port_read(space->machine(), "KEY4"); - if (state->m_portselect & 0x10) - ret &= input_port_read(space->machine(), "KEY5"); + if (m_portselect & 0x01) + ret &= input_port_read(machine(), "KEY1"); + if (m_portselect & 0x02) + ret &= input_port_read(machine(), "KEY2"); + if (m_portselect & 0x04) + ret &= input_port_read(machine(), "KEY3"); + if (m_portselect & 0x08) + ret &= input_port_read(machine(), "KEY4"); + if (m_portselect & 0x10) + ret &= input_port_read(machine(), "KEY5"); return ret; } @@ -208,7 +201,7 @@ static READ8_HANDLER( fromance_keymatrix_r ) * *************************************/ -static WRITE8_HANDLER( fromance_coinctr_w ) +WRITE8_MEMBER(fromance_state::fromance_coinctr_w) { // } @@ -224,10 +217,10 @@ static WRITE8_HANDLER( fromance_coinctr_w ) static ADDRESS_MAP_START( nekkyoku_main_map, AS_PROGRAM, 8, fromance_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM - AM_RANGE(0xf000, 0xf000) AM_READ_PORT("SERVICE") AM_WRITE_LEGACY(fromance_portselect_w) - AM_RANGE(0xf001, 0xf001) AM_READ_LEGACY(fromance_keymatrix_r) AM_WRITENOP - AM_RANGE(0xf002, 0xf002) AM_READ_PORT("COIN") AM_WRITE_LEGACY(fromance_coinctr_w) - AM_RANGE(0xf003, 0xf003) AM_READWRITE_LEGACY(fromance_busycheck_main_r, fromance_commanddata_w) + AM_RANGE(0xf000, 0xf000) AM_READ_PORT("SERVICE") AM_WRITE(fromance_portselect_w) + AM_RANGE(0xf001, 0xf001) AM_READ(fromance_keymatrix_r) AM_WRITENOP + AM_RANGE(0xf002, 0xf002) AM_READ_PORT("COIN") AM_WRITE(fromance_coinctr_w) + AM_RANGE(0xf003, 0xf003) AM_READWRITE(fromance_busycheck_main_r, fromance_commanddata_w) AM_RANGE(0xf004, 0xf004) AM_READ_PORT("DSW2") AM_RANGE(0xf005, 0xf005) AM_READ_PORT("DSW1") ADDRESS_MAP_END @@ -236,10 +229,10 @@ static ADDRESS_MAP_START( fromance_main_map, AS_PROGRAM, 8, fromance_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0x9e89, 0x9e89) AM_READNOP // unknown (idolmj) - AM_RANGE(0xe000, 0xe000) AM_READ_PORT("SERVICE") AM_WRITE_LEGACY(fromance_portselect_w) - AM_RANGE(0xe001, 0xe001) AM_READ_LEGACY(fromance_keymatrix_r) - AM_RANGE(0xe002, 0xe002) AM_READ_PORT("COIN") AM_WRITE_LEGACY(fromance_coinctr_w) - AM_RANGE(0xe003, 0xe003) AM_READWRITE_LEGACY(fromance_busycheck_main_r, fromance_commanddata_w) + AM_RANGE(0xe000, 0xe000) AM_READ_PORT("SERVICE") AM_WRITE(fromance_portselect_w) + AM_RANGE(0xe001, 0xe001) AM_READ(fromance_keymatrix_r) + AM_RANGE(0xe002, 0xe002) AM_READ_PORT("COIN") AM_WRITE(fromance_coinctr_w) + AM_RANGE(0xe003, 0xe003) AM_READWRITE(fromance_busycheck_main_r, fromance_commanddata_w) AM_RANGE(0xe004, 0xe004) AM_READ_PORT("DSW2") AM_RANGE(0xe005, 0xe005) AM_READ_PORT("DSW1") ADDRESS_MAP_END @@ -281,12 +274,12 @@ static ADDRESS_MAP_START( nekkyoku_sub_io_map, AS_IO, 8, fromance_state ) AM_RANGE(0x10, 0x10) AM_WRITE_LEGACY(fromance_crtc_data_w) AM_RANGE(0x11, 0x11) AM_WRITE_LEGACY(fromance_crtc_register_w) AM_RANGE(0x12, 0x12) AM_READNOP // unknown - AM_RANGE(0xe0, 0xe0) AM_WRITE_LEGACY(fromance_rombank_w) - AM_RANGE(0xe1, 0xe1) AM_READWRITE_LEGACY(fromance_busycheck_sub_r, fromance_gfxreg_w) + AM_RANGE(0xe0, 0xe0) AM_WRITE(fromance_rombank_w) + AM_RANGE(0xe1, 0xe1) AM_READ(fromance_busycheck_sub_r) AM_WRITE_LEGACY(fromance_gfxreg_w) AM_RANGE(0xe2, 0xe5) AM_WRITE_LEGACY(fromance_scroll_w) - AM_RANGE(0xe6, 0xe6) AM_READWRITE_LEGACY(fromance_commanddata_r, fromance_busycheck_sub_w) + AM_RANGE(0xe6, 0xe6) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w) AM_RANGE(0xe7, 0xe7) AM_DEVWRITE_LEGACY("msm", fromance_adpcm_reset_w) - AM_RANGE(0xe8, 0xe8) AM_WRITE_LEGACY(fromance_adpcm_w) + AM_RANGE(0xe8, 0xe8) AM_WRITE(fromance_adpcm_w) AM_RANGE(0xe9, 0xea) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w) ADDRESS_MAP_END @@ -295,12 +288,12 @@ static ADDRESS_MAP_START( idolmj_sub_io_map, AS_IO, 8, fromance_state ) AM_RANGE(0x10, 0x10) AM_WRITE_LEGACY(fromance_crtc_data_w) AM_RANGE(0x11, 0x11) AM_WRITE_LEGACY(fromance_crtc_register_w) AM_RANGE(0x12, 0x12) AM_READNOP // unknown - AM_RANGE(0x20, 0x20) AM_WRITE_LEGACY(fromance_rombank_w) - AM_RANGE(0x21, 0x21) AM_READWRITE_LEGACY(fromance_busycheck_sub_r, fromance_gfxreg_w) + AM_RANGE(0x20, 0x20) AM_WRITE(fromance_rombank_w) + AM_RANGE(0x21, 0x21) AM_READ(fromance_busycheck_sub_r) AM_WRITE_LEGACY(fromance_gfxreg_w) AM_RANGE(0x22, 0x25) AM_WRITE_LEGACY(fromance_scroll_w) - AM_RANGE(0x26, 0x26) AM_READWRITE_LEGACY(fromance_commanddata_r, fromance_busycheck_sub_w) + AM_RANGE(0x26, 0x26) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w) AM_RANGE(0x27, 0x27) AM_DEVWRITE_LEGACY("msm", fromance_adpcm_reset_w) - AM_RANGE(0x28, 0x28) AM_WRITE_LEGACY(fromance_adpcm_w) + AM_RANGE(0x28, 0x28) AM_WRITE(fromance_adpcm_w) AM_RANGE(0x29, 0x2a) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_address_w) ADDRESS_MAP_END @@ -309,12 +302,12 @@ static ADDRESS_MAP_START( fromance_sub_io_map, AS_IO, 8, fromance_state ) AM_RANGE(0x10, 0x10) AM_WRITE_LEGACY(fromance_crtc_data_w) AM_RANGE(0x11, 0x11) AM_WRITE_LEGACY(fromance_crtc_register_w) AM_RANGE(0x12, 0x12) AM_READNOP // unknown - AM_RANGE(0x20, 0x20) AM_WRITE_LEGACY(fromance_rombank_w) - AM_RANGE(0x21, 0x21) AM_READWRITE_LEGACY(fromance_busycheck_sub_r, fromance_gfxreg_w) + AM_RANGE(0x20, 0x20) AM_WRITE(fromance_rombank_w) + AM_RANGE(0x21, 0x21) AM_READ(fromance_busycheck_sub_r) AM_WRITE_LEGACY(fromance_gfxreg_w) AM_RANGE(0x22, 0x25) AM_WRITE_LEGACY(fromance_scroll_w) - AM_RANGE(0x26, 0x26) AM_READWRITE_LEGACY(fromance_commanddata_r, fromance_busycheck_sub_w) + AM_RANGE(0x26, 0x26) AM_READWRITE(fromance_commanddata_r, fromance_busycheck_sub_w) AM_RANGE(0x27, 0x27) AM_DEVWRITE_LEGACY("msm", fromance_adpcm_reset_w) - AM_RANGE(0x28, 0x28) AM_WRITE_LEGACY(fromance_adpcm_w) + AM_RANGE(0x28, 0x28) AM_WRITE(fromance_adpcm_w) AM_RANGE(0x2a, 0x2b) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w) ADDRESS_MAP_END |