From faf61ec1057a91a9827e7bf1f55154c6f0dbc8de Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Tue, 15 May 2012 10:32:08 +0000 Subject: [PATCH] updating MAME drivers to use modern i8255 implementation instead of the legacy one, part 3 [Fabio Priuli] --- src/mame/drivers/galaxian.c | 196 +++++++++++++++++------------------ src/mame/drivers/scobra.c | 68 ++++++------ src/mame/drivers/scramble.c | 120 ++++++++++++++++----- src/mame/includes/galaxian.h | 12 ++- src/mame/includes/scramble.h | 22 ++-- src/mame/machine/scramble.c | 72 ++----------- 6 files changed, 257 insertions(+), 233 deletions(-) diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index 9c54dcc77ae..e8b5da7740f 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -417,7 +417,7 @@ TO DO : #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/s2650/s2650.h" -#include "machine/8255ppi.h" +#include "machine/i8255.h" #include "sound/ay8910.h" #include "sound/sn76496.h" #include "sound/dac.h" @@ -622,29 +622,27 @@ static WRITE8_DEVICE_HANDLER( konami_portc_1_w ) } -static const ppi8255_interface konami_ppi8255_0_intf = +static I8255A_INTERFACE( konami_ppi8255_0_intf ) { - DEVCB_INPUT_PORT("IN0"), /* Port A read */ - DEVCB_INPUT_PORT("IN1"), /* Port B read */ - DEVCB_INPUT_PORT("IN2"), /* Port C read */ - DEVCB_NULL, /* Port A write */ - DEVCB_NULL, /* Port B write */ - DEVCB_HANDLER(konami_portc_0_w) /* Port C write */ + DEVCB_INPUT_PORT("IN0"), /* Port A read */ + DEVCB_NULL, /* Port A write */ + DEVCB_INPUT_PORT("IN1"), /* Port B read */ + DEVCB_NULL, /* Port B write */ + DEVCB_INPUT_PORT("IN2"), /* Port C read */ + DEVCB_HANDLER(konami_portc_0_w) /* Port C write */ }; - -static const ppi8255_interface konami_ppi8255_1_intf = +static I8255A_INTERFACE( konami_ppi8255_1_intf ) { - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_INPUT_PORT("IN3"), /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(konami_sound_control_w), /* Port B write */ - DEVCB_HANDLER(konami_portc_1_w) /* Port C write */ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(konami_sound_control_w), /* Port B write */ + DEVCB_INPUT_PORT("IN3"), /* Port C read */ + DEVCB_HANDLER(konami_portc_1_w) /* Port C write */ }; - /************************************* * * The End I/O @@ -655,8 +653,8 @@ READ8_MEMBER(galaxian_state::theend_ppi8255_r) { /* the decoding here is very simplistic, and you can address both simultaneously */ UINT8 result = 0xff; - if (offset & 0x0100) result &= ppi8255_r(machine().device("ppi8255_0"), offset & 3); - if (offset & 0x0200) result &= ppi8255_r(machine().device("ppi8255_1"), offset & 3); + if (offset & 0x0100) result &= m_ppi8255_0->read(space, offset & 3); + if (offset & 0x0200) result &= m_ppi8255_1->read(space, offset & 3); return result; } @@ -664,8 +662,8 @@ READ8_MEMBER(galaxian_state::theend_ppi8255_r) WRITE8_MEMBER(galaxian_state::theend_ppi8255_w) { /* the decoding here is very simplistic, and you can address both simultaneously */ - if (offset & 0x0100) ppi8255_w(machine().device("ppi8255_0"), offset & 3, data); - if (offset & 0x0200) ppi8255_w(machine().device("ppi8255_1"), offset & 3, data); + if (offset & 0x0100) m_ppi8255_0->write(space, offset & 3, data); + if (offset & 0x0200) m_ppi8255_1->write(space, offset & 3, data); } @@ -675,14 +673,14 @@ static WRITE8_DEVICE_HANDLER( theend_coin_counter_w ) } -static const ppi8255_interface theend_ppi8255_0_intf = +static I8255A_INTERFACE( theend_ppi8255_0_intf ) { - DEVCB_INPUT_PORT("IN0"), /* Port A read */ - DEVCB_INPUT_PORT("IN1"), /* Port B read */ - DEVCB_INPUT_PORT("IN2"), /* Port C read */ - DEVCB_NULL, /* Port A write */ - DEVCB_NULL, /* Port B write */ - DEVCB_HANDLER(theend_coin_counter_w)/* Port C write */ + DEVCB_INPUT_PORT("IN0"), /* Port A read */ + DEVCB_NULL, /* Port A write */ + DEVCB_INPUT_PORT("IN1"), /* Port B read */ + DEVCB_NULL, /* Port B write */ + DEVCB_INPUT_PORT("IN2"), /* Port C read */ + DEVCB_HANDLER(theend_coin_counter_w) /* Port C write */ }; @@ -736,18 +734,17 @@ CUSTOM_INPUT_MEMBER(galaxian_state::scramble_protection_alt_r) } -static const ppi8255_interface scramble_ppi8255_1_intf = +static I8255A_INTERFACE( scramble_ppi8255_1_intf ) { - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_HANDLER(scramble_protection_r), /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(konami_sound_control_w), /* Port B write */ - DEVCB_HANDLER(scramble_protection_w) /* Port C write */ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(konami_sound_control_w), /* Port B write */ + DEVCB_HANDLER(scramble_protection_r), /* Port C read */ + DEVCB_HANDLER(scramble_protection_w) /* Port C write */ }; - /************************************* * * Explorer I/O @@ -779,7 +776,7 @@ READ8_MEMBER(galaxian_state::sfx_sample_io_r) { /* the decoding here is very simplistic, and you can address both simultaneously */ UINT8 result = 0xff; - if (offset & 0x04) result &= ppi8255_r(machine().device("ppi8255_2"), offset & 3); + if (offset & 0x04) result &= m_ppi8255_2->read(space, offset & 3); return result; } @@ -787,7 +784,7 @@ READ8_MEMBER(galaxian_state::sfx_sample_io_r) WRITE8_MEMBER(galaxian_state::sfx_sample_io_w) { /* the decoding here is very simplistic, and you can address both simultaneously */ - if (offset & 0x04) ppi8255_w(machine().device("ppi8255_2"), offset & 3, data); + if (offset & 0x04) m_ppi8255_2->write(space, offset & 3, data); if (offset & 0x10) dac_signed_data_w(machine().device("dac"), data); } @@ -805,18 +802,16 @@ static WRITE8_DEVICE_HANDLER( sfx_sample_control_w ) } -static const ppi8255_interface sfx_ppi8255_2_intf = +static I8255A_INTERFACE( sfx_ppi8255_2_intf ) { - DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_r), /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_NULL, /* Port C read */ - DEVCB_NULL, /* Port A write */ - DEVCB_NULL, /* Port B write */ - DEVCB_NULL /* Port C write */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch2_byte_r), /* Port A read */ + DEVCB_NULL, /* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_NULL, /* Port B write */ + DEVCB_NULL, /* Port C read */ + DEVCB_NULL /* Port C write */ }; - - /************************************* * * Monster Zero I/O @@ -879,18 +874,17 @@ static WRITE8_DEVICE_HANDLER( monsterz_portc_1_w ) { } -static const ppi8255_interface monsterz_ppi8255_1_intf = +static I8255A_INTERFACE( monsterz_ppi8255_1_intf ) { - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_INPUT_PORT("IN3"), /* Port C read */ - DEVCB_HANDLER(monsterz_porta_1_w), /* Port A write */ - DEVCB_HANDLER(monsterz_portb_1_w), /* Port B write */ - DEVCB_HANDLER(monsterz_portc_1_w) /* Port C write */ + DEVCB_NULL, /* Port A read */ + DEVCB_HANDLER(monsterz_porta_1_w), /* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(monsterz_portb_1_w), /* Port B write */ + DEVCB_INPUT_PORT("IN3"), /* Port C read */ + DEVCB_HANDLER(monsterz_portc_1_w) /* Port C write */ }; - /************************************* * * Frogger I/O @@ -901,8 +895,8 @@ READ8_MEMBER(galaxian_state::frogger_ppi8255_r) { /* the decoding here is very simplistic, and you can address both simultaneously */ UINT8 result = 0xff; - if (offset & 0x1000) result &= ppi8255_r(machine().device("ppi8255_1"), (offset >> 1) & 3); - if (offset & 0x2000) result &= ppi8255_r(machine().device("ppi8255_0"), (offset >> 1) & 3); + if (offset & 0x1000) result &= m_ppi8255_1->read(space, (offset >> 1) & 3); + if (offset & 0x2000) result &= m_ppi8255_0->read(space, (offset >> 1) & 3); return result; } @@ -910,8 +904,8 @@ READ8_MEMBER(galaxian_state::frogger_ppi8255_r) WRITE8_MEMBER(galaxian_state::frogger_ppi8255_w) { /* the decoding here is very simplistic, and you can address both simultaneously */ - if (offset & 0x1000) ppi8255_w(machine().device("ppi8255_1"), (offset >> 1) & 3, data); - if (offset & 0x2000) ppi8255_w(machine().device("ppi8255_0"), (offset >> 1) & 3, data); + if (offset & 0x1000) m_ppi8255_1->write(space, (offset >> 1) & 3, data); + if (offset & 0x2000) m_ppi8255_0->write(space, (offset >> 1) & 3, data); } @@ -960,8 +954,8 @@ READ8_MEMBER(galaxian_state::frogf_ppi8255_r) { /* the decoding here is very simplistic, and you can address both simultaneously */ UINT8 result = 0xff; - if (offset & 0x1000) result &= ppi8255_r(machine().device("ppi8255_0"), (offset >> 3) & 3); - if (offset & 0x2000) result &= ppi8255_r(machine().device("ppi8255_1"), (offset >> 3) & 3); + if (offset & 0x1000) result &= m_ppi8255_0->read(space, (offset >> 3) & 3); + if (offset & 0x2000) result &= m_ppi8255_1->read(space, (offset >> 3) & 3); return result; } @@ -969,8 +963,8 @@ READ8_MEMBER(galaxian_state::frogf_ppi8255_r) WRITE8_MEMBER(galaxian_state::frogf_ppi8255_w) { /* the decoding here is very simplistic, and you can address both simultaneously */ - if (offset & 0x1000) ppi8255_w(machine().device("ppi8255_0"), (offset >> 3) & 3, data); - if (offset & 0x2000) ppi8255_w(machine().device("ppi8255_1"), (offset >> 3) & 3, data); + if (offset & 0x1000) m_ppi8255_0->write(space, (offset >> 3) & 3, data); + if (offset & 0x2000) m_ppi8255_1->write(space, (offset >> 3) & 3, data); } @@ -981,10 +975,10 @@ WRITE8_MEMBER(galaxian_state::frogf_ppi8255_w) * *************************************/ -READ8_MEMBER(galaxian_state::turtles_ppi8255_0_r){ return ppi8255_r(machine().device("ppi8255_0"), (offset >> 4) & 3); } -READ8_MEMBER(galaxian_state::turtles_ppi8255_1_r){ return ppi8255_r(machine().device("ppi8255_1"), (offset >> 4) & 3); } -WRITE8_MEMBER(galaxian_state::turtles_ppi8255_0_w){ ppi8255_w(machine().device("ppi8255_0"), (offset >> 4) & 3, data); } -WRITE8_MEMBER(galaxian_state::turtles_ppi8255_1_w){ ppi8255_w(machine().device("ppi8255_1"), (offset >> 4) & 3, data); } +READ8_MEMBER(galaxian_state::turtles_ppi8255_0_r){ return m_ppi8255_0->read(space, (offset >> 4) & 3); } +READ8_MEMBER(galaxian_state::turtles_ppi8255_1_r){ return m_ppi8255_1->read(space, (offset >> 4) & 3); } +WRITE8_MEMBER(galaxian_state::turtles_ppi8255_0_w){ m_ppi8255_0->write(space, (offset >> 4) & 3, data); } +WRITE8_MEMBER(galaxian_state::turtles_ppi8255_1_w){ m_ppi8255_1->write(space, (offset >> 4) & 3, data); } @@ -1061,18 +1055,17 @@ static WRITE8_DEVICE_HANDLER( scorpion_digitalker_control_w ) digitalker_0_wr_w(device, data & 4 ? ASSERT_LINE : CLEAR_LINE); } -static const ppi8255_interface scorpion_ppi8255_1_intf = +static I8255A_INTERFACE( scorpion_ppi8255_1_intf ) { - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_HANDLER(scorpion_protection_r), /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(konami_sound_control_w), /* Port B write */ - DEVCB_HANDLER(scorpion_protection_w) /* Port C write */ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(konami_sound_control_w), /* Port B write */ + DEVCB_HANDLER(scorpion_protection_r), /* Port C read */ + DEVCB_HANDLER(scorpion_protection_w) /* Port C write */ }; - /************************************* * * Ghostmuncher Galaxian I/O @@ -1339,18 +1332,17 @@ static WRITE8_DEVICE_HANDLER( moonwar_port_select_w ) } -static const ppi8255_interface moonwar_ppi8255_0_intf = +static I8255A_INTERFACE( moonwar_ppi8255_0_intf ) { DEVCB_INPUT_PORT("IN0"), /* Port A read */ - DEVCB_INPUT_PORT("IN1"), /* Port B read */ - DEVCB_INPUT_PORT("IN2"), /* Port C read */ DEVCB_NULL, /* Port A write */ + DEVCB_INPUT_PORT("IN1"), /* Port B read */ DEVCB_NULL, /* Port B write */ + DEVCB_INPUT_PORT("IN2"), /* Port C read */ DEVCB_HANDLER(moonwar_port_select_w) /* Port C write */ }; - /************************************* * * Memory maps @@ -1551,8 +1543,8 @@ static ADDRESS_MAP_START( scobra_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x4000) AM_RAM AM_RANGE(0x8800, 0x8bff) AM_MIRROR(0x4400) AM_RAM_WRITE(galaxian_videoram_w) AM_SHARE("videoram") AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x4700) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram") - AM_RANGE(0x9800, 0x9803) AM_MIRROR(0x47fc) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x47fc) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x9800, 0x9803) AM_MIRROR(0x47fc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0xa000, 0xa003) AM_MIRROR(0x47fc) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0xa801, 0xa801) AM_MIRROR(0x47f8) AM_WRITE(irq_enable_w) AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x47f8) AM_WRITE(coin_count_0_w) AM_RANGE(0xa803, 0xa803) AM_MIRROR(0x47f8) AM_WRITE(scramble_background_enable_w) @@ -1579,8 +1571,8 @@ static ADDRESS_MAP_START( anteateruk_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0x1200, 0x12ff) AM_MIRROR(0x0100) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram") AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x03ff) AM_READ(watchdog_reset_r) AM_RANGE(0x4000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x3efc) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) - AM_RANGE(0xc100, 0xc103) AM_MIRROR(0x3efc) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) + AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) + AM_RANGE(0xc100, 0xc103) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) ADDRESS_MAP_END @@ -1590,7 +1582,7 @@ static ADDRESS_MAP_START( anteaterg_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0x0400, 0x0bff) AM_RAM AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(galaxian_videoram_w) AM_SHARE("videoram") AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram") - AM_RANGE(0x2400, 0x2403) AM_MIRROR(0x01fc) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x2400, 0x2403) AM_MIRROR(0x01fc) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0x2601, 0x2601) AM_MIRROR(0x01f8) AM_WRITE(irq_enable_w) AM_RANGE(0x2602, 0x2602) AM_MIRROR(0x01f8) AM_WRITE(coin_count_0_w) AM_RANGE(0x2603, 0x2603) AM_MIRROR(0x01f8) AM_WRITE(scramble_background_enable_w) @@ -1601,7 +1593,7 @@ static ADDRESS_MAP_START( anteaterg_map, AS_PROGRAM, 8, galaxian_state ) AM_RANGE(0x4000, 0xbfff) AM_ROM AM_RANGE(0x7c00, 0x7fff) AM_RAM_WRITE(galaxian_videoram_w) AM_SHARE("videoram") /* mirror! */ AM_RANGE(0xf400, 0xf400) AM_MIRROR(0x01ff) AM_READ(watchdog_reset_r) - AM_RANGE(0xf600, 0xf603) AM_MIRROR(0x01fc) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) + AM_RANGE(0xf600, 0xf603) AM_MIRROR(0x01fc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) ADDRESS_MAP_END @@ -2126,8 +2118,8 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( konami_base, galaxian_base ) - MCFG_PPI8255_ADD( "ppi8255_0", konami_ppi8255_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", konami_ppi8255_1_intf ) + MCFG_I8255A_ADD( "ppi8255_0", konami_ppi8255_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", konami_ppi8255_1_intf ) MACHINE_CONFIG_END @@ -2387,8 +2379,8 @@ static MACHINE_CONFIG_DERIVED( theend, galaxian_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(theend_map) - MCFG_PPI8255_ADD( "ppi8255_0", theend_ppi8255_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", konami_ppi8255_1_intf ) + MCFG_I8255A_ADD( "ppi8255_0", theend_ppi8255_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", konami_ppi8255_1_intf ) MACHINE_CONFIG_END @@ -2399,8 +2391,8 @@ static MACHINE_CONFIG_DERIVED( scramble, galaxian_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(theend_map) - MCFG_PPI8255_ADD( "ppi8255_0", konami_ppi8255_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", scramble_ppi8255_1_intf ) + MCFG_I8255A_ADD( "ppi8255_0", konami_ppi8255_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", scramble_ppi8255_1_intf ) MACHINE_CONFIG_END @@ -2428,8 +2420,10 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( scorpion, theend ) - MCFG_PPI8255_RECONFIG( "ppi8255_0", konami_ppi8255_0_intf ) - MCFG_PPI8255_RECONFIG( "ppi8255_1", scorpion_ppi8255_1_intf ) + MCFG_DEVICE_REMOVE("ppi8255_0") + MCFG_DEVICE_REMOVE("ppi8255_1") + MCFG_I8255A_ADD( "ppi8255_0", konami_ppi8255_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", scorpion_ppi8255_1_intf ) /* extra AY8910 with I/O ports */ MCFG_SOUND_ADD("8910.2", AY8910, KONAMI_SOUND_CLOCK/8) @@ -2455,9 +2449,9 @@ static MACHINE_CONFIG_DERIVED( sfx, galaxian_base ) MCFG_CPU_PROGRAM_MAP(sfx_sample_map) MCFG_CPU_IO_MAP(sfx_sample_portmap) - MCFG_PPI8255_ADD( "ppi8255_0", konami_ppi8255_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", konami_ppi8255_1_intf ) - MCFG_PPI8255_ADD( "ppi8255_2", sfx_ppi8255_2_intf ) + MCFG_I8255A_ADD( "ppi8255_0", konami_ppi8255_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", konami_ppi8255_1_intf ) + MCFG_I8255A_ADD( "ppi8255_2", sfx_ppi8255_2_intf ) /* port on 2nd 8910 is used for communication */ MCFG_SOUND_MODIFY("8910.1") @@ -2475,7 +2469,8 @@ static MACHINE_CONFIG_DERIVED( monsterz, sfx ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(monsterz_map) - MCFG_PPI8255_RECONFIG( "ppi8255_1", monsterz_ppi8255_1_intf ) + MCFG_DEVICE_REMOVE("ppi8255_1") + MCFG_I8255A_ADD( "ppi8255_1", monsterz_ppi8255_1_intf ) /* there are likely other differences too, but those can wait until after protection is sorted out */ @@ -2518,9 +2513,10 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( moonwar, scobra ) - /* device config overrides */ - MCFG_PPI8255_RECONFIG( "ppi8255_0", moonwar_ppi8255_0_intf ) - MCFG_PPI8255_RECONFIG( "ppi8255_1", konami_ppi8255_1_intf ) + MCFG_DEVICE_REMOVE("ppi8255_0") + MCFG_DEVICE_REMOVE("ppi8255_1") + MCFG_I8255A_ADD( "ppi8255_0", moonwar_ppi8255_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", konami_ppi8255_1_intf ) MCFG_PALETTE_INIT(moonwar) // bullets are less yellow MACHINE_CONFIG_END diff --git a/src/mame/drivers/scobra.c b/src/mame/drivers/scobra.c index 6180489fd17..23276d70b5c 100644 --- a/src/mame/drivers/scobra.c +++ b/src/mame/drivers/scobra.c @@ -34,7 +34,7 @@ Notes/Tidbits: #include "emu.h" #include "cpu/z80/z80.h" -#include "machine/8255ppi.h" +#include "machine/i8255.h" #include "machine/7474.h" #include "sound/ay8910.h" #include "includes/scramble.h" @@ -50,6 +50,14 @@ public: optional_shared_ptr m_soundram; DECLARE_READ8_MEMBER(scobra_soundram_r); DECLARE_WRITE8_MEMBER(scobra_soundram_w); + DECLARE_READ8_MEMBER(scobra_type2_ppi8255_0_r); + DECLARE_READ8_MEMBER(scobra_type2_ppi8255_1_r); + DECLARE_READ8_MEMBER(hustler_ppi8255_0_r); + DECLARE_READ8_MEMBER(hustler_ppi8255_1_r); + DECLARE_WRITE8_MEMBER(scobra_type2_ppi8255_0_w); + DECLARE_WRITE8_MEMBER(scobra_type2_ppi8255_1_w); + DECLARE_WRITE8_MEMBER(hustler_ppi8255_0_w); + DECLARE_WRITE8_MEMBER(hustler_ppi8255_1_w); DECLARE_CUSTOM_INPUT_MEMBER(stratgyx_coinage_r); }; @@ -96,25 +104,15 @@ static const ay8910_interface hustler_ay8910_interface = DEVCB_NULL }; -static READ8_DEVICE_HANDLER(scobra_type2_ppi8255_r) -{ - return ppi8255_r(device, offset >> 2); -} +READ8_MEMBER(scobra_state::scobra_type2_ppi8255_0_r){ return m_ppi8255_0->read(space, offset >> 2); } +READ8_MEMBER(scobra_state::scobra_type2_ppi8255_1_r){ return m_ppi8255_1->read(space, offset >> 2); } +WRITE8_MEMBER(scobra_state::scobra_type2_ppi8255_0_w){ m_ppi8255_0->write(space, offset >> 2, data); } +WRITE8_MEMBER(scobra_state::scobra_type2_ppi8255_1_w){ m_ppi8255_1->write(space, offset >> 2, data); } -static WRITE8_DEVICE_HANDLER(scobra_type2_ppi8255_w) -{ - ppi8255_w(device, offset >> 2, data); -} - -static READ8_DEVICE_HANDLER(hustler_ppi8255_r) -{ - return ppi8255_r(device, offset >> 3); -} - -static WRITE8_DEVICE_HANDLER(hustler_ppi8255_w) -{ - ppi8255_w(device, offset >> 3, data); -} +READ8_MEMBER(scobra_state::hustler_ppi8255_0_r){ return m_ppi8255_0->read(space, offset >> 3); } +READ8_MEMBER(scobra_state::hustler_ppi8255_1_r){ return m_ppi8255_1->read(space, offset >> 3); } +WRITE8_MEMBER(scobra_state::hustler_ppi8255_0_w){ m_ppi8255_0->write(space, offset >> 3, data); } +WRITE8_MEMBER(scobra_state::hustler_ppi8255_1_w){ m_ppi8255_1->write(space, offset >> 3, data); } static ADDRESS_MAP_START( type1_map, AS_PROGRAM, 8, scobra_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM @@ -126,8 +124,8 @@ static ADDRESS_MAP_START( type1_map, AS_PROGRAM, 8, scobra_state ) AM_RANGE(0x9040, 0x905f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x9060, 0x907f) AM_RAM AM_SHARE("bulletsram") AM_RANGE(0x9080, 0x90ff) AM_RAM - AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0xa801, 0xa801) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0xa802, 0xa802) AM_WRITE(galaxold_coin_counter_w) AM_RANGE(0xa804, 0xa804) AM_WRITE(galaxold_stars_enable_w) @@ -146,8 +144,8 @@ static ADDRESS_MAP_START( type2_map, AS_PROGRAM, 8, scobra_state ) AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_SHARE("videoram") AM_RANGE(0x9400, 0x97ff) AM_READWRITE(galaxold_videoram_r, galaxold_videoram_w) /* mirror */ AM_RANGE(0x9800, 0x9800) AM_READ(watchdog_reset_r) - AM_RANGE(0xa000, 0xa00f) AM_DEVREADWRITE_LEGACY("ppi8255_0", scobra_type2_ppi8255_r, scobra_type2_ppi8255_w) - AM_RANGE(0xa800, 0xa80f) AM_DEVREADWRITE_LEGACY("ppi8255_1", scobra_type2_ppi8255_r, scobra_type2_ppi8255_w) + AM_RANGE(0xa000, 0xa00f) AM_READWRITE(scobra_type2_ppi8255_0_r, scobra_type2_ppi8255_0_w) + AM_RANGE(0xa800, 0xa80f) AM_READWRITE(scobra_type2_ppi8255_1_r, scobra_type2_ppi8255_1_w) AM_RANGE(0xb000, 0xb000) AM_WRITE(galaxold_stars_enable_w) AM_RANGE(0xb004, 0xb004) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0xb006, 0xb006) AM_WRITE(galaxold_coin_counter_0_w) @@ -169,8 +167,8 @@ static ADDRESS_MAP_START( hustler_map, AS_PROGRAM, 8, scobra_state ) AM_RANGE(0xa806, 0xa806) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0xa80e, 0xa80e) AM_WRITENOP /* coin counters */ AM_RANGE(0xb800, 0xb800) AM_READ(watchdog_reset_r) - AM_RANGE(0xd000, 0xd01f) AM_DEVREADWRITE_LEGACY("ppi8255_0", hustler_ppi8255_r, hustler_ppi8255_w) - AM_RANGE(0xe000, 0xe01f) AM_DEVREADWRITE_LEGACY("ppi8255_1", hustler_ppi8255_r, hustler_ppi8255_w) + AM_RANGE(0xd000, 0xd01f) AM_READWRITE(hustler_ppi8255_0_r, hustler_ppi8255_0_w) + AM_RANGE(0xe000, 0xe01f) AM_READWRITE(hustler_ppi8255_1_r, hustler_ppi8255_1_w) ADDRESS_MAP_END static ADDRESS_MAP_START( hustlerb_map, AS_PROGRAM, 8, scobra_state ) @@ -186,8 +184,8 @@ static ADDRESS_MAP_START( hustlerb_map, AS_PROGRAM, 8, scobra_state ) AM_RANGE(0xa806, 0xa806) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0xa807, 0xa807) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0xb000, 0xb000) AM_READ(watchdog_reset_r) - AM_RANGE(0xc100, 0xc103) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0xc200, 0xc203) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0xc100, 0xc103) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0xc200, 0xc203) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) ADDRESS_MAP_END static ADDRESS_MAP_START( mimonkey_map, AS_PROGRAM, 8, scobra_state ) @@ -199,8 +197,8 @@ static ADDRESS_MAP_START( mimonkey_map, AS_PROGRAM, 8, scobra_state ) AM_RANGE(0x9040, 0x905f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x9060, 0x907f) AM_RAM AM_SHARE("bulletsram") AM_RANGE(0x9080, 0x90ff) AM_RAM - AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x9800, 0x9803) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0xa000, 0xa003) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0xa801, 0xa801) AM_WRITE(galaxold_nmi_enable_w) AM_RANGE(0xa800, 0xa802) AM_WRITE(galaxold_gfxbank_w) AM_RANGE(0xa806, 0xa806) AM_WRITE(galaxold_flip_screen_x_w) @@ -669,8 +667,8 @@ static MACHINE_CONFIG_START( type1, scobra_state ) MCFG_MACHINE_RESET(scramble) - MCFG_PPI8255_ADD( "ppi8255_0", scramble_ppi_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", scramble_ppi_1_intf ) + MCFG_I8255A_ADD( "ppi8255_0", scramble_ppi_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", scramble_ppi_1_intf ) MCFG_7474_ADD("7474_9m_1", "7474_9m_1", galaxold_7474_9m_1_callback, NULL) MCFG_7474_ADD("7474_9m_2", "7474_9m_1", NULL, galaxold_7474_9m_2_q_callback) @@ -754,8 +752,8 @@ static MACHINE_CONFIG_DERIVED( stratgyx, type2 ) /* basic machine hardware */ - /* device config overrides */ - MCFG_PPI8255_RECONFIG( "ppi8255_1", stratgyx_ppi_1_intf ) + MCFG_DEVICE_REMOVE("ppi8255_1") + MCFG_I8255A_ADD( "ppi8255_1", stratgyx_ppi_1_intf ) /* video hardware */ MCFG_PALETTE_LENGTH(32+64+2+8) /* 32 for characters, 64 for stars, 2 for bullets, 8 for background */ @@ -797,8 +795,8 @@ static MACHINE_CONFIG_START( hustler, scobra_state ) MCFG_TIMER_ADD("int_timer", galaxold_interrupt_timer) /* device config overrides */ - MCFG_PPI8255_ADD( "ppi8255_0", scramble_ppi_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", scramble_ppi_1_intf ) + MCFG_I8255A_ADD( "ppi8255_0", scramble_ppi_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", scramble_ppi_1_intf ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/scramble.c b/src/mame/drivers/scramble.c index 829f3aa65d5..c796448ec05 100644 --- a/src/mame/drivers/scramble.c +++ b/src/mame/drivers/scramble.c @@ -32,7 +32,7 @@ Notes: #include "sound/dac.h" #include "sound/flt_rc.h" #include "machine/7474.h" -#include "machine/8255ppi.h" +#include "machine/i8255.h" #include "includes/scramble.h" @@ -53,9 +53,9 @@ static ADDRESS_MAP_START( scramble_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x6807, 0x6807) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x7000, 0x7000) AM_READ(watchdog_reset_r) AM_RANGE(0x7800, 0x7800) AM_READ(watchdog_reset_r) - AM_RANGE(0x8100, 0x8103) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0x8110, 0x8113) AM_DEVREAD_LEGACY("ppi8255_0", ppi8255_r) /* mirror for Frog */ - AM_RANGE(0x8200, 0x8203) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x8100, 0x8103) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0x8110, 0x8113) AM_DEVREAD("ppi8255_0", i8255_device, read) /* mirror for Frog */ + AM_RANGE(0x8200, 0x8203) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) ADDRESS_MAP_END @@ -79,12 +79,12 @@ static ADDRESS_MAP_START( turpins_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0xa806, 0xa806) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0xa807, 0xa807) AM_WRITE(galaxold_flip_screen_y_w) /* don't know where these are */ -// AM_RANGE(0x8100, 0x8103) AM_WRITE_LEGACY(ppi8255_0_w) -// AM_RANGE(0x8200, 0x8203) AM_WRITE_LEGACY(ppi8255_1_w) +// AM_RANGE(0x8100, 0x8103) AM_WRITE("ppi8255_0", i8255_device, write) +// AM_RANGE(0x8200, 0x8203) AM_WRITE("ppi8255_1", i8255_device, write) AM_RANGE(0xb800, 0xb800) AM_READ(watchdog_reset_r) -// AM_RANGE(0x8100, 0x8103) AM_READ_LEGACY(ppi8255_0_r) -// AM_RANGE(0x8200, 0x8203) AM_READ_LEGACY(ppi8255_1_r) +// AM_RANGE(0x8100, 0x8103) AM_READ("ppi8255_0", i8255_device, read) +// AM_RANGE(0x8200, 0x8203) AM_READ("ppi8255_1", i8255_device, read) AM_RANGE(0xf000, 0xffff) AM_READONLY ADDRESS_MAP_END @@ -92,8 +92,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( ckongs_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x6000, 0x6bff) AM_RAM - AM_RANGE(0x7000, 0x7003) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0x7800, 0x7803) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x7000, 0x7003) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0x7800, 0x7803) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(galaxold_videoram_w) AM_SHARE("videoram") AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(galaxold_attributesram_w) AM_SHARE("attributesram") AM_RANGE(0x9840, 0x985f) AM_RAM AM_SHARE("spriteram") @@ -107,16 +107,25 @@ static ADDRESS_MAP_START( ckongs_map, AS_PROGRAM, 8, scramble_state ) ADDRESS_MAP_END -static READ8_DEVICE_HANDLER(mars_ppi8255_r) +READ8_MEMBER(scramble_state::mars_ppi8255_0_r) { - return ppi8255_r(device, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01)); + return m_ppi8255_0->read(space, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01)); } -static WRITE8_DEVICE_HANDLER(mars_ppi8255_w) +READ8_MEMBER(scramble_state::mars_ppi8255_1_r) { - ppi8255_w(device, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data); + return m_ppi8255_1->read(space, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01)); } +WRITE8_MEMBER(scramble_state::mars_ppi8255_0_w) +{ + m_ppi8255_0->write(space, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data); +} + +WRITE8_MEMBER(scramble_state::mars_ppi8255_1_w) +{ + m_ppi8255_1->write(space, ((offset >> 2) & 0x02) | ((offset >> 1) & 0x01), data); +} static ADDRESS_MAP_START( mars_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM @@ -135,8 +144,8 @@ static ADDRESS_MAP_START( mars_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x680b, 0x680b) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x7000, 0x7000) AM_READ(watchdog_reset_r) AM_RANGE(0x7000, 0x7000) AM_READNOP - AM_RANGE(0x8100, 0x810f) AM_DEVREADWRITE_LEGACY("ppi8255_0", mars_ppi8255_r, mars_ppi8255_w) - AM_RANGE(0x8200, 0x820f) AM_DEVREADWRITE_LEGACY("ppi8255_1", mars_ppi8255_r, mars_ppi8255_w) + AM_RANGE(0x8100, 0x810f) AM_READWRITE(mars_ppi8255_0_r, mars_ppi8255_0_w) + AM_RANGE(0x8200, 0x820f) AM_READWRITE(mars_ppi8255_1_r, mars_ppi8255_1_w) ADDRESS_MAP_END @@ -156,9 +165,9 @@ static ADDRESS_MAP_START( newsin7_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x6809, 0x6809) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x680b, 0x680b) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x7000, 0x7000) AM_READ(watchdog_reset_r) - AM_RANGE(0x8200, 0x820f) AM_DEVREADWRITE_LEGACY("ppi8255_1", mars_ppi8255_r, mars_ppi8255_w) + AM_RANGE(0x8200, 0x820f) AM_READWRITE(mars_ppi8255_1_r, mars_ppi8255_1_w) AM_RANGE(0xa000, 0xafff) AM_ROM - AM_RANGE(0xc100, 0xc10f) AM_DEVREADWRITE_LEGACY("ppi8255_0", mars_ppi8255_r, mars_ppi8255_w) + AM_RANGE(0xc100, 0xc10f) AM_READWRITE(mars_ppi8255_0_r, mars_ppi8255_0_w) ADDRESS_MAP_END @@ -177,8 +186,8 @@ static ADDRESS_MAP_START( mrkougar_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x6809, 0x6809) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x680b, 0x680b) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x7000, 0x7000) AM_READ(watchdog_reset_r) - AM_RANGE(0x8100, 0x810f) AM_DEVREADWRITE_LEGACY("ppi8255_0", mars_ppi8255_r, mars_ppi8255_w) - AM_RANGE(0x8200, 0x820f) AM_DEVREADWRITE_LEGACY("ppi8255_1", mars_ppi8255_r, mars_ppi8255_w) + AM_RANGE(0x8100, 0x810f) AM_READWRITE(mars_ppi8255_0_r, mars_ppi8255_0_w) + AM_RANGE(0x8200, 0x820f) AM_READWRITE(mars_ppi8255_1_r, mars_ppi8255_1_w) ADDRESS_MAP_END @@ -208,12 +217,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( hunchbks_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x0000, 0x0fff) AM_ROM - AM_RANGE(0x1210, 0x1213) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x1210, 0x1213) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0x1400, 0x143f) AM_RAM_WRITE(galaxold_attributesram_w) AM_SHARE("attributesram") AM_RANGE(0x1440, 0x145f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x1460, 0x147f) AM_RAM AM_SHARE("bulletsram") AM_RANGE(0x1480, 0x14ff) AM_RAM - AM_RANGE(0x1500, 0x1503) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) + AM_RANGE(0x1500, 0x1503) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) AM_RANGE(0x1606, 0x1606) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x1607, 0x1607) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x1680, 0x1680) AM_READ(watchdog_reset_r) @@ -243,8 +252,8 @@ static ADDRESS_MAP_START( mimonscr_map, AS_PROGRAM, 8, scramble_state ) AM_RANGE(0x6806, 0x6806) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x6807, 0x6807) AM_WRITE(galaxold_flip_screen_y_w) AM_RANGE(0x7000, 0x7000) AM_READ(watchdog_reset_r) - AM_RANGE(0x8100, 0x8103) AM_DEVREADWRITE_LEGACY("ppi8255_0", ppi8255_r, ppi8255_w) - AM_RANGE(0x8200, 0x8203) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) + AM_RANGE(0x8100, 0x8103) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write) + AM_RANGE(0x8200, 0x8203) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write) AM_RANGE(0xc000, 0xffff) AM_ROM ADDRESS_MAP_END @@ -1148,6 +1157,59 @@ static GFXDECODE_START( ad2083 ) GFXDECODE_ENTRY( "gfx1", 0x0000, ad2083_spritelayout, 0, 8 ) GFXDECODE_END + + +I8255A_INTERFACE( scramble_ppi_0_intf ) +{ + DEVCB_INPUT_PORT("IN0"), /* Port A read */ + DEVCB_NULL, /* Port A write */ + DEVCB_INPUT_PORT("IN1"), /* Port B read */ + DEVCB_NULL, /* Port B write */ + DEVCB_INPUT_PORT("IN2"), /* Port C read */ + DEVCB_NULL /* Port C write */ +}; + +I8255A_INTERFACE( scramble_ppi_1_intf ) +{ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(scramble_sh_irqtrigger_w),/* Port B write */ + DEVCB_NULL, /* Port C read */ + DEVCB_NULL /* Port C write */ +}; + +I8255A_INTERFACE( stratgyx_ppi_1_intf ) +{ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(scramble_sh_irqtrigger_w),/* Port B write */ + DEVCB_INPUT_PORT("IN3"), /* Port C read */ + DEVCB_NULL /* Port C write */ +}; + +I8255A_INTERFACE( scramble_protection_ppi_1_intf ) +{ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(scramble_sh_irqtrigger_w),/* Port B write */ + DEVCB_HANDLER(scramble_protection_r), /* Port C read */ + DEVCB_HANDLER(scramble_protection_w) /* Port C write */ +}; + +I8255A_INTERFACE( mrkougar_ppi_1_intf ) +{ + DEVCB_NULL, /* Port A read */ + DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w),/* Port A write */ + DEVCB_NULL, /* Port B read */ + DEVCB_HANDLER(mrkougar_sh_irqtrigger_w),/* Port B write */ + DEVCB_NULL, /* Port C read */ + DEVCB_NULL /* Port C write */ +}; + + static const ay8910_interface scramble_ay8910_interface_2 = { AY8910_LEGACY_OUTPUT, @@ -1251,8 +1313,8 @@ static MACHINE_CONFIG_START( scramble, scramble_state ) MCFG_MACHINE_RESET(scramble) - MCFG_PPI8255_ADD( "ppi8255_0", scramble_ppi_0_intf ) - MCFG_PPI8255_ADD( "ppi8255_1", scramble_ppi_1_intf ) + MCFG_I8255A_ADD( "ppi8255_0", scramble_ppi_0_intf ) + MCFG_I8255A_ADD( "ppi8255_1", scramble_ppi_1_intf ) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1320,7 +1382,8 @@ static MACHINE_CONFIG_DERIVED( mrkougar, scramble ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(mrkougar_map) - MCFG_PPI8255_RECONFIG( "ppi8255_1", mrkougar_ppi_1_intf ) + MCFG_DEVICE_REMOVE("ppi8255_1") + MCFG_I8255A_ADD( "ppi8255_1", mrkougar_ppi_1_intf ) /* video hardware */ MCFG_GFXDECODE(mrkougar) @@ -1334,7 +1397,8 @@ static MACHINE_CONFIG_DERIVED( mrkougb, scramble ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(mrkougar_map) - MCFG_PPI8255_RECONFIG( "ppi8255_1", mrkougar_ppi_1_intf ) + MCFG_DEVICE_REMOVE("ppi8255_1") + MCFG_I8255A_ADD( "ppi8255_1", mrkougar_ppi_1_intf ) /* video hardware */ MCFG_PALETTE_LENGTH(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */ diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h index b53b55f9627..5806c903734 100644 --- a/src/mame/includes/galaxian.h +++ b/src/mame/includes/galaxian.h @@ -4,6 +4,8 @@ ***************************************************************************/ +#include "machine/i8255.h" + /* we scale horizontally by 3 to render stars correctly */ #define GALAXIAN_XSCALE 3 @@ -37,9 +39,15 @@ class galaxian_state : public driver_device public: galaxian_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram") , - m_videoram(*this, "videoram"){ } + m_ppi8255_0(*this, "ppi8255_0"), + m_ppi8255_1(*this, "ppi8255_1"), + m_ppi8255_2(*this, "ppi8255_2"), + m_spriteram(*this, "spriteram"), + m_videoram(*this, "videoram"){ } + optional_device m_ppi8255_0; + optional_device m_ppi8255_1; + optional_device m_ppi8255_2; required_shared_ptr m_spriteram; required_shared_ptr m_videoram; diff --git a/src/mame/includes/scramble.h b/src/mame/includes/scramble.h index e4a51eb4c7c..13b4c53611f 100644 --- a/src/mame/includes/scramble.h +++ b/src/mame/includes/scramble.h @@ -1,4 +1,4 @@ -#include "machine/8255ppi.h" +#include "machine/i8255.h" #include "includes/galaxold.h" class scramble_state : public galaxold_state @@ -6,8 +6,12 @@ class scramble_state : public galaxold_state public: scramble_state(const machine_config &mconfig, device_type type, const char *tag) : galaxold_state(mconfig, type, tag), + m_ppi8255_0(*this, "ppi8255_0"), + m_ppi8255_1(*this, "ppi8255_1"), m_soundram(*this, "soundram") { } + optional_device m_ppi8255_0; + optional_device m_ppi8255_1; optional_shared_ptr m_soundram; UINT8 m_cavelon_bank; UINT8 m_security_2B_counter; @@ -16,21 +20,22 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(ckongs_coinage_r); DECLARE_READ8_MEMBER(hncholms_prot_r); DECLARE_READ8_MEMBER(scramble_soundram_r); + DECLARE_READ8_MEMBER(mars_ppi8255_0_r); + DECLARE_READ8_MEMBER(mars_ppi8255_1_r); DECLARE_WRITE8_MEMBER(scramble_soundram_w); DECLARE_WRITE8_MEMBER(hotshock_sh_irqtrigger_w); DECLARE_WRITE8_MEMBER(scramble_filter_w); DECLARE_WRITE8_MEMBER(frogger_filter_w); + DECLARE_WRITE8_MEMBER(mars_ppi8255_0_w); + DECLARE_WRITE8_MEMBER(mars_ppi8255_1_w); }; /*----------- defined in machine/scramble.c -----------*/ -extern const ppi8255_interface scramble_ppi_0_intf; -extern const ppi8255_interface scramble_ppi_1_intf; -extern const ppi8255_interface stratgyx_ppi_1_intf; -extern const ppi8255_interface scramble_protection_ppi_1_intf; -extern const ppi8255_interface mrkougar_ppi_1_intf; - +extern const i8255_interface(scramble_ppi_0_intf); +extern const i8255_interface(scramble_ppi_1_intf); +extern const i8255_interface(stratgyx_ppi_1_intf); DRIVER_INIT( scramble_ppi ); DRIVER_INIT( stratgyx ); @@ -63,6 +68,9 @@ READ8_HANDLER( triplep_pap_r ); READ8_HANDLER( hunchbks_mirror_r ); WRITE8_HANDLER( hunchbks_mirror_w ); +READ8_DEVICE_HANDLER( scramble_protection_r ); +WRITE8_DEVICE_HANDLER( scramble_protection_w ); + /*----------- defined in audio/scramble.c -----------*/ diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index 6b6940f7ee2..3d6aca950e8 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -9,7 +9,7 @@ #include "emu.h" #include "cpu/z80/z80.h" -#include "machine/8255ppi.h" +#include "machine/i8255.h" #include "includes/scramble.h" @@ -50,13 +50,13 @@ CUSTOM_INPUT_MEMBER(scramble_state::darkplnt_custom_r) /* state of the security PAL (6J) */ -static WRITE8_DEVICE_HANDLER( scramble_protection_w ) +WRITE8_DEVICE_HANDLER( scramble_protection_w ) { scramble_state *state = device->machine().driver_data(); state->m_xb = data; } -static READ8_DEVICE_HANDLER( scramble_protection_r ) +READ8_DEVICE_HANDLER( scramble_protection_r ) { switch (cpu_get_pc(device->machine().device("maincpu"))) { @@ -116,24 +116,26 @@ static void cavelon_banksw(running_machine &machine) static READ8_HANDLER( cavelon_banksw_r ) { + scramble_state *state = space->machine().driver_data(); cavelon_banksw(space->machine()); - if ((offset >= 0x0100) && (offset <= 0x0103)) - return ppi8255_r(space->machine().device("ppi8255_0"), offset - 0x0100); + if ((offset >= 0x0100) && (offset <= 0x0103)) + return state->m_ppi8255_0->read(*space, offset - 0x0100); else if ((offset >= 0x0200) && (offset <= 0x0203)) - return ppi8255_r(space->machine().device("ppi8255_1"), offset - 0x0200); + return state->m_ppi8255_1->read(*space, offset - 0x0200); return 0xff; } static WRITE8_HANDLER( cavelon_banksw_w ) { + scramble_state *state = space->machine().driver_data(); cavelon_banksw(space->machine()); - if ((offset >= 0x0100) && (offset <= 0x0103)) - ppi8255_w(space->machine().device("ppi8255_0"), offset - 0x0100, data); + if ((offset >= 0x0100) && (offset <= 0x0103)) + state->m_ppi8255_0->write(*space, offset - 0x0100, data); else if ((offset >= 0x0200) && (offset <= 0x0203)) - ppi8255_w(space->machine().device("ppi8255_1"), offset - 0x0200, data); + state->m_ppi8255_1->write(*space, offset - 0x0200, data); } @@ -147,58 +149,6 @@ WRITE8_HANDLER( hunchbks_mirror_w ) space->write_byte(0x1000+offset,data); } -const ppi8255_interface scramble_ppi_0_intf = -{ - DEVCB_INPUT_PORT("IN0"), /* Port A read */ - DEVCB_INPUT_PORT("IN1"), /* Port B read */ - DEVCB_INPUT_PORT("IN2"), /* Port C read */ - DEVCB_NULL, /* Port A write */ - DEVCB_NULL, /* Port B write */ - DEVCB_NULL /* Port C write */ -}; - -const ppi8255_interface scramble_ppi_1_intf = -{ - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_NULL, /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(scramble_sh_irqtrigger_w), /* Port B write */ - DEVCB_NULL /* Port C write */ -}; - - -const ppi8255_interface stratgyx_ppi_1_intf = -{ - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_INPUT_PORT("IN3"), /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(scramble_sh_irqtrigger_w), /* Port B write */ - DEVCB_NULL /* Port C write */ -}; - - -const ppi8255_interface scramble_protection_ppi_1_intf = -{ - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_HANDLER(scramble_protection_r), /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(scramble_sh_irqtrigger_w), /* Port B write */ - DEVCB_HANDLER(scramble_protection_w) /* Port C write */ -}; - - -const ppi8255_interface mrkougar_ppi_1_intf = -{ - DEVCB_NULL, /* Port A read */ - DEVCB_NULL, /* Port B read */ - DEVCB_NULL, /* Port C read */ - DEVCB_DRIVER_MEMBER(driver_device, soundlatch_byte_w), /* Port A write */ - DEVCB_HANDLER(mrkougar_sh_irqtrigger_w), /* Port B write */ - DEVCB_NULL /* Port C write */ -}; DRIVER_INIT( scramble_ppi )