diff --git a/src/devices/machine/gen_latch.h b/src/devices/machine/gen_latch.h index f00a16a083a..c0bee635b27 100644 --- a/src/devices/machine/gen_latch.h +++ b/src/devices/machine/gen_latch.h @@ -46,10 +46,6 @@ DECLARE_DEVICE_TYPE(GENERIC_LATCH_16, generic_latch_16_device) class generic_latch_base_device : public device_t { -protected: - // construction/destruction - generic_latch_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); - public: // configuration template devcb_base &set_data_pending_callback(Object &&cb) { return m_data_pending_cb.set_callback(std::forward(cb)); } @@ -58,6 +54,9 @@ public: DECLARE_READ_LINE_MEMBER(pending_r); protected: + // construction/destruction + generic_latch_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + virtual void device_start() override; virtual void device_reset() override; @@ -80,7 +79,7 @@ class generic_latch_8_device : public generic_latch_base_device { public: // construction/destruction - generic_latch_8_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + generic_latch_8_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -111,7 +110,7 @@ class generic_latch_16_device : public generic_latch_base_device { public: // construction/destruction - generic_latch_16_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + generic_latch_16_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); DECLARE_READ16_MEMBER( read ); DECLARE_WRITE16_MEMBER( write ); @@ -132,5 +131,4 @@ private: u16 m_latched_value; }; - #endif // MAME_MACHINE_GEN_LATCH_H diff --git a/src/mame/drivers/bw2.cpp b/src/mame/drivers/bw2.cpp index 8e1d67918ed..f0021d272fe 100644 --- a/src/mame/drivers/bw2.cpp +++ b/src/mame/drivers/bw2.cpp @@ -80,44 +80,28 @@ READ8_MEMBER( bw2_state::read ) if (offset < 0x8000) { if (!rom) - { data = m_rom->base()[offset & 0x3fff]; - } if (!vram) - { data = m_video_ram[offset & 0x3fff]; - } if (!ram1) - { data = m_ram->pointer()[offset]; - } if (!ram2 && HAS_KB_OF_RAM(96)) - { data = m_ram->pointer()[0x10000 | offset]; - } if (!ram3 && HAS_KB_OF_RAM(128)) - { data = m_ram->pointer()[0x18000 | offset]; - } if (!ram4 && HAS_KB_OF_RAM(160)) - { data = m_ram->pointer()[0x20000 | offset]; - } if (!ram5 && HAS_KB_OF_RAM(192)) - { data = m_ram->pointer()[0x28000 | offset]; - } if (!ram6 && HAS_KB_OF_RAM(224)) - { data = m_ram->pointer()[0x30000 | offset]; - } } else { @@ -150,39 +134,25 @@ WRITE8_MEMBER( bw2_state::write ) if (offset < 0x8000) { if (!vram) - { m_video_ram[offset & 0x3fff] = data; - } if (!ram1) - { m_ram->pointer()[offset] = data; - } if (!ram2 && HAS_KB_OF_RAM(96)) - { m_ram->pointer()[0x10000 | offset] = data; - } if (!ram3 && HAS_KB_OF_RAM(128)) - { m_ram->pointer()[0x18000 | offset] = data; - } if (!ram4 && HAS_KB_OF_RAM(160)) - { m_ram->pointer()[0x20000 | offset] = data; - } if (!ram5 && HAS_KB_OF_RAM(192)) - { m_ram->pointer()[0x28000 | offset] = data; - } if (!ram6 && HAS_KB_OF_RAM(224)) - { m_ram->pointer()[0x30000 | offset] = data; - } } else { @@ -591,12 +561,12 @@ MACHINE_CONFIG_START(bw2_state::bw2) MCFG_PALETTE_INIT_OWNER(bw2_state, bw2) // devices - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) + MCFG_DEVICE_ADD(m_pit, PIT8253, 0) MCFG_PIT8253_CLK0(16_MHz_XTAL / 4) // 8251 USART TXC, RXC - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(I8251_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(I8251_TAG, i8251_device, write_rxc)) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m_uart, i8251_device, write_txc)) + MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(m_uart, i8251_device, write_rxc)) MCFG_PIT8253_CLK1(11000) // LCD controller - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(I8253_TAG, pit8253_device, write_clk2)) + MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_pit, pit8253_device, write_clk2)) MCFG_PIT8253_CLK2(0) // Floppy /MTRON MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, bw2_state, mtron_w)) @@ -615,14 +585,14 @@ MACHINE_CONFIG_START(bw2_state::bw2) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_DEVICE_ADD(m_uart, I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) MCFG_I8251_DTR_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_dtr)) MCFG_I8251_RTS_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_rts)) MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(I8251_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(I8251_TAG, i8251_device, write_dsr)) + MCFG_RS232_RXD_HANDLER(WRITELINE(m_uart, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(WRITELINE(m_uart, i8251_device, write_dsr)) MCFG_DEVICE_ADD(WD2797_TAG, WD2797, 16_MHz_XTAL / 16) MCFG_WD_FDC_INTRQ_CALLBACK(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/jedi.cpp b/src/mame/drivers/jedi.cpp index a827529ddef..1285b3e587e 100644 --- a/src/mame/drivers/jedi.cpp +++ b/src/mame/drivers/jedi.cpp @@ -341,9 +341,9 @@ MACHINE_CONFIG_START(jedi_state::jedi) MCFG_DEVICE_ADD("adc", ADC0809, JEDI_AUDIO_CPU_OSC / 2 / 9) // nominally 666 kHz MCFG_ADC0808_IN0_CB(IOPORT("STICKY")) - MCFG_ADC0808_IN1_CB(NOOP) // SPARE + MCFG_ADC0808_IN1_CB(CONSTANT(0)) // SPARE MCFG_ADC0808_IN2_CB(IOPORT("STICKX")) - MCFG_ADC0808_IN3_CB(NOOP) // SPARE + MCFG_ADC0808_IN3_CB(CONSTANT(0)) // SPARE MCFG_DEVICE_ADD("outlatch", LS259, 0) // 14J MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, jedi_state, coin_counter_left_w)) diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp index 6e6bfa14c52..927394cf1a5 100644 --- a/src/mame/drivers/starwars.cpp +++ b/src/mame/drivers/starwars.cpp @@ -314,7 +314,7 @@ MACHINE_CONFIG_START(starwars_state::starwars) MCFG_DEVICE_ADD("adc", ADC0809, MASTER_CLOCK / 16) // designated as "137243-001" on parts list and "157249-120" on schematics MCFG_ADC0808_IN0_CB(IOPORT("STICKY")) // pitch MCFG_ADC0808_IN1_CB(IOPORT("STICKX")) // yaw - MCFG_ADC0808_IN2_CB(GND) // thrust (unused) + MCFG_ADC0808_IN2_CB(CONSTANT(0)) // thrust (unused) MCFG_DEVICE_ADD("riot", RIOT6532, MASTER_CLOCK / 8) MCFG_RIOT6532_IN_PA_CB(READ8(*this, starwars_state, r6532_porta_r)) diff --git a/src/mame/drivers/subs.cpp b/src/mame/drivers/subs.cpp index ffee6453e88..d4fde819fbd 100644 --- a/src/mame/drivers/subs.cpp +++ b/src/mame/drivers/subs.cpp @@ -210,9 +210,7 @@ MACHINE_CONFIG_START(subs_state::subs) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("discrete", DISCRETE, subs_discrete) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + DISCRETE(config, m_discrete, subs_discrete).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); MCFG_DEVICE_ADD("latch", LS259, 0) // C9 MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // START LAMP 1 diff --git a/src/mame/drivers/wmg.cpp b/src/mame/drivers/wmg.cpp index 46e19d27ed3..372f1fb4185 100644 --- a/src/mame/drivers/wmg.cpp +++ b/src/mame/drivers/wmg.cpp @@ -72,6 +72,7 @@ of save-state is also needed. #include "includes/williams.h" #include "cpu/m6800/m6800.h" +#include "machine/input_merger.h" #include "machine/nvram.h" #include "sound/dac.h" #include "sound/volt_reg.h" @@ -135,7 +136,7 @@ void wmg_state::wmg_cpu2(address_map &map) { map(0x0000, 0x007f).ram(); /* internal RAM */ map(0x0080, 0x00ff).ram(); /* MC6810 RAM */ - map(0x0400, 0x0403).mirror(0x8000).rw(m_pia_2, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); + map(0x0400, 0x0403).mirror(0x8000).rw(m_pia[2], FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* These next 2 are actually banked in CPU 1, but its not something Mame can handle very well. Placed here instead. */ map(0xc000, 0xc00f).mirror(0x03f0).writeonly().share("paletteram"); map(0xd000, 0xefff).ram().share("nvram"); @@ -391,17 +392,14 @@ WRITE8_MEMBER( wmg_state::wmg_d000_w ) if (data == 0) { /* install the i/o devices into c000-cfff */ - pia6821_device *pia0 = m_pia_0; - pia6821_device *pia1 = m_pia_1; - space.unmap_read(0xc000, 0xcfff); // throw out bank7 space.install_write_bank (0xc000, 0xc00f, "bank4"); - membank("bank4")->set_base(m_generic_paletteram_8); + membank("bank4")->set_base(m_paletteram); space.install_write_handler (0xc010, 0xc01f, write8_delegate(FUNC(williams_state::defender_video_control_w),this)); space.install_write_handler (0xc400, 0xc400, write8_delegate(FUNC(wmg_state::wmg_c400_w),this)); space.install_write_handler (0xc401, 0xc401, write8_delegate(FUNC(wmg_state::wmg_sound_reset_w),this)); - space.install_readwrite_handler(0xc804, 0xc807, read8_delegate(FUNC(wmg_state::wmg_pia_0_r),this), write8_delegate(FUNC(pia6821_device::write), pia0)); - space.install_readwrite_handler(0xc80c, 0xc80f, read8_delegate(FUNC(pia6821_device::read), pia1), write8_delegate(FUNC(pia6821_device::write), pia1)); + space.install_readwrite_handler(0xc804, 0xc807, read8_delegate(FUNC(wmg_state::wmg_pia_0_r),this), write8_delegate(FUNC(pia6821_device::write), m_pia[0].target())); + space.install_readwrite_handler(0xc80c, 0xc80f, read8_delegate(FUNC(pia6821_device::read), m_pia[1].target()), write8_delegate(FUNC(pia6821_device::write), m_pia[1].target())); space.install_write_handler (0xc900, 0xc9ff, write8_delegate(FUNC(wmg_state::wmg_vram_select_w),this)); space.install_write_handler (0xca00, 0xca07, write8_delegate(FUNC(williams_state::williams_blitter_w),this)); space.install_write_handler (0xcbff, 0xcbff, write8_delegate(FUNC(williams_state::williams_watchdog_reset_w),this)); @@ -457,7 +455,7 @@ READ8_MEMBER( wmg_state::wmg_pia_0_r ) Since there is no code in rom to handle this, it must be a hardware feature which probably just resets the cpu. */ - uint8_t data = m_pia_0->read(space, offset); + uint8_t data = m_pia[0]->read(space, offset); if ((m_wmg_c400) && (offset == 0) && ((data & 0x30) == 0x30)) // P1 and P2 pressed { @@ -526,6 +524,12 @@ MACHINE_CONFIG_START(wmg_state::wmg) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) /* pia */ + MCFG_INPUT_MERGER_ANY_HIGH("mainirq") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) + + MCFG_INPUT_MERGER_ANY_HIGH("soundirq") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("soundcpu", M6808_IRQ_LINE)) + MCFG_DEVICE_ADD("pia_0", PIA6821, 0) MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) @@ -534,13 +538,13 @@ MACHINE_CONFIG_START(wmg_state::wmg) MCFG_DEVICE_ADD("pia_1", PIA6821, 0) MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams_state, williams_snd_cmd_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, williams_state, williams_main_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, williams_state, williams_main_irq)) + MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) + MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) MCFG_DEVICE_ADD("pia_2", PIA6821, 0) MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, williams_state,williams_snd_irq)) - MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, williams_state,williams_snd_irq)) + MCFG_PIA_IRQA_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<0>)) + MCFG_PIA_IRQB_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<1>)) MACHINE_CONFIG_END /************************************* diff --git a/src/mame/includes/bebox.h b/src/mame/includes/bebox.h index 3fd522cce94..23f57d0f578 100644 --- a/src/mame/includes/bebox.h +++ b/src/mame/includes/bebox.h @@ -32,19 +32,19 @@ public: }; bebox_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_ppc1(*this, "ppc1"), - m_ppc2(*this, "ppc2"), - m_lsi53c810(*this, "lsi53c810"), - m_dma8237_1(*this, "dma8237_1"), - m_dma8237_2(*this, "dma8237_2"), - m_pic8259_1(*this, "pic8259_1"), - m_pic8259_2(*this, "pic8259_2"), - m_pit8254(*this, "pit8254"), - m_ram(*this, RAM_TAG), - m_smc37c78(*this, "smc37c78"), - m_flash(*this, "flash"), - m_pcibus(*this, "pcibus") + : driver_device(mconfig, type, tag) + , m_ppc1(*this, "ppc1") + , m_ppc2(*this, "ppc2") + , m_lsi53c810(*this, "lsi53c810") + , m_dma8237_1(*this, "dma8237_1") + , m_dma8237_2(*this, "dma8237_2") + , m_pic8259_1(*this, "pic8259_1") + , m_pic8259_2(*this, "pic8259_2") + , m_pit8254(*this, "pit8254") + , m_ram(*this, RAM_TAG) + , m_smc37c78(*this, "smc37c78") + , m_flash(*this, "flash") + , m_pcibus(*this, "pcibus") { } diff --git a/src/mame/includes/bw2.h b/src/mame/includes/bw2.h index a41998a7f3d..ee692f30b71 100644 --- a/src/mame/includes/bw2.h +++ b/src/mame/includes/bw2.h @@ -21,8 +21,6 @@ #define Z80_TAG "ic1" #define I8255A_TAG "ic4" #define WD2797_TAG "ic5" -#define I8253_TAG "ic6" -#define I8251_TAG "ic7" #define MSM6255_TAG "ic49" #define CENTRONICS_TAG "centronics" #define RS232_TAG "rs232" @@ -34,10 +32,10 @@ public: bw2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, Z80_TAG), - m_uart(*this, I8251_TAG), + m_uart(*this, "ic7"), m_fdc(*this, WD2797_TAG), m_lcdc(*this, MSM6255_TAG), - m_pit(*this, I8253_TAG), + m_pit(*this, "ic6"), m_centronics(*this, CENTRONICS_TAG), m_exp(*this, BW2_EXPANSION_SLOT_TAG), m_ram(*this, RAM_TAG), diff --git a/src/mame/includes/starwars.h b/src/mame/includes/starwars.h index 2baffe9ea2c..98459efcc05 100644 --- a/src/mame/includes/starwars.h +++ b/src/mame/includes/starwars.h @@ -5,6 +5,10 @@ Atari Star Wars hardware ***************************************************************************/ +#ifndef MAME_INCLUDES_STARWARS_H +#define MAME_INCLUDES_STARWARS_H + +#pragma once #include "machine/6532riot.h" #include "machine/gen_latch.h" @@ -17,8 +21,8 @@ class starwars_state : public driver_device { public: - starwars_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + starwars_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_soundlatch(*this, "soundlatch"), m_mainlatch(*this, "mainlatch"), m_riot(*this, "riot"), @@ -29,7 +33,7 @@ public: m_tms(*this, "tms"), m_novram(*this, "x2212"), m_slapstic_device(*this, "slapstic") - { } + { } required_device m_soundlatch; required_device m_mainlatch; @@ -93,3 +97,5 @@ public: void main_map(address_map &map); void sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_STARWARS_H diff --git a/src/mame/includes/subs.h b/src/mame/includes/subs.h index 75ea487ab52..6c420fb57fb 100644 --- a/src/mame/includes/subs.h +++ b/src/mame/includes/subs.h @@ -24,14 +24,15 @@ class subs_state : public driver_device { public: - subs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + subs_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_discrete(*this, "discrete"), m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram") { } + m_videoram(*this, "videoram") + { } required_device m_maincpu; required_device m_gfxdecode;