From 828dc80f32485b15ce1a8fbeb39b13b0cfb8b533 Mon Sep 17 00:00:00 2001 From: arbee Date: Thu, 6 Sep 2018 23:35:50 -0400 Subject: apple2/apple2e/apple2gs: more MCFG elimination (nw) --- src/devices/bus/a2bus/a2bus.h | 5 +++++ src/mame/drivers/apple2.cpp | 38 ++++++++++++++++++++------------------ src/mame/drivers/apple2e.cpp | 14 +++++++------- src/mame/drivers/apple2gs.cpp | 32 +++++++++++++++++--------------- 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/devices/bus/a2bus/a2bus.h b/src/devices/bus/a2bus/a2bus.h index 1e1d2b832ee..862aeca3803 100644 --- a/src/devices/bus/a2bus/a2bus.h +++ b/src/devices/bus/a2bus/a2bus.h @@ -104,6 +104,11 @@ public: template devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward(cb)); } template devcb_base &set_out_inh_callback(Object &&cb) { return m_out_inh_cb.set_callback(std::forward(cb)); } + // devcb3 + auto irq_w() { return m_out_irq_cb.bind(); } + auto nmi_w() { return m_out_nmi_cb.bind(); } + auto inh_w() { return m_out_inh_cb.bind(); } + void add_a2bus_card(int slot, device_a2bus_card_interface *card); device_a2bus_card_interface *get_a2bus_card(int slot); uint8_t get_a2bus_irq_mask(); diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index 3531205d7b2..55bcc079600 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -108,6 +108,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, A2_CPU_TAG), m_screen(*this, "screen"), + m_scantimer(*this, "scantimer"), m_ram(*this, RAM_TAG), m_ay3600(*this, A2_KBDC_TAG), m_video(*this, A2_VIDEO_TAG), @@ -129,6 +130,7 @@ public: required_device m_maincpu; required_device m_screen; + required_device m_scantimer; required_device m_ram; required_device m_ay3600; required_device m_video; @@ -1375,25 +1377,25 @@ static void apple2_cards(device_slot_interface &device) MACHINE_CONFIG_START(apple2_state::apple2_common) /* basic machine hardware */ - MCFG_DEVICE_ADD(A2_CPU_TAG, M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ - MCFG_DEVICE_PROGRAM_MAP(apple2_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2_state, apple2_interrupt, "screen", 0, 1) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) + M6502(config, m_maincpu, 1021800); + m_maincpu->set_addrmap(AS_PROGRAM, &apple2_state::apple2_map); + TIMER(config, m_scantimer, 0); + m_scantimer->configure_scanline(FUNC(apple2_state::apple2_interrupt), "screen", 0, 1); + config.m_minimum_quantum = attotime::from_hz(60); - MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL(14'318'181)) + APPLE2_VIDEO(config, m_video, XTAL(14'318'181)); - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192) - MCFG_SCREEN_UPDATE_DRIVER(apple2_state, screen_update) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192); + m_screen->set_screen_update(FUNC(apple2_state::screen_update)); + m_screen->set_palette("palette"); - MCFG_PALETTE_ADD("palette", 16) - MCFG_PALETTE_INIT_OWNER(apple2_state, apple2) + palette_device &palette(PALETTE(config, "palette", 16)); + palette.set_init(DEVICE_SELF, FUNC(apple2_state::palette_init_apple2)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD(A2_SPEAKER_TAG, SPEAKER_SOUND) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + SPEAKER_SOUND(config, A2_SPEAKER_TAG).add_route(ALL_OUTPUTS, "mono", 1.00); /* /INH banking */ ADDRESS_MAP_BANK(config, A2_UPPERBANK_TAG).set_map(&apple2_state::inhbank_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x3000); @@ -1430,11 +1432,11 @@ MACHINE_CONFIG_START(apple2_state::apple2_common) timer.configure_periodic(timer_device::expired_delegate(FUNC(apple2_state::ay3600_repeat), this), attotime::from_hz(15)); /* slot devices */ - MCFG_DEVICE_ADD(m_a2bus, A2BUS, 0) - MCFG_A2BUS_CPU(A2_CPU_TAG) - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(*this, apple2_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(*this, apple2_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(*this, apple2_state, a2bus_inh_w)) + A2BUS(config, m_a2bus, 0); + m_a2bus->set_cputag("maincpu"); + m_a2bus->irq_w().set(FUNC(apple2_state::a2bus_irq_w)); + m_a2bus->nmi_w().set(FUNC(apple2_state::a2bus_nmi_w)); + m_a2bus->inh_w().set(FUNC(apple2_state::a2bus_inh_w)); A2BUS_SLOT(config, "sl0", m_a2bus, apple2_slot0_cards, "lang"); A2BUS_SLOT(config, "sl1", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple2_cards, nullptr); diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index f6775153aca..aabcfd1dd1a 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -4060,11 +4060,11 @@ MACHINE_CONFIG_START(apple2e_state::apple2e) timer.configure_periodic(timer_device::expired_delegate(FUNC(apple2e_state::ay3600_repeat), this), attotime::from_hz(15)); /* slot devices */ - MCFG_DEVICE_ADD(m_a2bus, A2BUS, 0) - MCFG_A2BUS_CPU("maincpu") - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(*this, apple2e_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(*this, apple2e_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(*this, apple2e_state, a2bus_inh_w)) + A2BUS(config, m_a2bus, 0); + m_a2bus->set_cputag("maincpu"); + m_a2bus->irq_w().set(FUNC(apple2e_state::a2bus_irq_w)); + m_a2bus->nmi_w().set(FUNC(apple2e_state::a2bus_nmi_w)); + m_a2bus->inh_w().set(FUNC(apple2e_state::a2bus_inh_w)); A2BUS_SLOT(config, "sl1", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl3", m_a2bus, apple2_cards, nullptr); @@ -4162,7 +4162,7 @@ MACHINE_CONFIG_START(apple2e_state::apple2c) A2BUS_MOCKINGBOARD(config, "sl4", A2BUS_7M_CLOCK).set_onboard(m_a2bus); // Mockingboard 4C A2BUS_DISKIING(config, "sl6", A2BUS_7M_CLOCK).set_onboard(m_a2bus); - MCFG_A2EAUXSLOT_SLOT_REMOVE("aux") + config.device_remove("aux"); config.device_remove(A2_AUXSLOT_TAG); m_ram->set_default_size("128K").set_extra_options("128K"); @@ -4369,7 +4369,7 @@ MACHINE_CONFIG_START(apple2e_state::ceci) A2BUS_DISKIING(config, "sl6", A2BUS_7M_CLOCK).set_onboard(m_a2bus); // there is no aux slot, the "aux" side of the //e is used for additional ROM - MCFG_A2EAUXSLOT_SLOT_REMOVE("aux") + config.device_remove("aux"); config.device_remove(A2_AUXSLOT_TAG); m_ram->set_default_size("64K"); diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 39dd0e8f967..237e5b74ebc 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -149,6 +149,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, A2GS_CPU_TAG), m_screen(*this, "screen"), + m_scantimer(*this, "scantimer"), m_adbmicro(*this, A2GS_ADBMCU_TAG), m_ram(*this, RAM_TAG), m_rom(*this, "maincpu"), @@ -205,6 +206,7 @@ public: required_device m_maincpu; required_device m_screen; + required_device m_scantimer; required_device m_adbmicro; required_device m_ram; required_region_ptr m_rom; @@ -4532,11 +4534,12 @@ static void apple2_cards(device_slot_interface &device) MACHINE_CONFIG_START( apple2gs_state::apple2gs ) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", G65816, A2GS_MASTER_CLOCK/10) - MCFG_DEVICE_PROGRAM_MAP(apple2gs_map) - MCFG_DEVICE_ADDRESS_MAP(g65816_device::AS_VECTORS, vectors_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2gs_state, apple2_interrupt, "screen", 0, 1) - MCFG_QUANTUM_TIME(attotime::from_hz(60)) + G65816(config, m_maincpu, A2GS_MASTER_CLOCK/10); + m_maincpu->set_addrmap(AS_PROGRAM, &apple2gs_state::apple2gs_map); + m_maincpu->set_addrmap(g65816_device::AS_VECTORS, &apple2gs_state::vectors_map); + TIMER(config, m_scantimer, 0); + m_scantimer->configure_scanline(FUNC(apple2gs_state::apple2_interrupt), "screen", 0, 1); + config.m_minimum_quantum = attotime::from_hz(60); MCFG_DEVICE_ADD(A2GS_ADBMCU_TAG, M50741, A2GS_MASTER_CLOCK/8) MCFG_M5074X_PORT0_READ_CALLBACK(READ8(*this, apple2gs_state, adbmicro_p0_in)) @@ -4571,7 +4574,7 @@ MACHINE_CONFIG_START( apple2gs_state::apple2gs ) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - MCFG_DEVICE_ADD(A2GS_VIDEO_TAG, APPLE2_VIDEO, A2GS_14M) + APPLE2_VIDEO(config, m_video, A2GS_14M); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -4579,13 +4582,12 @@ MACHINE_CONFIG_START( apple2gs_state::apple2gs ) MCFG_SCREEN_VISIBLE_AREA(0,703,0,230) MCFG_SCREEN_UPDATE_DRIVER(apple2gs_state, screen_update) - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(apple2gs_state, apple2gs) + palette_device &palette(PALETTE(config, "palette", 256)); + palette.set_init(DEVICE_SELF, FUNC(apple2gs_state::palette_init_apple2gs)); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD(A2GS_SPEAKER_TAG, SPEAKER_SOUND, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + SPEAKER_SOUND(config, A2GS_SPEAKER_TAG).add_route(ALL_OUTPUTS, "mono", 1.00); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -4681,11 +4683,11 @@ MACHINE_CONFIG_START( apple2gs_state::apple2gs ) MCFG_RS232_CTS_HANDLER(WRITELINE(m_scc, z80scc_device, ctsb_w)) /* slot devices */ - MCFG_DEVICE_ADD("a2bus", A2BUS, 0) - MCFG_A2BUS_CPU("maincpu") - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(*this, apple2gs_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(*this, apple2gs_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(*this, apple2gs_state, a2bus_inh_w)) + A2BUS(config, m_a2bus, 0); + m_a2bus->set_cputag("maincpu"); + m_a2bus->irq_w().set(FUNC(apple2gs_state::a2bus_irq_w)); + m_a2bus->nmi_w().set(FUNC(apple2gs_state::a2bus_nmi_w)); + m_a2bus->inh_w().set(FUNC(apple2gs_state::a2bus_inh_w)); A2BUS_SLOT(config, "sl1", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl3", m_a2bus, apple2_cards, nullptr); -- cgit v1.2.3