From e13cb27bd5abf206dfd67b7af062886655a4708d Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 16 Feb 2019 13:52:09 +0100 Subject: bus\hp80_io: removed MCFG macros (nw) --- src/devices/bus/hp80_io/hp80_io.h | 27 ++++++------- src/devices/bus/hp80_optroms/hp80_optrom.h | 13 +++++- src/mame/drivers/hp80.cpp | 63 ++++++++++++++---------------- 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/devices/bus/hp80_io/hp80_io.h b/src/devices/bus/hp80_io/hp80_io.h index 11025d30d03..886e7ce414a 100644 --- a/src/devices/bus/hp80_io/hp80_io.h +++ b/src/devices/bus/hp80_io/hp80_io.h @@ -13,16 +13,6 @@ #pragma once -#define MCFG_HP80_IO_SLOT_ADD(_tag , _idx) \ - MCFG_DEVICE_ADD(_tag, HP80_IO_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(hp80_io_slot_devices, nullptr, false) \ - downcast(*device).set_slot_no(_idx); - -#define MCFG_HP80_IO_IRL_CB(_devcb) \ - downcast(*device).set_irl_cb_func(DEVCB_##_devcb); - -#define MCFG_HP80_IO_HALT_CB(_devcb) \ - downcast(*device).set_halt_cb_func(DEVCB_##_devcb); #define HP80_IO_FIRST_SC 3 // Lowest SC used by I/O cards @@ -38,11 +28,22 @@ PORT_CONFSETTING(6 , "9")\ PORT_CONFSETTING(7 , "10") +void hp80_io_slot_devices(device_slot_interface &device); + class hp80_io_slot_device : public device_t, public device_slot_interface { public: // construction/destruction + hp80_io_slot_device(machine_config const &mconfig, char const *tag, device_t *owner) + : hp80_io_slot_device(mconfig, tag, owner, (uint32_t)0) + { + option_reset(); + hp80_io_slot_devices(*this); + set_default_option(nullptr); + set_fixed(false); + } + hp80_io_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~hp80_io_slot_device(); @@ -53,8 +54,8 @@ public: virtual void device_start() override; // Callback setups - template devcb_base &set_irl_cb_func(Object &&cb) { return m_irl_cb_func.set_callback(std::forward(cb)); } - template devcb_base &set_halt_cb_func(Object &&cb) { return m_halt_cb_func.set_callback(std::forward(cb)); } + auto irl_cb() { return m_irl_cb_func.bind(); } + auto halt_cb() { return m_halt_cb_func.bind(); } // SC getter uint8_t get_sc() const; @@ -102,6 +103,4 @@ protected: // device type definition DECLARE_DEVICE_TYPE(HP80_IO_SLOT, hp80_io_slot_device) -void hp80_io_slot_devices(device_slot_interface &device); - #endif // MAME_BUS_HP80_IO_HP80_IO_H diff --git a/src/devices/bus/hp80_optroms/hp80_optrom.h b/src/devices/bus/hp80_optroms/hp80_optrom.h index cb8dbd4903b..33bd800027c 100644 --- a/src/devices/bus/hp80_optroms/hp80_optrom.h +++ b/src/devices/bus/hp80_optroms/hp80_optrom.h @@ -18,6 +18,8 @@ // Size of optional ROMs (8k) static constexpr offs_t HP80_OPTROM_SIZE = 0x2000; +void hp80_optrom_slot_devices(device_slot_interface &device); + class hp80_optrom_cart_device : public device_t, public device_slot_card_interface { @@ -38,6 +40,15 @@ class hp80_optrom_slot_device : public device_t, { public: // construction/destruction + hp80_optrom_slot_device(machine_config const &mconfig, char const *tag, device_t *owner) + : hp80_optrom_slot_device(mconfig, tag, owner, (uint32_t)0) + { + option_reset(); + hp80_optrom_slot_devices(*this); + set_default_option(nullptr); + set_fixed(false); + } + hp80_optrom_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~hp80_optrom_slot_device(); @@ -72,6 +83,4 @@ protected: DECLARE_DEVICE_TYPE(HP80_OPTROM_SLOT, hp80_optrom_slot_device) DECLARE_DEVICE_TYPE(HP80_OPTROM_CART, hp80_optrom_cart_device) -void hp80_optrom_slot_devices(device_slot_interface &device); - #endif // MAME_BUS_HP80_OPTROMS_HP80_OPTROM_H diff --git a/src/mame/drivers/hp80.cpp b/src/mame/drivers/hp80.cpp index 3770537e8b7..996401f27fe 100644 --- a/src/mame/drivers/hp80.cpp +++ b/src/mame/drivers/hp80.cpp @@ -1331,17 +1331,18 @@ void hp85_state::rombank_mem_map(address_map &map) map(0x0000, 0x1fff).rom(); } -MACHINE_CONFIG_START(hp85_state::hp85) - MCFG_DEVICE_ADD("cpu" , HP_CAPRICORN , MASTER_CLOCK / 16) - MCFG_DEVICE_PROGRAM_MAP(cpu_mem_map) - MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(hp85_state , irq_callback) +void hp85_state::hp85(machine_config &config) +{ + HP_CAPRICORN(config, m_cpu, MASTER_CLOCK / 16); + m_cpu->set_addrmap(AS_PROGRAM, &hp85_state::cpu_mem_map); + m_cpu->set_irq_acknowledge_callback(FUNC(hp85_state::irq_callback)); ADDRESS_MAP_BANK(config, "rombank").set_map(&hp85_state::rombank_mem_map).set_options(ENDIANNESS_LITTLE, 8, 21, HP80_OPTROM_SIZE); - MCFG_SCREEN_ADD("screen" , RASTER) - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK / 2 , 312 , 0 , 256 , 256 , 0 , 192) - MCFG_SCREEN_UPDATE_DRIVER(hp85_state , screen_update) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, hp85_state, vblank_w)) + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(MASTER_CLOCK / 2 , 312 , 0 , 256 , 256 , 0 , 192); + m_screen->set_screen_update(FUNC(hp85_state::screen_update)); + m_screen->screen_vblank().set(FUNC(hp85_state::vblank_w)); PALETTE(config, m_palette, palette_device::MONOCHROME); TIMER(config, m_vm_timer).configure_generic(FUNC(hp85_state::vm_timer)); @@ -1362,42 +1363,36 @@ MACHINE_CONFIG_START(hp85_state::hp85) BEEP(config, m_beep, MASTER_CLOCK / 8192).add_route(ALL_OUTPUTS, "mono", 0.5, AUTO_ALLOC_INPUT, 0); // Tape drive - MCFG_DEVICE_ADD("tape" , HP_1MA6 , 0) + HP_1MA6(config, "tape", 0); // Optional ROMs - MCFG_DEVICE_ADD("drawer1", HP80_OPTROM_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(hp80_optrom_slot_devices, NULL, false) - MCFG_DEVICE_ADD("drawer2", HP80_OPTROM_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(hp80_optrom_slot_devices, NULL, false) - MCFG_DEVICE_ADD("drawer3", HP80_OPTROM_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(hp80_optrom_slot_devices, NULL, false) - MCFG_DEVICE_ADD("drawer4", HP80_OPTROM_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(hp80_optrom_slot_devices, NULL, false) - MCFG_DEVICE_ADD("drawer5", HP80_OPTROM_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(hp80_optrom_slot_devices, NULL, false) - MCFG_DEVICE_ADD("drawer6", HP80_OPTROM_SLOT, 0) - MCFG_DEVICE_SLOT_INTERFACE(hp80_optrom_slot_devices, NULL, false) + HP80_OPTROM_SLOT(config, m_rom_drawers[0]); + HP80_OPTROM_SLOT(config, m_rom_drawers[1]); + HP80_OPTROM_SLOT(config, m_rom_drawers[2]); + HP80_OPTROM_SLOT(config, m_rom_drawers[3]); + HP80_OPTROM_SLOT(config, m_rom_drawers[4]); + HP80_OPTROM_SLOT(config, m_rom_drawers[5]); // I/O slots - MCFG_HP80_IO_SLOT_ADD("slot1" , 0) - MCFG_HP80_IO_IRL_CB(WRITE8(*this, hp85_state , irl_w)) - MCFG_HP80_IO_HALT_CB(WRITE8(*this, hp85_state , halt_w)) - MCFG_HP80_IO_SLOT_ADD("slot2" , 1) - MCFG_HP80_IO_IRL_CB(WRITE8(*this, hp85_state , irl_w)) - MCFG_HP80_IO_HALT_CB(WRITE8(*this, hp85_state , halt_w)) - MCFG_HP80_IO_SLOT_ADD("slot3" , 2) - MCFG_HP80_IO_IRL_CB(WRITE8(*this, hp85_state , irl_w)) - MCFG_HP80_IO_HALT_CB(WRITE8(*this, hp85_state , halt_w)) - MCFG_HP80_IO_SLOT_ADD("slot4" , 3) - MCFG_HP80_IO_IRL_CB(WRITE8(*this, hp85_state , irl_w)) - MCFG_HP80_IO_HALT_CB(WRITE8(*this, hp85_state , halt_w)) + HP80_IO_SLOT(config, m_io_slots[0]).set_slot_no(0); + m_io_slots[0]->irl_cb().set(FUNC(hp85_state::irl_w)); + m_io_slots[0]->halt_cb().set(FUNC(hp85_state::halt_w)); + HP80_IO_SLOT(config, m_io_slots[1]).set_slot_no(1); + m_io_slots[1]->irl_cb().set(FUNC(hp85_state::irl_w)); + m_io_slots[1]->halt_cb().set(FUNC(hp85_state::halt_w)); + HP80_IO_SLOT(config, m_io_slots[2]).set_slot_no(2); + m_io_slots[2]->irl_cb().set(FUNC(hp85_state::irl_w)); + m_io_slots[2]->halt_cb().set(FUNC(hp85_state::halt_w)); + HP80_IO_SLOT(config, m_io_slots[3]).set_slot_no(3); + m_io_slots[3]->irl_cb().set(FUNC(hp85_state::irl_w)); + m_io_slots[3]->halt_cb().set(FUNC(hp85_state::halt_w)); // Printer output BITBANGER(config, m_prt_graph_out, 0); BITBANGER(config, m_prt_alpha_out, 0); SOFTWARE_LIST(config, "optrom_list").set_original("hp85_rom"); -MACHINE_CONFIG_END +} ROM_START(hp85) ROM_REGION(0x6000 , "cpu" , 0) -- cgit v1.2.3