diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2019-01-19 20:55:50 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2019-01-19 20:55:50 -0500 |
commit | 7828367c10676e2be9778846baaa83d969574165 (patch) | |
tree | f6cd44ca5a9aeb9d11881ded8268ba418a5f20c0 | |
parent | 88c2e640f33c89b9a852f91bbe9d27a96d4c6a5f (diff) |
i8244: Eliminate MCFG_ macros; set screen parameters in device_config_complete (nw)
-rw-r--r-- | src/devices/video/i8244.cpp | 16 | ||||
-rw-r--r-- | src/devices/video/i8244.h | 24 | ||||
-rw-r--r-- | src/mame/drivers/odyssey2.cpp | 32 |
3 files changed, 39 insertions, 33 deletions
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index 639174a84b8..a2d142b0410 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -130,6 +130,22 @@ i8245_device::i8245_device(const machine_config &mconfig, const char *tag, devic //------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void i8244_device::device_config_complete() +{ + if (!has_screen()) + return; + + if (!screen().refresh_attoseconds()) + screen().set_raw(clock(), LINE_CLOCKS, START_ACTIVE_SCAN, END_ACTIVE_SCAN, m_screen_lines, START_Y, START_Y + SCREEN_HEIGHT); +} + + +//------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index 0bf0174cdba..2a46163073b 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -17,25 +17,6 @@ /*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_I8244_ADD(_tag, _clock, _screen_tag, _irq_cb, _postprocess_cb) \ - MCFG_DEVICE_ADD(_tag, I8244, _clock) \ - MCFG_VIDEO_SET_SCREEN(_screen_tag) \ - MCFG_I8244_IRQ_CB(_irq_cb) \ - MCFG_I8244_POSTPROCESS_CB(_postprocess_cb) -#define MCFG_I8244_IRQ_CB(_devcb) \ - downcast<i8244_device &>(*device).set_irq_cb(DEVCB_##_devcb); -#define MCFG_I8244_POSTPROCESS_CB(_devcb) \ - downcast<i8244_device &>(*device).set_postprocess_cb(DEVCB_##_devcb); -#define MCFG_I8245_ADD(_tag, _clock, _screen_tag, _irq_cb, _postprocess_cb) \ - MCFG_DEVICE_ADD(_tag, I8245, _clock) \ - MCFG_VIDEO_SET_SCREEN(_screen_tag) \ - MCFG_I8244_IRQ_CB(_irq_cb) \ - MCFG_I8244_POSTPROCESS_CB(_postprocess_cb ) - -/*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -51,8 +32,8 @@ public: i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration helpers - template <class Object> devcb_base &set_irq_cb(Object &&cb) { return m_irq_func.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_postprocess_cb(Object &&cb) { return m_postprocess_func.set_callback(std::forward<Object>(cb)); } + auto irq_cb() { return m_irq_func.bind(); } + auto postprocess_cb() { return m_postprocess_func.bind(); } DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); @@ -109,6 +90,7 @@ protected: i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int lines); // device-level overrides + virtual void device_config_complete() override; virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index 72c9c88bf16..11cb183ecce 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -698,7 +698,6 @@ MACHINE_CONFIG_START(odyssey2_state::odyssey2) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( XTAL(7'159'090)/2 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8244_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) MCFG_SCREEN_PALETTE("palette") @@ -707,8 +706,11 @@ MACHINE_CONFIG_START(odyssey2_state::odyssey2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_I8244_ADD( "i8244", XTAL(7'159'090)/2 * 2, "screen", INPUTLINE( "maincpu", 0 ), WRITE16( *this, odyssey2_state, scanline_postprocess ) ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + I8244(config, m_i8244, XTAL(7'159'090)/2 * 2); + m_i8244->set_screen("screen"); + m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); + m_i8244->postprocess_cb().set(FUNC(odyssey2_state::scanline_postprocess)); + m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); odyssey2_cartslot(config); MACHINE_CONFIG_END @@ -724,7 +726,6 @@ MACHINE_CONFIG_START(odyssey2_state::videopac) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS( XTAL(17'734'470)/5 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8245_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT ) MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) MCFG_SCREEN_PALETTE("palette") @@ -733,8 +734,11 @@ MACHINE_CONFIG_START(odyssey2_state::videopac) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_I8245_ADD( "i8244", XTAL(17'734'470)/5 * 2, "screen", INPUTLINE( "maincpu", 0 ), WRITE16( *this, odyssey2_state, scanline_postprocess ) ) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + I8245(config, m_i8244, XTAL(17'734'470)/5 * 2); + m_i8244->set_screen("screen"); + m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); + m_i8244->postprocess_cb().set(FUNC(odyssey2_state::scanline_postprocess)); + m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); odyssey2_cartslot(config); MACHINE_CONFIG_END @@ -759,7 +763,6 @@ MACHINE_CONFIG_START(g7400_state::g7400) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(3540000 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8245_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT) MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) MCFG_SCREEN_PALETTE("palette") @@ -775,8 +778,11 @@ MACHINE_CONFIG_START(g7400_state::g7400) EF9340_1(config, m_ef9340_1, 3540000, "screen"); SPEAKER(config, "mono").front_center(); - MCFG_I8245_ADD("i8244", 3540000 * 2, "screen", INPUTLINE("maincpu", 0), WRITE16(*this, g7400_state, scanline_postprocess)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + I8245(config, m_i8244, 3540000 * 2); + m_i8244->set_screen("screen"); + m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); + m_i8244->postprocess_cb().set(FUNC(g7400_state::scanline_postprocess)); + m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); odyssey2_cartslot(config); MCFG_DEVICE_REMOVE("cart_list") @@ -804,7 +810,6 @@ MACHINE_CONFIG_START(g7400_state::odyssey3) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(3540000 * 2, i8244_device::LINE_CLOCKS, i8244_device::START_ACTIVE_SCAN, i8244_device::END_ACTIVE_SCAN, i8244_device::LINES, i8244_device::START_Y, i8244_device::START_Y + i8244_device::SCREEN_HEIGHT) MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2) MCFG_SCREEN_PALETTE("palette") @@ -820,8 +825,11 @@ MACHINE_CONFIG_START(g7400_state::odyssey3) EF9340_1(config, m_ef9340_1, 3540000, "screen"); SPEAKER(config, "mono").front_center(); - MCFG_I8244_ADD("i8244", 3540000 * 2, "screen", INPUTLINE("maincpu", 0), WRITE16(*this, g7400_state, scanline_postprocess)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) + I8244(config, m_i8244, 3540000 * 2); + m_i8244->set_screen("screen"); + m_i8244->irq_cb().set_inputline(m_maincpu, MCS48_INPUT_IRQ); + m_i8244->postprocess_cb().set(FUNC(g7400_state::scanline_postprocess)); + m_i8244->add_route(ALL_OUTPUTS, "mono", 0.40); odyssey2_cartslot(config); MCFG_DEVICE_REMOVE("cart_list") |