diff --git a/src/mame/drivers/boogwing.cpp b/src/mame/drivers/boogwing.cpp index eedc7fcd2dc..3c073ab7546 100644 --- a/src/mame/drivers/boogwing.cpp +++ b/src/mame/drivers/boogwing.cpp @@ -389,6 +389,9 @@ static MACHINE_CONFIG_START( boogwing ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR diff --git a/src/mame/drivers/cninja.cpp b/src/mame/drivers/cninja.cpp index c2b83f147b2..3b683834867 100644 --- a/src/mame/drivers/cninja.cpp +++ b/src/mame/drivers/cninja.cpp @@ -926,6 +926,9 @@ static MACHINE_CONFIG_START( cninja ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR /* sound hardware */ @@ -1015,6 +1018,9 @@ static MACHINE_CONFIG_START( stoneage ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR @@ -1181,6 +1187,9 @@ static MACHINE_CONFIG_START( edrandy ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -1268,6 +1277,9 @@ static MACHINE_CONFIG_START( robocop2 ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR @@ -1364,6 +1376,9 @@ static MACHINE_CONFIG_START( mutantf ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/dblewing.cpp b/src/mame/drivers/dblewing.cpp index 4ae43a25b2e..57e86d496a4 100644 --- a/src/mame/drivers/dblewing.cpp +++ b/src/mame/drivers/dblewing.cpp @@ -400,6 +400,9 @@ static MACHINE_CONFIG_START( dblewing ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(dblewing_state, dblewing_sound_cb) diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp index 2c7fa75d2bf..fcb88205ab1 100644 --- a/src/mame/drivers/deco32.cpp +++ b/src/mame/drivers/deco32.cpp @@ -728,11 +728,6 @@ WRITE32_MEMBER(deco32_state::tattass_control_w) /**********************************************************************************/ -uint16_t deco32_state::port_b_nslasher(int unused) -{ - return (m_eeprom->do_read()); -} - void deco32_state::nslasher_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ) { /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ @@ -741,7 +736,7 @@ void deco32_state::nslasher_sound_cb( address_space &space, uint16_t data, uint1 m_audiocpu->set_input_line(0, (m_nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); } -uint16_t deco32_state::port_b_tattass(int unused) +READ16_MEMBER(deco32_state::port_b_tattass) { return m_tattass_eprom_bit; } @@ -1913,6 +1908,9 @@ static MACHINE_CONFIG_START( captaven ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb) MCFG_VIDEO_START_OVERRIDE(deco32_state,captaven) @@ -1938,21 +1936,6 @@ static MACHINE_CONFIG_START( captaven ) MACHINE_CONFIG_END -uint16_t deco32_state::port_a_fghthist(int unused) -{ - return machine().root_device().ioport(":IN0")->read(); -} - -uint16_t deco32_state::port_b_fghthist(int unused) -{ - return machine().device(":eeprom")->do_read(); -} - -uint16_t deco32_state::port_c_fghthist(int unused) -{ - return machine().root_device().ioport(":IN1")->read(); -} - DECO16IC_BANK_CB_MEMBER(deco32_state::fghthist_bank_callback) { bank = bank >> 4; @@ -2018,9 +2001,9 @@ static MACHINE_CONFIG_START( fghthist ) /* DE-0380-2 PCB */ MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") - MCFG_DECO146_SET_PORTA_CALLBACK( deco32_state, port_a_fghthist ) - MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_fghthist ) - MCFG_DECO146_SET_PORTC_CALLBACK( deco32_state, port_c_fghthist ) + MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) + MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) + MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR @@ -2104,9 +2087,9 @@ static MACHINE_CONFIG_START( fghthsta ) /* DE-0395-1 PCB */ MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") - MCFG_DECO146_SET_PORTA_CALLBACK( deco32_state, port_a_fghthist ) - MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_fghthist ) - MCFG_DECO146_SET_PORTC_CALLBACK( deco32_state, port_c_fghthist ) + MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) + MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) + MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR @@ -2149,9 +2132,9 @@ static MACHINE_CONFIG_DERIVED( fghthistz, fghthsta ) /* MCFG_DEVICE_REMOVE("ioprot") MCFG_DECO146_ADD("ioprot") - MCFG_DECO146_SET_PORTA_CALLBACK( deco32_state, port_a_fghthist ) - MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_fghthist ) - MCFG_DECO146_SET_PORTC_CALLBACK( deco32_state, port_c_fghthist ) + MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) + MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) + MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, nslasher_sound_cb) @@ -2236,6 +2219,9 @@ static MACHINE_CONFIG_START( dragngun ) MCFG_VIDEO_START_OVERRIDE(dragngun_state,dragngun) MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE @@ -2344,6 +2330,9 @@ static MACHINE_CONFIG_START( lockload ) MCFG_DECO_ZOOMSPR_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE @@ -2441,7 +2430,9 @@ static MACHINE_CONFIG_START( tattass ) MCFG_PALETTE_ADD("palette", 2048) MCFG_DECO104_ADD("ioprot104") - MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_tattass ) + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(READ16(deco32_state, port_b_tattass)) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, tattass_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE @@ -2517,7 +2508,9 @@ static MACHINE_CONFIG_START( nslasher ) MCFG_VIDEO_START_OVERRIDE(deco32_state,nslasher) MCFG_DECO104_ADD("ioprot104") - MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_nslasher ) + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, nslasher_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE @@ -2551,7 +2544,9 @@ static MACHINE_CONFIG_DERIVED( nslasheru, nslasher ) MCFG_DEVICE_REMOVE("ioprot104") MCFG_DECO104_ADD("ioprot104") - MCFG_DECO146_SET_PORTB_CALLBACK( deco32_state, port_b_nslasher ) + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(DEVREADLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MACHINE_CONFIG_END diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp index 9fee581cfcc..e6ce45ec0c5 100644 --- a/src/mame/drivers/deco_mlc.cpp +++ b/src/mame/drivers/deco_mlc.cpp @@ -561,6 +561,9 @@ static MACHINE_CONFIG_START( mlc ) MCFG_VIDEO_START_OVERRIDE(deco_mlc_state,mlc) MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR /* sound hardware */ diff --git a/src/mame/drivers/dietgo.cpp b/src/mame/drivers/dietgo.cpp index 7afb407d721..74eb95c36ff 100644 --- a/src/mame/drivers/dietgo.cpp +++ b/src/mame/drivers/dietgo.cpp @@ -256,6 +256,9 @@ static MACHINE_CONFIG_START( dietgo ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR diff --git a/src/mame/drivers/dreambal.cpp b/src/mame/drivers/dreambal.cpp index f404248ac37..3e0e5714571 100644 --- a/src/mame/drivers/dreambal.cpp +++ b/src/mame/drivers/dreambal.cpp @@ -327,6 +327,9 @@ static MACHINE_CONFIG_START( dreambal ) MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") // 93lc46b MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DEVICE_ADD("tilegen1", DECO16IC, 0) MCFG_DECO16IC_SPLIT(0) diff --git a/src/mame/drivers/funkyjet.cpp b/src/mame/drivers/funkyjet.cpp index c93ded46258..1d9caebcd15 100644 --- a/src/mame/drivers/funkyjet.cpp +++ b/src/mame/drivers/funkyjet.cpp @@ -331,6 +331,9 @@ static MACHINE_CONFIG_START( funkyjet ) MCFG_SCREEN_PALETTE("palette") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE diff --git a/src/mame/drivers/lemmings.cpp b/src/mame/drivers/lemmings.cpp index e3e04e32afb..5155a9d853c 100644 --- a/src/mame/drivers/lemmings.cpp +++ b/src/mame/drivers/lemmings.cpp @@ -270,6 +270,9 @@ static MACHINE_CONFIG_START( lemmings ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(lemmings_state, lemmings_sound_cb) diff --git a/src/mame/drivers/pktgaldx.cpp b/src/mame/drivers/pktgaldx.cpp index 28be685e28e..fee476e519b 100644 --- a/src/mame/drivers/pktgaldx.cpp +++ b/src/mame/drivers/pktgaldx.cpp @@ -370,6 +370,9 @@ static MACHINE_CONFIG_START( pktgaldx ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE(8,9, 4,5,6,7 ,1,0,3,2) // hopefully this is correct, nothing else uses this arrangement! /* sound hardware */ diff --git a/src/mame/drivers/rohga.cpp b/src/mame/drivers/rohga.cpp index 94c79876f0b..bf2fc6b2b9d 100644 --- a/src/mame/drivers/rohga.cpp +++ b/src/mame/drivers/rohga.cpp @@ -960,6 +960,9 @@ static MACHINE_CONFIG_START( rohga ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") @@ -1047,6 +1050,9 @@ static MACHINE_CONFIG_START( wizdfire ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE MCFG_VIDEO_START_OVERRIDE(rohga_state, wizdfire) @@ -1139,6 +1145,9 @@ static MACHINE_CONFIG_START( nitrobal ) MCFG_VIDEO_START_OVERRIDE(rohga_state, wizdfire) MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR @@ -1227,6 +1236,9 @@ static MACHINE_CONFIG_START( schmeisr ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO104_ADD("ioprot104") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") diff --git a/src/mame/drivers/sshangha.cpp b/src/mame/drivers/sshangha.cpp index f6c3c2990d0..cf3769b8aa9 100644 --- a/src/mame/drivers/sshangha.cpp +++ b/src/mame/drivers/sshangha.cpp @@ -425,6 +425,9 @@ static MACHINE_CONFIG_START( sshangha ) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) + MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) + MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") /* sure it's stereo? */ diff --git a/src/mame/includes/deco32.h b/src/mame/includes/deco32.h index 089aeb0eac5..6e18fb28411 100644 --- a/src/mame/includes/deco32.h +++ b/src/mame/includes/deco32.h @@ -176,14 +176,10 @@ public: void updateAceRam(); void mixDualAlphaSprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx0, gfx_element *gfx1, int mixAlphaTilemap); - uint16_t port_a_fghthist(int unused); - uint16_t port_b_fghthist(int unused); - uint16_t port_c_fghthist(int unused); void deco32_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ); - uint16_t port_b_nslasher(int unused); void nslasher_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ); - uint16_t port_b_tattass(int unused); + DECLARE_READ16_MEMBER(port_b_tattass); void tattass_sound_cb( address_space &space, uint16_t data, uint16_t mem_mask ); void deco32_set_audio_output(uint8_t raw_data); void update_irq_state(uint8_t irq_cause, bool assert_state); diff --git a/src/mame/machine/deco146.cpp b/src/mame/machine/deco146.cpp index 089217af218..a7f7d7e1bbe 100644 --- a/src/mame/machine/deco146.cpp +++ b/src/mame/machine/deco146.cpp @@ -1252,7 +1252,6 @@ void deco_146_base_device::write_protport(address_space &space, uint16_t address else if ((address&0xff) == m_soundlatch_port) { logerror("LOAD SOUND LATCH %04x %04x\n", data, mem_mask); - COMBINE_DATA(&m_soundlatch); m_soundlatch_w(space, data, mem_mask); } @@ -1315,11 +1314,11 @@ uint16_t deco_146_base_device::read_data(uint16_t address, uint16_t mem_mask, ui deco_146_base_device::deco_146_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), + m_port_a_r(*this), + m_port_b_r(*this), + m_port_c_r(*this), m_sound_latch(*this, ":soundlatch") { - m_port_a_r = deco146_port_read_cb(FUNC(deco_146_base_device::port_a_default), this); - m_port_b_r = deco146_port_read_cb(FUNC(deco_146_base_device::port_b_default), this); - m_port_c_r = deco146_port_read_cb(FUNC(deco_146_base_device::port_c_default), this); m_soundlatch_w = deco146_port_write_cb(FUNC(deco_146_base_device::soundlatch_default), this); m_external_addrswap[0] = 0; @@ -1336,30 +1335,6 @@ deco_146_base_device::deco_146_base_device(const machine_config &mconfig, device -uint16_t deco_146_base_device::port_dummy_cb(int unused) -{ - return 0x00; -} - -void deco_146_base_device::soundlatch_dummy(address_space &space, uint16_t data, uint16_t mem_mask) -{ -} - -uint16_t deco_146_base_device::port_a_default(int unused) -{ - return ioport(":INPUTS")->read(); -} - -uint16_t deco_146_base_device::port_b_default(int unused) -{ - return ioport(":SYSTEM")->read(); -} - -uint16_t deco_146_base_device::port_c_default(int unused) -{ - return ioport(":DSW")->read(); -} - void deco_146_base_device::soundlatch_default(address_space &space, uint16_t data, uint16_t mem_mask) { if (m_sound_latch != nullptr) @@ -1371,9 +1346,6 @@ void deco_146_base_device::soundlatch_default(address_space &space, uint16_t dat -void deco_146_base_device::set_port_a_cb(device_t &device,deco146_port_read_cb port_cb) { deco_146_base_device &dev = downcast(device); dev.m_port_a_r = port_cb; } -void deco_146_base_device::set_port_b_cb(device_t &device,deco146_port_read_cb port_cb) { deco_146_base_device &dev = downcast(device); dev.m_port_b_r = port_cb; } -void deco_146_base_device::set_port_c_cb(device_t &device,deco146_port_read_cb port_cb) { deco_146_base_device &dev = downcast(device); dev.m_port_c_r = port_cb; } void deco_146_base_device::set_soundlatch_cb(device_t &device,deco146_port_write_cb port_cb) { deco_146_base_device &dev = downcast(device); dev.m_soundlatch_w = port_cb; } void deco_146_base_device::set_interface_scramble(device_t &device,uint8_t a9, uint8_t a8, uint8_t a7, uint8_t a6, uint8_t a5, uint8_t a4, uint8_t a3,uint8_t a2,uint8_t a1,uint8_t a0) { @@ -1406,15 +1378,14 @@ void deco_146_base_device::device_start() // bind our handler - m_port_a_r.bind_relative_to(*owner()); - m_port_b_r.bind_relative_to(*owner()); - m_port_c_r.bind_relative_to(*owner()); + m_port_a_r.resolve_safe(0xffff); + m_port_b_r.resolve_safe(0xffff); + m_port_c_r.resolve_safe(0xffff); m_soundlatch_w.bind_relative_to(*owner()); save_item(NAME(m_xor)); save_item(NAME(m_nand)); - save_item(NAME(m_soundlatch)); save_item(NAME(m_rambank0)); save_item(NAME(m_rambank1)); @@ -1440,8 +1411,6 @@ void deco_146_base_device::device_reset() m_current_rambank = 0; - m_soundlatch = 0x0000; - m_latchaddr = 0xffff; m_latchdata = 0x0000; m_latchflag = 0; diff --git a/src/mame/machine/deco146.h b/src/mame/machine/deco146.h index 1ef7ab87082..c9d97f32083 100644 --- a/src/mame/machine/deco146.h +++ b/src/mame/machine/deco146.h @@ -7,18 +7,17 @@ #include "machine/gen_latch.h" -typedef device_delegate deco146_port_read_cb; typedef device_delegate deco146_port_write_cb; -#define MCFG_DECO146_SET_PORTA_CALLBACK( _class, _method) \ - deco_146_base_device::set_port_a_cb(*device, deco146_port_read_cb(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); +#define MCFG_DECO146_IN_PORTA_CB(_devcb) \ + devcb = &deco_146_base_device::set_port_a_cb(*device, DEVCB_##_devcb); -#define MCFG_DECO146_SET_PORTB_CALLBACK( _class, _method) \ - deco_146_base_device::set_port_b_cb(*device, deco146_port_read_cb(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); +#define MCFG_DECO146_IN_PORTB_CB(_devcb) \ + devcb = &deco_146_base_device::set_port_b_cb(*device, DEVCB_##_devcb); -#define MCFG_DECO146_SET_PORTC_CALLBACK( _class, _method) \ - deco_146_base_device::set_port_c_cb(*device, deco146_port_read_cb(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); +#define MCFG_DECO146_IN_PORTC_CB(_devcb) \ + devcb = &deco_146_base_device::set_port_c_cb(*device, DEVCB_##_devcb); #define MCFG_DECO146_SET_SOUNDLATCH_CALLBACK( _class, _method) \ deco_146_base_device::set_soundlatch_cb(*device, deco146_port_write_cb(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); @@ -86,9 +85,9 @@ public: void write_data(address_space &space, uint16_t address, uint16_t data, uint16_t mem_mask, uint8_t &csflags); uint16_t read_data(uint16_t address, uint16_t mem_mask, uint8_t &csflags); - static void set_port_a_cb(device_t &device,deco146_port_read_cb port_cb); - static void set_port_b_cb(device_t &device,deco146_port_read_cb port_cb); - static void set_port_c_cb(device_t &device,deco146_port_read_cb port_cb); + template static devcb_base &set_port_a_cb(device_t &device, Object &&object) { return downcast(device).m_port_a_r.set_callback(std::forward(object)); } + template static devcb_base &set_port_b_cb(device_t &device, Object &&object) { return downcast(device).m_port_b_r.set_callback(std::forward(object)); } + template static devcb_base &set_port_c_cb(device_t &device, Object &&object) { return downcast(device).m_port_c_r.set_callback(std::forward(object)); } static void set_soundlatch_cb(device_t &device,deco146_port_write_cb port_cb); static void set_interface_scramble(device_t &device,uint8_t a9, uint8_t a8, uint8_t a7, uint8_t a6, uint8_t a5, uint8_t a4, uint8_t a3,uint8_t a2,uint8_t a1,uint8_t a0); static void set_use_magic_read_address_xor(device_t &device, int use_xor); @@ -97,17 +96,12 @@ public: - deco146_port_read_cb m_port_a_r; - deco146_port_read_cb m_port_b_r; - deco146_port_read_cb m_port_c_r; + devcb_read16 m_port_a_r; + devcb_read16 m_port_b_r; + devcb_read16 m_port_c_r; deco146_port_write_cb m_soundlatch_w; - uint16_t port_a_default(int unused); - uint16_t port_b_default(int unused); - uint16_t port_c_default(int unused); - uint16_t port_dummy_cb(int unused); void soundlatch_default(address_space &space, uint16_t data, uint16_t mem_mask); - void soundlatch_dummy(address_space &space, uint16_t data, uint16_t mem_mask); uint8_t m_bankswitch_swap_read_address; uint16_t m_magic_read_address_xor; @@ -139,7 +133,6 @@ protected: uint16_t m_nand; uint16_t m_xor; - uint16_t m_soundlatch; uint16_t m_latchaddr; uint16_t m_latchdata;