summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/wpc_an.cpp
diff options
context:
space:
mode:
author MooglyGuy <MooglyGuy@users.noreply.github.com>2022-06-04 09:14:21 +0200
committer GitHub <noreply@github.com>2022-06-04 17:14:21 +1000
commit1bc5484698bb746c6f9f7dae58b005d2472f1215 (patch)
tree54d6a10bc728cc7ce9858d771788a595e324141c /src/mame/drivers/wpc_an.cpp
parentcd83335913a6cfe4aa2db720692fa34487b1d7a3 (diff)
- Removed device_timer, device_timer_id, et al in favor of direct callback members. (#9788)
Primarily, this removes device_t::device_timer, device_t::timer_set, device_t::synchronize, device_t::timer_expired, and device_timer_id. Use of device_timer often resulted in unnecessary trampolining in addition to switch/case overhead on a driver/device level, and additional logic to manage delegated vs. ID-based timers on a core level. In the worst cases, devices were performing a switch/case with only one valid case. device_scheduler::timer_set is marked deprecated as the only remaining direct uses are via the Lua engine and a few drivers that need refactoring anyway. The remaining uses occur via device_scheduler::synchronize. As a middle ground between the extremely short timer_alloc() and the extremely long machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(widget_device::contoso_tick), this)), a helper function in device_t has been added which can be invoked with the following syntax: timer_alloc(FUNC(widget_device::contoso_tick), this) - Additional changes/cleanups performed along the way: - Converted to use logmacro: * src/devices/bus/ieee488/hp9895.cpp * src/devices/bus/ieee488/remote488.cpp * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/isa/sc499.cpp * src/devices/bus/vip/vp550.cpp * src/devices/cpu/i86/i186.cpp * src/devices/cpu/lc8670/lc8670.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/corvushd.cpp * src/devices/machine/ds1994.cpp * src/devices/machine/ticket.cpp * src/mame/audio/pinsnd88.cpp * src/mame/drivers/notetaker.cpp * src/mame/machine/asic65.cpp * src/mame/machine/rmnimbus.cpp * src/mame/machine/victor9k_fdc.cpp * src/mame/video/uv201.cpp - Made usage of m_member prefix consistent: * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/machine/ds1386.cpp * src/devices/machine/i7220.cpp - Spacing consistency pass: * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/thomson/nanoresau.cpp * src/devices/bus/ti99/internal/992board.cpp * src/devices/bus/ti99/internal/genkbd.cpp * src/devices/bus/ti99/internal/joyport/handset.cpp * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/cpu/i86/i186.cpp * src/devices/cpu/lc8670/lc8670.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/cop452.cpp * src/devices/machine/corvushd.cpp * src/devices/machine/hp_dc100_tape.cpp * src/devices/machine/hp_taco.cpp * src/devices/machine/meters.cpp * src/devices/machine/microtch.cpp * src/devices/machine/phi.cpp * src/devices/video/ef9365.cpp * src/devices/video/v9938.cpp * src/mame/drivers/alphaskop41xx.cpp * src/mame/drivers/myb3k.cpp * src/mame/drivers/notetaker.cpp * src/mame/drivers/wpc_an.cpp * src/mame/machine/midikbd.cpp * src/mame/machine/rmnimbus.cpp * src/mame/machine/wpc_lamp.cpp * src/mame/machine/wpc_out.cpp - Removed string-based ioport lookups: * src/devices/bus/ti99/internal/joyport/handset.cpp * src/devices/bus/ti99/internal/joyport/mecmouse.cpp * src/devices/bus/vme/vme_hcpu30.cpp * src/mame/machine/k7659kb.cpp * src/mame/machine/ti85.cpp - Adjustments to grammar/wording in comments * src/devices/bus/sms_ctrl/lphaser.cpp * src/devices/bus/sms_ctrl/sports.cpp * src/devices/bus/snes/event.cpp * src/devices/bus/snes/sa1.cpp * src/devices/bus/thomson/nanoresau.cpp * src/devices/bus/z88/z88.cpp * src/devices/machine/ds1386.cpp * src/devices/machine/vic_pl192.cpp - Favored BIT() macro for single-bit checks * src/devices/bus/ti99/internal/992board.cpp * src/devices/bus/ti99/joyport/handset.cpp * src/mame/drivers/notetaker.cpp * src/mame/machine/wpc_lamp.cpp * src/mame/machine/wpc_out.cpp - Removed C89-style variable declarations when noticed * src/devices/bus/isa/hdc.cpp * src/devices/bus/sms_ctrl/lphaser.cpp * src/devices/bus/ti99/joyport/mecmouse.cpp * src/devices/machine/acorn_vidc.cpp * src/devices/sound/ymz280b.cpp * src/devices/video/vic4567.cpp - Removed FUNCNAME to avoid compiler-specific #define checks in devices * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/bus/vme/vme_hcpu30.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/mc14411.cpp * src/mame/drivers/myb3k.cpp - Removed unecessary member prefixes/suffixes * src/devices/video/ef9340_1.cpp * src/mame/drivers/fuukifg2.cpp * src/mame/drivers/fuukifg3.cpp * src/mame/drivers/intv.cpp * src/mame/drivers/simpsons.cpp * src/mame/drivers/socrates.cpp * src/mame/drivers/special_gambl.cpp * src/mame/drivers/sprint4.cpp * src/mame/drivers/ti990_10.cpp * src/mame/drivers/tubep.cpp * src/mame/drivers/vectrex.cpp * src/mame/drivers/wpc_an.cpp * src/mame/drivers/wpc_dot.cpp * src/mame/drivers/wpc_flip1.cpp * src/mame/drivers/wpc_flip2.cpp * src/mame/machine/z80ne.cpp * src/mame/video/rollerg.cpp - Switched to lower-case hex constants * src/devices/video/ef9365.cpp * src/mame/machine/rmnimbus.cpp - Re-ordered driver overrides and function members * src/mame/drivers/boxer.cpp * src/mame/drivers/eurocom2.cpp * src/mame/drivers/exidy.cpp * src/mame/drivers/gpworld.cpp * src/mame/drivers/h19.cpp * src/mame/drivers/ibmpcjr.cpp * src/mame/drivers/mekd5.cpp * src/mame/drivers/mgolf.cpp * src/mame/drivers/myb3k.cpp * src/mame/drivers/nightmare.cpp * src/mame/drivers/notetaker.cpp * src/mame/drivers/ptcsol.cpp * src/mame/drivers/pwrview.cpp * src/mame/drivers/rabbit.cpp * src/mame/drivers/sitcom.cpp * src/mame/drivers/socrates.cpp * src/mame/drivers/sprint4.cpp * src/mame/drivers/techno.cpp * src/mame/drivers/thayers.cpp * src/mame/drivers/ti990_10.cpp * src/mame/drivers/ti990_4.cpp * src/mame/drivers/tv912.cpp * src/mame/drivers/tv990.cpp * src/mame/drivers/uchroma68.cpp * src/mame/drivers/vk100.cpp * src/mame/drivers/votrhv.cpp * src/mame/drivers/wicat.cpp * src/mame/drivers/wpc_an.cpp * src/mame/includes/abc80.h * src/mame/includes/asterix.h * src/mame/includes/fuukifg2.h * src/mame/includes/fuukifg3.h * src/mame/includes/gunbustr.h * src/mame/includes/intv.h * src/mame/includes/namcona1.h * src/mame/includes/newbrain.h * src/mame/includes/poly.h * src/mame/includes/prof80.h * src/mame/includes/rollerg.h * src/mame/includes/s11.h * src/mame/includes/segahang.h * src/mame/includes/simpsons.h * src/mame/includes/spacefb.h * src/mame/includes/tandy2k.h * src/mame/includes/trucocl.h * src/mame/includes/tubebp.h * src/mame/includes/vidbrain.h * src/mame/includes/wolfpack.h * src/mame/includes/wpc_dot.h - Made capitalization consistent on class members * src/devices/machine/meters.cpp * src/mame/drivers/namcona1.cpp * src/mame/drivers/notetaker.cpp -src/devices/bus/isa/hdc.cpp: * Removed fixed-size std::vector in favor of std::unique_ptr -src/devices/bus/isa/s3virge.cpp: * Moved unusually large (for a header) functions into .cpp from header -src/devices/bus/vip/vp550.cpp * Switched to required_device_array to simplify code paths -src/devices/machine/arm_iomd.cpp * Added initializers to constructor * Favored std::size over fixed static sizes -src/devices/machine/ds1386.cpp * Moved register #defines into header enums -src/devices/machine/mc68901.cpp * Removed unnecessary parameters and emu_timer::enable calls -src/devices/machine/mccs1850.cpp * Removed inline overuse -src/devices/machine/meters.cpp * Removed unused members -src/devices/machine/mos6526.cpp * Removed inline overuse -src/devices/machine/nsc810.cpp * Converted to arrays rather than individually-numbered members -src/devices/machine/pxa255.cpp * Simplified DMA transfer code -src/devices/machine/saa1043.cpp * Removed extraneous members in favor of resolve_all_safe -src/devices/machine/vic_pl192.cpp * Shifted constructors, start-up, and maps to be at the top of the source file -src/devices/machine/z8536.cpp * Removed stray uses of device_timer_id -src/devices/sound/cdp1869.cpp * Removed inline overuse -src/devices/sound/mos7360.cpp * Converted to arrays rather than individually-numbered members -src/emu/device.cpp * Removed ID-based timer_alloc * Removed timer_set * Removed synchronize * Removed timer_expired * Added shorthand timer_alloc to avoid lengthy machine().scheduler().timer_alloc() calls -src/emu/schedule.cpp * Removed now-unused m_id and m_device members -src/mame/audio/alesis.cpp * Added initializers to constructor -src/mame/drivers/alto2.cpp * Removed custom-named driver init in favor of driver_init override * Removed octal constant in favor of more standard hex -src/mame/drivers/astinvad.cpp * Fixed 'kamizake' typo -src/mame/drivers/tm990189.cpp * Removed unnecessary machine reset override -src/mame/drivers/unichamp.cpp * Removed custom-named driver init in favor of driver_init override -src/mame/drivers/votrhv.cpp * Fixed ROM_LOAD macros and region() usage in memory maps -src/mame/machine/victor9k_fdc.cpp * Made bracing style consistent across the file -src/mame/video/gime.cpp * Removed unnecessary void specifiers in function prototypes
Diffstat (limited to 'src/mame/drivers/wpc_an.cpp')
-rw-r--r--src/mame/drivers/wpc_an.cpp106
1 files changed, 51 insertions, 55 deletions
diff --git a/src/mame/drivers/wpc_an.cpp b/src/mame/drivers/wpc_an.cpp
index 7a6369984df..ec33b35076b 100644
--- a/src/mame/drivers/wpc_an.cpp
+++ b/src/mame/drivers/wpc_an.cpp
@@ -119,8 +119,27 @@ public:
void init_wpc_an();
private:
+ // driver_device overrides
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+
void wpc_an_map(address_map &map);
+ TIMER_CALLBACK_MEMBER(vblank_tick);
+ TIMER_CALLBACK_MEMBER(trigger_irq);
+
+ uint8_t ram_r(offs_t offset);
+ void ram_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(snd_reply_w);
+ DECLARE_WRITE_LINE_MEMBER(irq_w);
+ DECLARE_WRITE_LINE_MEMBER(firq_w);
+ uint8_t sound_ctrl_r();
+ void sound_ctrl_w(uint8_t data);
+ uint8_t sound_data_r();
+ void sound_data_w(uint8_t data);
+ void sound_s11_w(uint8_t data);
+ void rombank_w(uint8_t data);
+
// devices
required_device<cpu_device> m_maincpu;
optional_device<s11c_bg_device> m_bg; // only used w/ Dr. Dude and Funhouse Proto
@@ -129,25 +148,6 @@ private:
required_device<wpc_device> m_wpc;
output_finder<32> m_digits;
- // driver_device overrides
- virtual void machine_reset() override;
- virtual void machine_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
- static const device_timer_id TIMER_VBLANK = 0;
- static const device_timer_id TIMER_IRQ = 1;
-
- uint8_t ram_r(offs_t offset);
- void ram_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(wpcsnd_reply_w);
- DECLARE_WRITE_LINE_MEMBER(wpc_irq_w);
- DECLARE_WRITE_LINE_MEMBER(wpc_firq_w);
- uint8_t wpc_sound_ctrl_r();
- void wpc_sound_ctrl_w(uint8_t data);
- uint8_t wpc_sound_data_r();
- void wpc_sound_data_w(uint8_t data);
- void wpc_sound_s11_w(uint8_t data);
- void wpc_rombank_w(uint8_t data);
-
uint16_t m_vblank_count = 0U;
uint32_t m_irq_count = 0U;
uint8_t m_bankmask = 0U;
@@ -283,56 +283,52 @@ static INPUT_PORTS_START( wpc_an )
INPUT_PORTS_END
-void wpc_an_state::device_timer(emu_timer &timer, device_timer_id id, int param)
+TIMER_CALLBACK_MEMBER(wpc_an_state::vblank_tick)
{
- int x;
- switch(id)
+ // update LED segments
+ for(int x = 0; x < 16; x++)
{
- case TIMER_VBLANK:
- // update LED segments
- for(x=0;x<16;x++)
- {
- m_digits[x] = bitswap<16>(m_wpc->get_alphanumeric(x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
- m_digits[x+16] = bitswap<16>(m_wpc->get_alphanumeric(20+x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
- }
- m_wpc->reset_alphanumeric();
- m_vblank_count++;
- break;
- case TIMER_IRQ:
- m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE);
- break;
+ m_digits[x] = bitswap<16>(m_wpc->get_alphanumeric(x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
+ m_digits[x+16] = bitswap<16>(m_wpc->get_alphanumeric(20+x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0);
}
+ m_wpc->reset_alphanumeric();
+ m_vblank_count++;
+}
+
+TIMER_CALLBACK_MEMBER(wpc_an_state::trigger_irq)
+{
+ m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
}
-void wpc_an_state::wpc_rombank_w(uint8_t data)
+void wpc_an_state::rombank_w(uint8_t data)
{
m_cpubank->set_entry(data & m_bankmask);
}
-WRITE_LINE_MEMBER(wpc_an_state::wpcsnd_reply_w)
+WRITE_LINE_MEMBER(wpc_an_state::snd_reply_w)
{
if(state)
m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE);
}
-WRITE_LINE_MEMBER(wpc_an_state::wpc_irq_w)
+WRITE_LINE_MEMBER(wpc_an_state::irq_w)
{
m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE);
}
-WRITE_LINE_MEMBER(wpc_an_state::wpc_firq_w)
+WRITE_LINE_MEMBER(wpc_an_state::firq_w)
{
m_maincpu->set_input_line(M6809_FIRQ_LINE,CLEAR_LINE);
}
-uint8_t wpc_an_state::wpc_sound_ctrl_r()
+uint8_t wpc_an_state::sound_ctrl_r()
{
if(m_wpcsnd)
return m_wpcsnd->ctrl_r(); // ack FIRQ?
return 0;
}
-void wpc_an_state::wpc_sound_ctrl_w(uint8_t data)
+void wpc_an_state::sound_ctrl_w(uint8_t data)
{
if(m_bg)
{
@@ -343,14 +339,14 @@ void wpc_an_state::wpc_sound_ctrl_w(uint8_t data)
m_wpcsnd->ctrl_w(data);
}
-uint8_t wpc_an_state::wpc_sound_data_r()
+uint8_t wpc_an_state::sound_data_r()
{
if(m_wpcsnd)
return m_wpcsnd->data_r();
return 0;
}
-void wpc_an_state::wpc_sound_data_w(uint8_t data)
+void wpc_an_state::sound_data_w(uint8_t data)
{
if(m_bg)
{
@@ -361,7 +357,7 @@ void wpc_an_state::wpc_sound_data_w(uint8_t data)
m_wpcsnd->data_w(data);
}
-void wpc_an_state::wpc_sound_s11_w(uint8_t data)
+void wpc_an_state::sound_s11_w(uint8_t data)
{
if(m_bg)
{
@@ -409,9 +405,9 @@ void wpc_an_state::init_wpc_an()
m_cpubank->configure_entries(0, 32, &ROM[0x10000], 0x4000);
m_cpubank->set_entry(0);
- m_vblank_timer = timer_alloc(TIMER_VBLANK);
+ m_vblank_timer = timer_alloc(FUNC(wpc_an_state::vblank_tick), this);
m_vblank_timer->adjust(attotime::from_hz(60),0,attotime::from_hz(60));
- m_irq_timer = timer_alloc(TIMER_IRQ);
+ m_irq_timer = timer_alloc(FUNC(wpc_an_state::trigger_irq), this);
m_irq_timer->adjust(attotime::from_hz(976),0,attotime::from_hz(976));
m_bankmask = ((memregion("maincpu")->bytes()-0x10000) >> 14) - 1;
@@ -429,14 +425,14 @@ void wpc_an_state::wpc_an_base(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &wpc_an_state::wpc_an_map);
WPCASIC(config, m_wpc, 0);
- m_wpc->irq_callback().set(FUNC(wpc_an_state::wpc_irq_w));
- m_wpc->firq_callback().set(FUNC(wpc_an_state::wpc_firq_w));
- m_wpc->bank_write().set(FUNC(wpc_an_state::wpc_rombank_w));
- m_wpc->sound_ctrl_read().set(FUNC(wpc_an_state::wpc_sound_ctrl_r));
- m_wpc->sound_ctrl_write().set(FUNC(wpc_an_state::wpc_sound_ctrl_w));
- m_wpc->sound_data_read().set(FUNC(wpc_an_state::wpc_sound_data_r));
- m_wpc->sound_data_write().set(FUNC(wpc_an_state::wpc_sound_data_w));
- m_wpc->sound_s11_write().set(FUNC(wpc_an_state::wpc_sound_s11_w));
+ m_wpc->irq_callback().set(FUNC(wpc_an_state::irq_w));
+ m_wpc->firq_callback().set(FUNC(wpc_an_state::firq_w));
+ m_wpc->bank_write().set(FUNC(wpc_an_state::rombank_w));
+ m_wpc->sound_ctrl_read().set(FUNC(wpc_an_state::sound_ctrl_r));
+ m_wpc->sound_ctrl_write().set(FUNC(wpc_an_state::sound_ctrl_w));
+ m_wpc->sound_data_read().set(FUNC(wpc_an_state::sound_data_r));
+ m_wpc->sound_data_write().set(FUNC(wpc_an_state::sound_data_w));
+ m_wpc->sound_s11_write().set(FUNC(wpc_an_state::sound_s11_w));
config.set_default_layout(layout_wpc_an);
}
@@ -448,7 +444,7 @@ void wpc_an_state::wpc_an(machine_config &config)
SPEAKER(config, "speaker").front_center();
WPCSND(config, m_wpcsnd);
m_wpcsnd->set_romregion("sound1");
- m_wpcsnd->reply_callback().set(FUNC(wpc_an_state::wpcsnd_reply_w));
+ m_wpcsnd->reply_callback().set(FUNC(wpc_an_state::snd_reply_w));
m_wpcsnd->add_route(ALL_OUTPUTS, "speaker", 1.0);
}