summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Andrew Gardner <andrew-gardner@users.noreply.github.com>2013-05-23 04:38:53 +0000
committer Andrew Gardner <andrew-gardner@users.noreply.github.com>2013-05-23 04:38:53 +0000
commitdf8ca739fb09fa9eec7cda5389572501521df66b (patch)
tree63a9ba6955ebcdfb36cde975ce00b175b0c5093a /src
parente7210a3a57496d2e052b2d55a572d827cc0e6ec5 (diff)
MESS anonymous timers this time. (nw)
Diffstat (limited to 'src')
-rw-r--r--src/mess/drivers/alphatro.c30
-rw-r--r--src/mess/drivers/argo.c29
-rw-r--r--src/mess/drivers/atarist.c70
-rw-r--r--src/mess/drivers/c10.c24
-rw-r--r--src/mess/drivers/cat.c31
-rw-r--r--src/mess/drivers/dectalk.c24
-rw-r--r--src/mess/drivers/fm7.c45
-rw-r--r--src/mess/drivers/h19.c22
-rw-r--r--src/mess/drivers/intv.c21
-rw-r--r--src/mess/drivers/ip20.c28
-rw-r--r--src/mess/drivers/ip22.c34
-rw-r--r--src/mess/drivers/mekd2.c23
-rw-r--r--src/mess/drivers/okean240.c28
-rw-r--r--src/mess/drivers/osi.c15
-rw-r--r--src/mess/drivers/pc88va.c60
-rw-r--r--src/mess/drivers/pcfx.c22
-rw-r--r--src/mess/drivers/pes.c2
-rw-r--r--src/mess/drivers/plan80.c24
-rw-r--r--src/mess/drivers/ptcsol.c30
-rw-r--r--src/mess/drivers/samcoupe.c24
-rw-r--r--src/mess/drivers/sg1000.c17
-rw-r--r--src/mess/drivers/snes.c22
-rw-r--r--src/mess/drivers/socrates.c31
-rw-r--r--src/mess/drivers/studio2.c15
-rw-r--r--src/mess/drivers/sys2900.c24
-rw-r--r--src/mess/drivers/tmc1800.c15
-rw-r--r--src/mess/drivers/vk100.c72
-rw-r--r--src/mess/drivers/x68k.c101
-rw-r--r--src/mess/drivers/zrt80.c26
-rw-r--r--src/mess/includes/atarist.h29
-rw-r--r--src/mess/includes/fm7.h14
-rw-r--r--src/mess/includes/intv.h8
-rw-r--r--src/mess/includes/osi.h9
-rw-r--r--src/mess/includes/samcoupe.h10
-rw-r--r--src/mess/includes/sg1000.h8
-rw-r--r--src/mess/includes/studio2.h9
-rw-r--r--src/mess/includes/tmc1800.h9
-rw-r--r--src/mess/includes/x68k.h26
-rw-r--r--src/mess/includes/zx.h8
-rw-r--r--src/mess/machine/intv.c5
-rw-r--r--src/mess/machine/samcoupe.c4
-rw-r--r--src/mess/machine/zx.c8
-rw-r--r--src/mess/video/atarist.c37
-rw-r--r--src/mess/video/fm7.c2
-rw-r--r--src/mess/video/x68k.c6
-rw-r--r--src/mess/video/zx.c23
46 files changed, 875 insertions, 249 deletions
diff --git a/src/mess/drivers/alphatro.c b/src/mess/drivers/alphatro.c
index 3a56d4cff82..8b340658171 100644
--- a/src/mess/drivers/alphatro.c
+++ b/src/mess/drivers/alphatro.c
@@ -34,6 +34,13 @@
class alphatro_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_SYSTEM,
+ TIMER_SERIAL,
+ TIMER_ALPHATRO_BEEP_OFF
+ };
+
alphatro_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -67,18 +74,10 @@ public:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
private:
- static const device_timer_id SYSTEM_TIMER = 0;
- static const device_timer_id SERIAL_TIMER = 1;
UINT8 m_timer_bit;
virtual void palette_init();
- TIMER_CALLBACK_MEMBER(alphatro_beepoff);
};
-TIMER_CALLBACK_MEMBER(alphatro_state::alphatro_beepoff)
-{
- m_beep->set_state(0);
-}
-
READ8_MEMBER( alphatro_state::port10_r )
{
//return (space.machine().device<screen_device>("screen")->vblank() ? 0x00 : 0x80);
@@ -101,7 +100,7 @@ WRITE8_MEMBER( alphatro_state::port10_w )
if (length)
{
- machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(alphatro_state::alphatro_beepoff),this));
+ timer_set(attotime::from_msec(length), TIMER_ALPHATRO_BEEP_OFF);
m_beep->set_state(1);
}
@@ -112,13 +111,18 @@ void alphatro_state::device_timer(emu_timer &timer, device_timer_id id, int para
{
switch(id)
{
- case SYSTEM_TIMER:
+ case TIMER_SYSTEM:
m_timer_bit ^= 0x80;
break;
- case SERIAL_TIMER:
+ case TIMER_SERIAL:
m_usart->transmit_clock();
m_usart->receive_clock();
break;
+ case TIMER_ALPHATRO_BEEP_OFF:
+ m_beep->set_state(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in alphatro_state::device_timer");
}
}
@@ -342,8 +346,8 @@ GFXDECODE_END
void alphatro_state::machine_start()
{
- m_sys_timer = timer_alloc(SYSTEM_TIMER);
- m_serial_timer = timer_alloc(SERIAL_TIMER);
+ m_sys_timer = timer_alloc(TIMER_SYSTEM);
+ m_serial_timer = timer_alloc(TIMER_SERIAL);
}
void alphatro_state::machine_reset()
diff --git a/src/mess/drivers/argo.c b/src/mess/drivers/argo.c
index 891702e482f..ca1b4788b78 100644
--- a/src/mess/drivers/argo.c
+++ b/src/mess/drivers/argo.c
@@ -28,11 +28,15 @@
class argo_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_BOOT
+ };
+
argo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
- ,
- m_p_videoram(*this, "p_videoram"){ }
+ m_maincpu(*this, "maincpu"),
+ m_p_videoram(*this, "p_videoram"){ }
required_device<cpu_device> m_maincpu;
DECLARE_WRITE8_MEMBER(argo_videoram_w);
@@ -49,7 +53,9 @@ public:
virtual void video_start();
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_DRIVER_INIT(argo);
- TIMER_CALLBACK_MEMBER(argo_boot);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
// write to videoram if following 'out b9,61' otherwise write to the unknown 'extra' ram
@@ -249,16 +255,23 @@ static INPUT_PORTS_START( argo ) // Keyboard was worked out by trial & error;'F'
INPUT_PORTS_END
-/* after the first 4 bytes have been read from ROM, switch the ram back in */
-TIMER_CALLBACK_MEMBER(argo_state::argo_boot)
+void argo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- membank("boot")->set_entry(0);
+ switch (id)
+ {
+ case TIMER_BOOT:
+ /* after the first 4 bytes have been read from ROM, switch the ram back in */
+ membank("boot")->set_entry(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in argo_state::device_timer");
+ }
}
void argo_state::machine_reset()
{
membank("boot")->set_entry(1);
- machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(argo_state::argo_boot),this));
+ timer_set(attotime::from_usec(5), TIMER_BOOT);
}
DRIVER_INIT_MEMBER(argo_state,argo)
diff --git a/src/mess/drivers/atarist.c b/src/mess/drivers/atarist.c
index 6bb8bfe7f44..d07a37e1bd4 100644
--- a/src/mess/drivers/atarist.c
+++ b/src/mess/drivers/atarist.c
@@ -40,6 +40,32 @@ static const int DMASOUND_RATE[] = { Y2/640/8, Y2/640/4, Y2/640/2, Y2/640 };
//**************************************************************************
+// TIMERS
+//**************************************************************************
+
+void st_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_MOUSE_TICK:
+ mouse_tick();
+ break;
+ case TIMER_SHIFTER_TICK:
+ shifter_tick();
+ break;
+ case TIMER_GLUE_TICK:
+ glue_tick();
+ break;
+ case TIMER_BLITTER_TICK:
+ blitter_tick();
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in st_state::device_timer");
+ }
+}
+
+
+//**************************************************************************
// FLOPPY
//**************************************************************************
@@ -474,16 +500,6 @@ void st_state::mouse_tick()
//-------------------------------------------------
-// TIMER_CALLBACK_MEMBER( st_mouse_tick )
-//-------------------------------------------------
-
-TIMER_CALLBACK_MEMBER(st_state::st_mouse_tick)
-{
- mouse_tick();
-}
-
-
-//-------------------------------------------------
// ikbd_port1_r -
//-------------------------------------------------
@@ -768,13 +784,19 @@ void ste_state::dmasound_tick()
}
-//-------------------------------------------------
-// TIMER_CALLBACK_MEMBER( atariste_dmasound_tick )
-//-------------------------------------------------
-
-TIMER_CALLBACK_MEMBER(ste_state::atariste_dmasound_tick)
+void ste_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- dmasound_tick();
+ switch (id)
+ {
+ case TIMER_DMASOUND_TICK:
+ dmasound_tick();
+ break;
+ case TIMER_MICROWIRE_TICK:
+ microwire_tick();
+ break;
+ default:
+ st_state::device_timer(timer, id, param, ptr);
+ }
}
@@ -1018,16 +1040,6 @@ void ste_state::microwire_tick()
//-------------------------------------------------
-// TIMER_CALLBACK_MEMBER( atariste_microwire_tick )
-//-------------------------------------------------
-
-TIMER_CALLBACK_MEMBER(ste_state::atariste_microwire_tick)
-{
- microwire_tick();
-}
-
-
-//-------------------------------------------------
// microwire_data_r -
//-------------------------------------------------
@@ -2274,7 +2286,7 @@ void st_state::machine_start()
// allocate timers
if(m_mousex) {
- m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_state::st_mouse_tick),this));
+ m_mouse_timer = timer_alloc(TIMER_MOUSE_TICK);
m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500));
}
@@ -2332,8 +2344,8 @@ void ste_state::machine_start()
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(st_state::atarist_int_ack),this));
/* allocate timers */
- m_dmasound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ste_state::atariste_dmasound_tick),this));
- m_microwire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ste_state::atariste_microwire_tick),this));
+ m_dmasound_timer = timer_alloc(TIMER_DMASOUND_TICK);
+ m_microwire_timer = timer_alloc(TIMER_MICROWIRE_TICK);
/* register for state saving */
state_save();
diff --git a/src/mess/drivers/c10.c b/src/mess/drivers/c10.c
index fe52817f0e8..aee843d60ac 100644
--- a/src/mess/drivers/c10.c
+++ b/src/mess/drivers/c10.c
@@ -17,6 +17,11 @@
class c10_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_RESET
+ };
+
c10_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -29,7 +34,9 @@ public:
virtual void video_start();
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_DRIVER_INIT(c10);
- TIMER_CALLBACK_MEMBER(c10_reset);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -51,16 +58,23 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( c10 )
INPUT_PORTS_END
-/* after the first 4 bytes have been read from ROM, switch the ram back in */
-TIMER_CALLBACK_MEMBER(c10_state::c10_reset)
+void c10_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- membank("boot")->set_entry(0);
+ switch (id)
+ {
+ case TIMER_RESET:
+ /* after the first 4 bytes have been read from ROM, switch the ram back in */
+ membank("boot")->set_entry(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in c10_state::device_timer");
+ }
}
void c10_state::machine_reset()
{
membank("boot")->set_entry(1);
- machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(c10_state::c10_reset),this));
+ timer_set(attotime::from_usec(4), TIMER_RESET);
}
void c10_state::video_start()
diff --git a/src/mess/drivers/cat.c b/src/mess/drivers/cat.c
index eaf4484c78b..17dc8a0b133 100644
--- a/src/mess/drivers/cat.c
+++ b/src/mess/drivers/cat.c
@@ -250,6 +250,13 @@ ToDo:
class cat_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_KEYBOARD,
+ TIMER_COUNTER_6MS,
+ TIMER_SWYFT_RESET
+ };
+
cat_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -333,10 +340,13 @@ public:
UINT8 m_keyboard_line;
UINT8 m_floppy_control;
- TIMER_CALLBACK_MEMBER(keyboard_callback);
+ //TIMER_CALLBACK_MEMBER(keyboard_callback);
TIMER_CALLBACK_MEMBER(counter_6ms_callback);
TIMER_CALLBACK_MEMBER(swyft_reset);
IRQ_CALLBACK_MEMBER(cat_int_ack);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
// TODO: this init doesn't actually work yet! please fix me!
@@ -805,6 +815,21 @@ static INPUT_PORTS_START( swyft )
INPUT_PORTS_END
+void cat_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_COUNTER_6MS:
+ counter_6ms_callback(ptr, param);
+ break;
+ case TIMER_SWYFT_RESET:
+ swyft_reset(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in cat_state::device_timer");
+ }
+}
+
TIMER_CALLBACK_MEMBER(cat_state::counter_6ms_callback)
{
// This is effectively also the KTOBF line 'clock' output to the d-latch before the duart
@@ -827,7 +852,7 @@ MACHINE_START_MEMBER(cat_state,cat)
m_6ms_counter = 0;
m_video_enable = 1;
m_video_invert = 0;
- m_6ms_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::counter_6ms_callback),this));
+ m_6ms_timer = timer_alloc(TIMER_COUNTER_6MS);
machine().device<nvram_device>("nvram")->set_base(m_svram, 0x4000);
}
@@ -882,7 +907,7 @@ MACHINE_START_MEMBER(cat_state,swyft)
MACHINE_RESET_MEMBER(cat_state,swyft)
{
- machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(cat_state::swyft_reset),this));
+ timer_set(attotime::from_usec(10), TIMER_SWYFT_RESET);
}
VIDEO_START_MEMBER(cat_state,swyft)
diff --git a/src/mess/drivers/dectalk.c b/src/mess/drivers/dectalk.c
index bfca9449dc4..25045b7bde0 100644
--- a/src/mess/drivers/dectalk.c
+++ b/src/mess/drivers/dectalk.c
@@ -233,6 +233,11 @@ dgc (dg(no!spam)cx@mac.com)
class dectalk_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_OUTFIFO_READ
+ };
+
dectalk_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_terminal(*this, TERMINAL_TAG) ,
@@ -289,6 +294,9 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_dsp;
required_device<dac_device> m_dac;
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -785,6 +793,18 @@ INPUT_PORTS_END
/******************************************************************************
Machine Drivers
******************************************************************************/
+void dectalk_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_OUTFIFO_READ:
+ outfifo_read_cb(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in dectalk_state::device_timer");
+ }
+}
+
TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb)
{
UINT16 data;
@@ -792,7 +812,7 @@ TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb)
#ifdef VERBOSE
if (data!= 0x8000) logerror("sample output: %04X\n", data);
#endif
- machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this));
+ timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ);
m_dac->write_signed16(data);
// hack for break key, requires hacked up duart core so disabled for now
// also it doesn't work well, the setup menu is badly corrupt
@@ -808,7 +828,7 @@ DRIVER_INIT_MEMBER(dectalk_state,dectalk)
{
dectalk_clear_all_fifos();
m_simulate_outfifo_error = 0;
- machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this));
+ timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ);
}
WRITE8_MEMBER(dectalk_state::dectalk_kbd_put)
diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c
index d6022b279d3..be55e5ea456 100644
--- a/src/mess/drivers/fm7.c
+++ b/src/mess/drivers/fm7.c
@@ -177,6 +177,37 @@ void fm7_state::main_irq_clear_flag(UINT8 flag)
}
+void fm7_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_FM7_BEEPER_OFF:
+ fm7_beeper_off(ptr, param);
+ break;
+ case TIMER_FM77AV_ENCODER_ACK:
+ fm77av_encoder_ack(ptr, param);
+ break;
+ case TIMER_FM7_IRQ:
+ fm7_timer_irq(ptr, param);
+ break;
+ case TIMER_FM7_SUBTIMER_IRQ:
+ fm7_subtimer_irq(ptr, param);
+ break;
+ case TIMER_FM7_KEYBOARD_POLL:
+ fm7_keyboard_poll(ptr, param);
+ break;
+ case TIMER_FM77AV_ALU_TASK_END:
+ fm77av_alu_task_end(ptr, param);
+ break;
+ case TIMER_FM77AV_VSYNC:
+ fm77av_vsync(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in fm7_state::device_timer");
+ }
+}
+
+
/*
* Main CPU: I/O port 0xfd02
*
@@ -257,7 +288,7 @@ WRITE8_MEMBER(fm7_state::fm7_beeper_w)
{
m_beeper->set_state(1);
logerror("timed beeper on\n");
- machine().scheduler().timer_set(attotime::from_msec(205), timer_expired_delegate(FUNC(fm7_state::fm7_beeper_off),this));
+ timer_set(attotime::from_msec(205), TIMER_FM7_BEEPER_OFF);
}
}
logerror("beeper state: %02x\n",data);
@@ -274,7 +305,7 @@ READ8_MEMBER(fm7_state::fm7_sub_beeper_r)
{
m_beeper->set_state(1);
logerror("timed beeper on\n");
- machine().scheduler().timer_set(attotime::from_msec(205), timer_expired_delegate(FUNC(fm7_state::fm7_beeper_off),this));
+ timer_set(attotime::from_msec(205), TIMER_FM7_BEEPER_OFF);
}
return 0xff;
}
@@ -706,7 +737,7 @@ WRITE8_MEMBER(fm7_state::fm77av_key_encoder_w)
fm77av_encoder_handle_command();
// wait 5us to set ACK flag
- machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(fm7_state::fm77av_encoder_ack),this));
+ timer_set(attotime::from_usec(5), TIMER_FM77AV_ENCODER_ACK);
//logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,m_encoder.position);
}
@@ -1816,10 +1847,10 @@ DRIVER_INIT_MEMBER(fm7_state,fm7)
{
// m_shared_ram = auto_alloc_array(machine(),UINT8,0x80);
m_video_ram = auto_alloc_array(machine(),UINT8,0x18000); // 2 pages on some systems
- m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm7_timer_irq),this));
- m_subtimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm7_subtimer_irq),this));
- m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm7_keyboard_poll),this));
- m_fm77av_vsync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm77av_vsync),this));
+ m_timer = timer_alloc(TIMER_FM7_IRQ);
+ m_subtimer = timer_alloc(TIMER_FM7_SUBTIMER_IRQ);
+ m_keyboard_timer = timer_alloc(TIMER_FM7_KEYBOARD_POLL);
+ m_fm77av_vsync_timer = timer_alloc(TIMER_FM77AV_VSYNC);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(fm7_state::fm7_irq_ack),this));
m_sub->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(fm7_state::fm7_sub_irq_ack),this));
}
diff --git a/src/mess/drivers/h19.c b/src/mess/drivers/h19.c
index 318d101ef1b..3c05d488938 100644
--- a/src/mess/drivers/h19.c
+++ b/src/mess/drivers/h19.c
@@ -44,6 +44,11 @@
class h19_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_BEEP_OFF
+ };
+
h19_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -66,14 +71,23 @@ public:
UINT8 m_term_data;
virtual void machine_reset();
virtual void video_start();
- TIMER_CALLBACK_MEMBER(h19_beepoff);
DECLARE_WRITE_LINE_MEMBER(h19_ace_irq);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
-TIMER_CALLBACK_MEMBER(h19_state::h19_beepoff)
+void h19_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- m_beep->set_state(0);
+ switch (id)
+ {
+ case TIMER_BEEP_OFF:
+ m_beep->set_state(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in h19_state::device_timer");
+ }
}
READ8_MEMBER( h19_state::h19_80_r )
@@ -100,7 +114,7 @@ WRITE8_MEMBER( h19_state::h19_c0_w )
UINT8 length = (offset & 0x20) ? 200 : 4;
m_beep->set_state(1);
- machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(h19_state::h19_beepoff),this));
+ timer_set(attotime::from_msec(length), TIMER_BEEP_OFF);
}
static ADDRESS_MAP_START(h19_mem, AS_PROGRAM, 8, h19_state)
diff --git a/src/mess/drivers/intv.c b/src/mess/drivers/intv.c
index 5345d0286d5..114dc4d6062 100644
--- a/src/mess/drivers/intv.c
+++ b/src/mess/drivers/intv.c
@@ -793,6 +793,25 @@ static ADDRESS_MAP_START( intvkbd2_mem , AS_PROGRAM, 8, intv_state)
AM_RANGE( 0xc000, 0xffff) AM_ROM
ADDRESS_MAP_END
+void intv_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_INTV_INTERRUPT2_COMPLETE:
+ intv_interrupt2_complete(ptr, param);
+ break;
+ case TIMER_INTV_INTERRUPT_COMPLETE:
+ intv_interrupt_complete(ptr, param);
+ break;
+ case TIMER_INTV_BTB_FILL:
+ intv_btb_fill(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in intv_state::device_timer");
+ }
+}
+
+
/* This is needed because MAME core does not allow PULSE_LINE.
The time interval is not critical, although it should be below 1000. */
@@ -804,7 +823,7 @@ TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt2_complete)
INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt2)
{
m_keyboard->set_input_line(0, ASSERT_LINE);
- machine().scheduler().timer_set(m_keyboard->cycles_to_attotime(100), timer_expired_delegate(FUNC(intv_state::intv_interrupt2_complete),this));
+ timer_set(m_keyboard->cycles_to_attotime(100), TIMER_INTV_INTERRUPT2_COMPLETE);
}
static MACHINE_CONFIG_START( intv, intv_state )
diff --git a/src/mess/drivers/ip20.c b/src/mess/drivers/ip20.c
index c7d8680d19e..f57fc8c217b 100644
--- a/src/mess/drivers/ip20.c
+++ b/src/mess/drivers/ip20.c
@@ -46,6 +46,11 @@ struct RTC_t
class ip20_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_RTC
+ };
+
ip20_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_wd33c93(*this, "scsi:wd33c93"),
@@ -65,12 +70,15 @@ public:
virtual void machine_start();
virtual void video_start();
UINT32 screen_update_ip204415(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(ip20_timer);
+ TIMER_CALLBACK_MEMBER(ip20_timer_rtc);
required_device<wd33c93_device> m_wd33c93;
required_device<scc8530_t> m_scc;
required_device<eeprom_device> m_eeprom;
inline void ATTR_PRINTF(3,4) verboselog(int n_level, const char *s_fmt, ... );
required_device<cpu_device> m_maincpu;
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -493,7 +501,19 @@ DRIVER_INIT_MEMBER(ip20_state,ip204415)
{
}
-TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer)
+void ip20_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_RTC:
+ ip20_timer_rtc(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in ip20_state::device_timer");
+ }
+}
+
+TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer_rtc)
{
ip20_state *state = machine().driver_data<ip20_state>();
@@ -549,7 +569,7 @@ TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer)
}
}
- machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip20_state::ip20_timer),this));
+ timer_set(attotime::from_msec(1), TIMER_RTC);
}
void ip20_state::machine_start()
@@ -565,7 +585,7 @@ void ip20_state::machine_start()
m_RTC.nTemp = 0;
- machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip20_state::ip20_timer),this));
+ timer_set(attotime::from_msec(1), TIMER_RTC);
}
static INPUT_PORTS_START( ip204415 )
diff --git a/src/mess/drivers/ip22.c b/src/mess/drivers/ip22.c
index 47cd8e729c1..7698bf41dcc 100644
--- a/src/mess/drivers/ip22.c
+++ b/src/mess/drivers/ip22.c
@@ -91,6 +91,12 @@ struct PBUS_DMA_t
class ip22_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_IP22_DMA,
+ TIMER_IP22_MSEC
+ };
+
ip22_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -152,6 +158,9 @@ public:
void int3_lower_local1_irq(UINT8 source_mask);
void dump_chain(address_space &space, UINT32 ch_base);
void rtc_update();
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -1050,9 +1059,24 @@ WRITE32_MEMBER(ip22_state::hal2_w)
#define PBUS_DMADESC_BC 0x00003fff
+void ip22_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_IP22_DMA:
+ ip22_dma(ptr, param);
+ break;
+ case TIMER_IP22_MSEC:
+ ip22_timer(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in ip22_state::device_timer");
+ }
+}
+
TIMER_CALLBACK_MEMBER(ip22_state::ip22_dma)
{
- machine().scheduler().timer_set(attotime::never, timer_expired_delegate(FUNC(ip22_state::ip22_dma),this));
+ timer_set(attotime::never, TIMER_IP22_DMA);
#if 0
if( m_PBUS_DMA.nActive )
{
@@ -1079,7 +1103,7 @@ TIMER_CALLBACK_MEMBER(ip22_state::ip22_dma)
return;
}
}
- machine().scheduler().timer_set(attotime::from_hz(44100), timer_expired_delegate(FUNC(ip22_state::ip22_dma),this));
+ timer_set(attotime::from_hz(44100), TIMER_IP22_DMA);
}
#endif
}
@@ -1149,7 +1173,7 @@ WRITE32_MEMBER(ip22_state::hpc3_pbusdma_w)
//verboselog((machine, 0, " FIFO End: Rowe %04x\n", ( data & PBUS_CTRL_FIFO_END ) >> 24 );
if( ( data & PBUS_CTRL_DMASTART ) || ( data & PBUS_CTRL_LOAD_EN ) )
{
- machine().scheduler().timer_set(attotime::from_hz(44100), timer_expired_delegate(FUNC(ip22_state::ip22_dma),this));
+ timer_set(attotime::from_hz(44100), TIMER_IP22_DMA);
m_PBUS_DMA.nActive = 1;
}
return;
@@ -1194,7 +1218,7 @@ ADDRESS_MAP_END
TIMER_CALLBACK_MEMBER(ip22_state::ip22_timer)
{
- machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip22_state::ip22_timer),this));
+ timer_set(attotime::from_msec(1), TIMER_IP22_MSEC);
}
void ip22_state::machine_reset()
@@ -1205,7 +1229,7 @@ void ip22_state::machine_reset()
RTC_REGISTERB = 0x08;
RTC_REGISTERD = 0x80;
- machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip22_state::ip22_timer),this));
+ timer_set(attotime::from_msec(1), TIMER_IP22_MSEC);
// set up low RAM mirror
membank("bank1")->set_base(m_mainram);
diff --git a/src/mess/drivers/mekd2.c b/src/mess/drivers/mekd2.c
index e399f163553..3dee2328692 100644
--- a/src/mess/drivers/mekd2.c
+++ b/src/mess/drivers/mekd2.c
@@ -45,6 +45,11 @@
class mekd2_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_TRACE
+ };
+
mekd2_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -65,8 +70,10 @@ public:
UINT8 m_segment;
UINT8 m_digit;
UINT8 m_keydata;
- TIMER_CALLBACK_MEMBER(mekd2_trace);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(mekd2_cart);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -161,17 +168,25 @@ INPUT_PORTS_END
************************************************************/
-TIMER_CALLBACK_MEMBER(mekd2_state::mekd2_trace)
+void mekd2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+ switch (id)
+ {
+ case TIMER_TRACE:
+ m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in mekd2_state::device_timer");
+ }
}
+
WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w )
{
if (state)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
else
- machine().scheduler().timer_set(attotime::from_usec(18), timer_expired_delegate(FUNC(mekd2_state::mekd2_trace),this));
+ timer_set(attotime::from_usec(18), TIMER_TRACE);
}
diff --git a/src/mess/drivers/okean240.c b/src/mess/drivers/okean240.c
index af65b02a00e..13f6ec77ce4 100644
--- a/src/mess/drivers/okean240.c
+++ b/src/mess/drivers/okean240.c
@@ -56,15 +56,19 @@ Usage of terminal:
class okean240_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_OKEAN_BOOT
+ };
+
okean240_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_term_data(0),
m_j(0),
m_scroll(0),
m_p_videoram(*this, "p_videoram"),
- m_io_modifiers(*this, "MODIFIERS")
- ,
- m_maincpu(*this, "maincpu") { }
+ m_io_modifiers(*this, "MODIFIERS"),
+ m_maincpu(*this, "maincpu") { }
DECLARE_READ8_MEMBER(okean240_kbd_status_r);
DECLARE_READ8_MEMBER(okean240a_kbd_status_r);
@@ -84,12 +88,13 @@ public:
virtual void video_start();
DECLARE_DRIVER_INIT(okean240);
UINT32 screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(okean240_boot);
protected:
optional_ioport m_io_modifiers;
ioport_port *m_io_port[11];
required_device<cpu_device> m_maincpu;
+
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
// okean240 requires bit 4 to change
@@ -360,10 +365,17 @@ static INPUT_PORTS_START( okean240a )
INPUT_PORTS_END
-/* after the first 6 bytes have been read from ROM, switch the ram back in */
-TIMER_CALLBACK_MEMBER(okean240_state::okean240_boot)
+void okean240_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- membank("boot")->set_entry(0);
+ switch (id)
+ {
+ case TIMER_OKEAN_BOOT:
+ /* after the first 6 bytes have been read from ROM, switch the ram back in */
+ membank("boot")->set_entry(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in okean240_state::device_timer");
+ }
}
@@ -381,7 +393,7 @@ void okean240_state::machine_start()
void okean240_state::machine_reset()
{
- machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(okean240_state::okean240_boot),this));
+ timer_set(attotime::from_usec(10), TIMER_OKEAN_BOOT);
membank("boot")->set_entry(1);
m_term_data = 0;
m_j = 0;
diff --git a/src/mess/drivers/osi.c b/src/mess/drivers/osi.c
index c34bd10dfbc..859c5ebc0e5 100644
--- a/src/mess/drivers/osi.c
+++ b/src/mess/drivers/osi.c
@@ -931,15 +931,22 @@ ROM_END
/* Driver Initialization */
-TIMER_CALLBACK_MEMBER(sb2m600_state::setup_beep)
+void sb2m600_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- m_beeper->set_state(0);
- m_beeper->set_frequency(300);
+ switch (id)
+ {
+ case TIMER_SETUP_BEEP:
+ m_beeper->set_state(0);
+ m_beeper->set_frequency(300);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in sb2m600_state::device_timer");
+ }
}
DRIVER_INIT_MEMBER(c1p_state,c1p)
{
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sb2m600_state::setup_beep),this));
+ timer_set(attotime::zero, TIMER_SETUP_BEEP);
}
diff --git a/src/mess/drivers/pc88va.c b/src/mess/drivers/pc88va.c
index 107c224396f..103174ae7dc 100644
--- a/src/mess/drivers/pc88va.c
+++ b/src/mess/drivers/pc88va.c
@@ -57,6 +57,15 @@ struct tsp_t
class pc88va_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_PC8801FD_UPD765_TC_TO_ZERO,
+ TIMER_T3_MOUSE_CALLBACK,
+ TIMER_PC88VA_FDC_TIMER,
+ TIMER_PC88VA_FDC_MOTOR_START_0,
+ TIMER_PC88VA_FDC_MOTOR_START_1
+ };
+
pc88va_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -122,8 +131,6 @@ public:
virtual void video_start();
UINT32 screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(pc88va_vrtc_irq);
- TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero);
- TIMER_CALLBACK_MEMBER(t3_mouse_callback);
DECLARE_READ8_MEMBER(cpu_8255_c_r);
DECLARE_WRITE8_MEMBER(cpu_8255_c_w);
DECLARE_READ8_MEMBER(fdc_8255_c_r);
@@ -139,6 +146,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(pc88va_pit_out0_changed);
// DECLARE_WRITE_LINE_MEMBER(pc88va_upd765_interrupt);
UINT8 m_fdc_ctrl_2;
+ TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero);
+ TIMER_CALLBACK_MEMBER(t3_mouse_callback);
TIMER_CALLBACK_MEMBER(pc88va_fdc_timer);
TIMER_CALLBACK_MEMBER(pc88va_fdc_motor_start_0);
TIMER_CALLBACK_MEMBER(pc88va_fdc_motor_start_1);
@@ -167,6 +176,9 @@ public:
void execute_emul_cmd();
void execute_spron_cmd();
void execute_sprsw_cmd();
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -521,6 +533,30 @@ UINT32 pc88va_state::screen_update_pc88va(screen_device &screen, bitmap_rgb32 &b
return 0;
}
+void pc88va_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_PC8801FD_UPD765_TC_TO_ZERO:
+ pc8801fd_upd765_tc_to_zero(ptr, param);
+ break;
+ case TIMER_T3_MOUSE_CALLBACK:
+ t3_mouse_callback(ptr, param);
+ break;
+ case TIMER_PC88VA_FDC_TIMER:
+ pc88va_fdc_timer(ptr, param);
+ break;
+ case TIMER_PC88VA_FDC_MOTOR_START_0:
+ pc88va_fdc_motor_start_0(ptr, param);
+ break;
+ case TIMER_PC88VA_FDC_MOTOR_START_1:
+ pc88va_fdc_motor_start_1(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in pc88va_state::device_timer");
+ }
+}
+
READ16_MEMBER(pc88va_state::sys_mem_r)
{
switch((m_bank_reg & 0xf00) >> 8)
@@ -1077,7 +1113,7 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
{
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(1);
if(m_fdc_motor_status[0] == 0)
- machine().scheduler().timer_set(attotime::from_msec(505), timer_expired_delegate(FUNC(pc88va_state::pc88va_fdc_motor_start_0),this));
+ timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_0);
else
m_fdc_motor_status[0] = 0;
}
@@ -1086,7 +1122,7 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
{
machine().device<floppy_connector>("upd765:1")->get_device()->mon_w(1);
if(m_fdc_motor_status[1] == 0)
- machine().scheduler().timer_set(attotime::from_msec(505), timer_expired_delegate(FUNC(pc88va_state::pc88va_fdc_motor_start_1),this));
+ timer_set(attotime::from_msec(505), TIMER_PC88VA_FDC_MOTOR_START_1);
else
m_fdc_motor_status[1] = 0;
}
@@ -1102,7 +1138,7 @@ WRITE8_MEMBER(pc88va_state::pc88va_fdc_w)
case 0x06:
//printf("%02x\n",data);
if(data & 1)
- machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(pc88va_state::pc88va_fdc_timer),this));
+ timer_set(attotime::from_msec(100), TIMER_PC88VA_FDC_TIMER);
if((m_fdc_ctrl_2 & 0x10) != (data & 0x10))
upd71071_dmarq(m_dmac,1,2);
@@ -1269,6 +1305,11 @@ static ADDRESS_MAP_START( pc88va_io_map, AS_IO, 16, pc88va_state )
ADDRESS_MAP_END
// (*) are specific N88 V1 / V2 ports
+TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero)
+{
+ machine().device<upd765a_device>("upd765")->tc_w(false);
+}
+
/* FDC subsytem CPU */
#if TEST_SUBFDC
static ADDRESS_MAP_START( pc88va_z80_map, AS_PROGRAM, 8, pc88va_state )
@@ -1276,15 +1317,10 @@ static ADDRESS_MAP_START( pc88va_z80_map, AS_PROGRAM, 8, pc88va_state )
AM_RANGE(0x4000, 0x7fff) AM_RAM
ADDRESS_MAP_END
-TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero)
-{
- machine().device<upd765a_device>("upd765")->tc_w(false);
-}
-
READ8_MEMBER(pc88va_state::upd765_tc_r)
{
machine().device<upd765a_device>("upd765")->tc_w(true);
- machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(pc88va_state::pc8801fd_upd765_tc_to_zero),this));
+ timer_set(attotime::from_usec(50), TIMER_PC8801FD_UPD765_TC_TO_ZERO);
return 0;
}
@@ -1641,7 +1677,7 @@ void pc88va_state::machine_start()
{
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc88va_state::pc88va_irq_callback),this));
- m_t3_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc88va_state::t3_mouse_callback),this));
+ m_t3_mouse_timer = timer_alloc(TIMER_T3_MOUSE_CALLBACK);
m_t3_mouse_timer->adjust(attotime::never);
m_fdc->setup_drq_cb(upd765a_device::line_cb(FUNC(pc88va_state::fdc_drq), this));
m_fdc->setup_intrq_cb(upd765a_device::line_cb(FUNC(pc88va_state::fdc_irq), this));
diff --git a/src/mess/drivers/pcfx.c b/src/mess/drivers/pcfx.c
index ac6ad2caf5a..d206f9f2ce0 100644
--- a/src/mess/drivers/pcfx.c
+++ b/src/mess/drivers/pcfx.c
@@ -23,6 +23,11 @@ struct pcfx_pad_t
class pcfx_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_PAD_FUNC
+ };
+
pcfx_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -60,6 +65,9 @@ public:
DECLARE_WRITE_LINE_MEMBER( irq14_w );
DECLARE_WRITE_LINE_MEMBER( irq15_w );
TIMER_CALLBACK_MEMBER(pad_func);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -117,6 +125,18 @@ READ16_MEMBER( pcfx_state::pad_r )
return res;
}
+void pcfx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_PAD_FUNC:
+ pad_func(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in pcfx_state::device_timer");
+ }
+}
+
TIMER_CALLBACK_MEMBER(pcfx_state::pad_func)
{
const char *const padnames[] = { "P1", "P2" };
@@ -142,7 +162,7 @@ WRITE16_MEMBER( pcfx_state::pad_w )
*/
if(data & 1 && (!(m_pad.ctrl[port_type] & 1)))
{
- machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(pcfx_state::pad_func),this), port_type); // TODO: time
+ timer_set(attotime::from_msec(1), TIMER_PAD_FUNC, port_type); // TODO: time
}
m_pad.ctrl[port_type] = data & 7;
diff --git a/src/mess/drivers/pes.c b/src/mess/drivers/pes.c
index 1eee2419bbb..ef48ff92ef3 100644
--- a/src/mess/drivers/pes.c
+++ b/src/mess/drivers/pes.c
@@ -223,7 +223,7 @@ void pes_state::machine_reset()
******************************************************************************/
/*static TIMER_CALLBACK_MEMBER(pes_state::serial_read_cb )
{
- machine().scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb));
+ timer_set(attotime::from_hz(10000), TIMER_OUTFIFO_READ);
}*/
DRIVER_INIT_MEMBER(pes_state,pes)
diff --git a/src/mess/drivers/plan80.c b/src/mess/drivers/plan80.c
index 2b7e1807423..1800c9caa25 100644
--- a/src/mess/drivers/plan80.c
+++ b/src/mess/drivers/plan80.c
@@ -28,6 +28,11 @@
class plan80_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_BOOT
+ };
+
plan80_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu")
@@ -44,7 +49,9 @@ public:
virtual void video_start();
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_DRIVER_INIT(plan80);
- TIMER_CALLBACK_MEMBER(plan80_boot);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
READ8_MEMBER( plan80_state::plan80_04_r )
@@ -140,16 +147,23 @@ static INPUT_PORTS_START( plan80 ) // Keyboard was worked out by trial & error;'
INPUT_PORTS_END
-/* after the first 4 bytes have been read from ROM, switch the ram back in */
-TIMER_CALLBACK_MEMBER(plan80_state::plan80_boot)
+void plan80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- membank("boot")->set_entry(0);
+ switch (id)
+ {
+ case TIMER_BOOT:
+ /* after the first 4 bytes have been read from ROM, switch the ram back in */
+ membank("boot")->set_entry(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in plan80_state::device_timer");
+ }
}
void plan80_state::machine_reset()
{
membank("boot")->set_entry(1);
- machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(plan80_state::plan80_boot),this));
+ timer_set(attotime::from_usec(10), TIMER_BOOT);
}
DRIVER_INIT_MEMBER(plan80_state,plan80)
diff --git a/src/mess/drivers/ptcsol.c b/src/mess/drivers/ptcsol.c
index 26b082e89f4..e2b69f00d25 100644
--- a/src/mess/drivers/ptcsol.c
+++ b/src/mess/drivers/ptcsol.c
@@ -123,6 +123,12 @@ struct cass_data_t {
class sol20_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_SOL20_CASSETTE_TC,
+ TIMER_SOL20_BOOT
+ };
+
sol20_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -181,11 +187,15 @@ private:
emu_timer *m_cassette_timer;
required_device<cassette_image_device> m_cassette1;
required_device<cassette_image_device> m_cassette2;
+
public:
DECLARE_DRIVER_INIT(sol20);
TIMER_CALLBACK_MEMBER(sol20_cassette_tc);
TIMER_CALLBACK_MEMBER(sol20_boot);
cassette_image_device *cassette_device_image();
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -201,6 +211,22 @@ cassette_image_device *sol20_state::cassette_device_image()
}
+void sol20_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_SOL20_CASSETTE_TC:
+ sol20_cassette_tc(ptr, param);
+ break;
+ case TIMER_SOL20_BOOT:
+ sol20_boot(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in sol20_state::device_timer");
+ }
+}
+
+
// identical to sorcerer
TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc)
{
@@ -549,7 +575,7 @@ TIMER_CALLBACK_MEMBER(sol20_state::sol20_boot)
void sol20_state::machine_start()
{
- m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sol20_state::sol20_cassette_tc),this));
+ m_cassette_timer = timer_alloc(TIMER_SOL20_CASSETTE_TC);
}
void sol20_state::machine_reset()
@@ -601,7 +627,7 @@ void sol20_state::machine_reset()
// boot-bank
membank("boot")->set_entry(1);
- machine().scheduler().timer_set(attotime::from_usec(9), timer_expired_delegate(FUNC(sol20_state::sol20_boot),this));
+ timer_set(attotime::from_usec(9), TIMER_SOL20_BOOT);
}
DRIVER_INIT_MEMBER(sol20_state,sol20)
diff --git a/src/mess/drivers/samcoupe.c b/src/mess/drivers/samcoupe.c
index ef1bb9e9caf..807e5fc89f6 100644
--- a/src/mess/drivers/samcoupe.c
+++ b/src/mess/drivers/samcoupe.c
@@ -55,6 +55,28 @@
/***************************************************************************
+ TIMERS
+***************************************************************************/
+
+void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_IRQ_OFF:
+ irq_off(ptr, param);
+ break;
+ case TIMER_MOUSE_RESET:
+ samcoupe_mouse_reset(ptr, param);
+ break;
+ case TIMER_VIDEO_UPDATE:
+ sam_video_update_callback(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in samcoupe_state::device_timer");
+ }
+}
+
+/***************************************************************************
I/O PORTS
***************************************************************************/
@@ -334,7 +356,7 @@ void samcoupe_state::samcoupe_irq(UINT8 src)
{
/* assert irq and a timer to set it off again */
m_maincpu->set_input_line(0, ASSERT_LINE);
- machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(samcoupe_state::irq_off),this), src);
+ timer_set(attotime::from_usec(20), TIMER_IRQ_OFF, src);
/* adjust STATUS register */
m_status &= ~src;
diff --git a/src/mess/drivers/sg1000.c b/src/mess/drivers/sg1000.c
index 2266d179f30..3bcb1a6c59a 100644
--- a/src/mess/drivers/sg1000.c
+++ b/src/mess/drivers/sg1000.c
@@ -1000,6 +1000,19 @@ static const rs232_port_interface rs232_intf =
MACHINE INITIALIZATION
***************************************************************************/
+void sg1000_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_LIGHTGUN_TICK:
+ lightgun_tick(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in sg1000_state::device_timer");
+ }
+}
+
+
/*-------------------------------------------------
TIMER_CALLBACK_MEMBER( lightgun_tick )
-------------------------------------------------*/
@@ -1027,7 +1040,7 @@ TIMER_CALLBACK_MEMBER(sg1000_state::lightgun_tick)
void sg1000_state::machine_start()
{
/* toggle light gun crosshair */
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sg1000_state::lightgun_tick),this));
+ timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
/* register for state saving */
save_item(NAME(m_tvdraw_data));
@@ -1040,7 +1053,7 @@ void sg1000_state::machine_start()
void sc3000_state::machine_start()
{
/* toggle light gun crosshair */
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sg1000_state::lightgun_tick),this));
+ timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
// find keyboard rows
m_key_row[0] = m_pa0;
diff --git a/src/mess/drivers/snes.c b/src/mess/drivers/snes.c
index 1ece8db436a..8d3780c1459 100644
--- a/src/mess/drivers/snes.c
+++ b/src/mess/drivers/snes.c
@@ -48,6 +48,11 @@
class snes_console_state : public snes_state
{
public:
+ enum
+ {
+ TIMER_LIGHTGUN_TICK
+ };
+
snes_console_state(const machine_config &mconfig, device_type type, const char *tag)
: snes_state(mconfig, type, tag)
, m_cartslot(*this, "snsslot")
@@ -99,6 +104,9 @@ public:
virtual void machine_reset();
int m_type;
optional_device<sns_cart_slot_device> m_cartslot;
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -919,6 +927,18 @@ CUSTOM_INPUT_MEMBER( snes_console_state::snes_superscope_offscreen_input )
return m_scope[port].offscreen;
}
+void snes_console_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_LIGHTGUN_TICK:
+ lightgun_tick(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in snes_console_state::device_timer");
+ }
+}
+
TIMER_CALLBACK_MEMBER( snes_console_state::lightgun_tick )
{
if ((ioport("CTRLSEL")->read() & 0x0f) == 0x03 || (ioport("CTRLSEL")->read() & 0x0f) == 0x04) {
@@ -1313,7 +1333,7 @@ WRITE8_MEMBER(snes_console_state::snes_input_read)
UINT8 ctrl2 = (ioport("CTRLSEL")->read() & 0xf0) >> 4;
/* Check if lightgun has been chosen as input: if so, enable crosshair */
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(snes_console_state::lightgun_tick),this));
+ timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
switch (ctrl1)
{
diff --git a/src/mess/drivers/socrates.c b/src/mess/drivers/socrates.c
index 9f8d45637f8..dbfabbd61dc 100644
--- a/src/mess/drivers/socrates.c
+++ b/src/mess/drivers/socrates.c
@@ -79,6 +79,12 @@ TODO:
class socrates_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_CLEAR_SPEECH,
+ TIMER_CLEAR_IRQ
+ };
+
socrates_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -136,6 +142,9 @@ public:
void socrates_update_kb();
void socrates_check_kb_latch();
rgb_t socrates_create_color(UINT8 color);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -235,6 +244,21 @@ void socrates_state::machine_reset()
m_speech_load_settings_count = 0;
}
+void socrates_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_CLEAR_SPEECH:
+ clear_speech_cb(ptr, param);
+ break;
+ case TIMER_CLEAR_IRQ:
+ clear_irq_cb(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in socrates_state::device_timer");
+ }
+}
+
DRIVER_INIT_MEMBER(socrates_state,socrates)
{
UINT8 *gfx = memregion("vram")->base();
@@ -334,6 +358,7 @@ UINT8 *speechromext = memregion("speechext")->base();
logerror("read from i/o 0x4x of %x\n", temp);
return temp;
}
+
TIMER_CALLBACK_MEMBER(socrates_state::clear_speech_cb)
{
m_speech_running = 0;
@@ -401,7 +426,7 @@ end hd38880 info.*/
{
/* write me: start talking */
m_speech_running = 1;
- machine().scheduler().timer_set(attotime::from_seconds(4), timer_expired_delegate(FUNC(socrates_state::clear_speech_cb),this)); // hack
+ timer_set(attotime::from_seconds(4), TIMER_CLEAR_SPEECH); // hack
}
break;
case 0x90: // unknown, one of these is probably read and branch
@@ -425,7 +450,7 @@ end hd38880 info.*/
if ((data&0xF) == 0) // speak
{
m_speech_running = 1;
- machine().scheduler().timer_set(attotime::from_seconds(4), timer_expired_delegate(FUNC(socrates_state::clear_speech_cb),this)); // hack
+ timer_set(attotime::from_seconds(4), TIMER_CLEAR_SPEECH); // hack
}
else if ((data&0xF) == 8) // reset
{
@@ -913,7 +938,7 @@ TIMER_CALLBACK_MEMBER(socrates_state::clear_irq_cb)
INTERRUPT_GEN_MEMBER(socrates_state::assert_irq)
{
device.execute().set_input_line(0, ASSERT_LINE);
- machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(44), timer_expired_delegate(FUNC(socrates_state::clear_irq_cb),this));
+ timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(44), TIMER_CLEAR_IRQ);
// 44 is a complete and total guess, need to properly measure how many clocks/microseconds the int line is high for.
m_vblankstate = 1;
m_kbmcu_rscount = 0; // clear the mcu poke count
diff --git a/src/mess/drivers/studio2.c b/src/mess/drivers/studio2.c
index ef25aff0b27..456cbce6af0 100644
--- a/src/mess/drivers/studio2.c
+++ b/src/mess/drivers/studio2.c
@@ -627,15 +627,22 @@ ROM_END
/* Driver Initialization */
-TIMER_CALLBACK_MEMBER(studio2_state::setup_beep)
+void studio2_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- m_beeper->set_state(0);
- m_beeper->set_frequency(300);
+ switch (id)
+ {
+ case TIMER_SETUP_BEEP:
+ m_beeper->set_state(0);
+ m_beeper->set_frequency(300);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in studio2_state::device_timer");
+ }
}
DRIVER_INIT_MEMBER(studio2_state,studio2)
{
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(studio2_state::setup_beep),this));
+ timer_set(attotime::zero, TIMER_SETUP_BEEP);
}
/* Game Drivers */
diff --git a/src/mess/drivers/sys2900.c b/src/mess/drivers/sys2900.c
index 8cc448e782b..6005f9391ed 100644
--- a/src/mess/drivers/sys2900.c
+++ b/src/mess/drivers/sys2900.c
@@ -40,6 +40,11 @@
class sys2900_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_BOOT
+ };
+
sys2900_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) ,
m_maincpu(*this, "maincpu") { }
@@ -48,8 +53,10 @@ public:
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_sys2900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(sys2900_boot);
required_device<cpu_device> m_maincpu;
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@@ -71,16 +78,23 @@ static INPUT_PORTS_START( sys2900 )
INPUT_PORTS_END
-/* after the first 4 bytes have been read from ROM, switch the ram back in */
-TIMER_CALLBACK_MEMBER(sys2900_state::sys2900_boot)
+void sys2900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- membank("boot")->set_entry(0);
+ switch (id)
+ {
+ case TIMER_BOOT:
+ /* after the first 4 bytes have been read from ROM, switch the ram back in */
+ membank("boot")->set_entry(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in sys2900_state::device_timer");
+ }
}
void sys2900_state::machine_reset()
{
membank("boot")->set_entry(1);
- machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(sys2900_state::sys2900_boot),this));
+ timer_set(attotime::from_usec(5), TIMER_BOOT);
}
DRIVER_INIT_MEMBER(sys2900_state,sys2900)
diff --git a/src/mess/drivers/tmc1800.c b/src/mess/drivers/tmc1800.c
index 31914bf1f12..43ee6e238eb 100644
--- a/src/mess/drivers/tmc1800.c
+++ b/src/mess/drivers/tmc1800.c
@@ -905,15 +905,22 @@ ROM_END
/* Driver Initialization */
-TIMER_CALLBACK_MEMBER(tmc1800_state::setup_beep)
+void tmc1800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- m_beeper->set_state(0);
- m_beeper->set_frequency(0);
+ switch (id)
+ {
+ case TIMER_SETUP_BEEP:
+ m_beeper->set_state(0);
+ m_beeper->set_frequency(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in tmc1800_state::device_timer");
+ }
}
DRIVER_INIT_MEMBER(tmc1800_state,tmc1800)
{
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(tmc1800_state::setup_beep),this));
+ timer_set(attotime::zero, TIMER_SETUP_BEEP);
}
/* System Drivers */
diff --git a/src/mess/drivers/vk100.c b/src/mess/drivers/vk100.c
index 565c2efe35d..206e47356b7 100644
--- a/src/mess/drivers/vk100.c
+++ b/src/mess/drivers/vk100.c
@@ -159,6 +159,11 @@ state machine and sees if the GO bit ever finishes and goes back to 0
class vk100_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_EXECUTE_VG
+ };
+
vk100_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -241,6 +246,9 @@ public:
void vram_write(UINT8 data);
DECLARE_WRITE_LINE_MEMBER( fr_w );
DECLARE_WRITE_LINE_MEMBER( ft_w );
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
// vram access functions:
@@ -297,30 +305,42 @@ void vk100_state::vram_write(UINT8 data)
m_vram[(EA<<1)] = (block&0xFF00)>>8; // ''
}
- /* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135)
- * see figure 5-24 on page 5-39
- * It tells the direction and enable for counting on the X and Y counters
- * and also handles the non-math related parts of the bresenham line algorithm
- * control bits:
- * /CE1 ----- DCOUNT 0 H [verified via tracing]
- * /CE2 ----- ENA ERROR L [verified via tracing]
- * addr bits: 76543210
- * ||||\\\\-- DIR (vgDIR register low 4 bits)
- * |||\------ C OUT aka ERROR CARRY (strobed in by STROBE L from the error counter's adder) [verified via tracing]
- * ||\------- Y0 (the otherwise unused lsb of the Y register, used for bresenham) [verified via tracing]
- * |\-------- feedback bit from d5 strobed by V CLK [verified via tracing]
- * \--------- GND; the second half of the prom is blank (0x00)
- * data bits: 76543210
- * |||||||\-- ENA Y (enables change on Y counter)
- * ||||||\--- ENA X (enables change on X counter)
- * |||||\---- Y DIRECTION (high is count down, low is count up)
- * ||||\----- X DIRECTION (high is count down, low is count up)
- * |||\------ PIXEL WRT
- * ||\------- feedback bit to a6, this bit is held in PRESET/1 condition by GO being inactive, and if the vector prom is disabled it is pulled to 1 [verified via tracing and schematics]
- * |\-------- UNUSED, always 0
- * \--------- UNUSED, always 0
- * The VT125 prom @ E41 is literally identical to this, the same exact part: 23-059B1
- */
+void vk100_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_EXECUTE_VG:
+ execute_vg(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in vk100_state::device_timer");
+ }
+}
+
+/* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135)
+ * see figure 5-24 on page 5-39
+ * It tells the direction and enable for counting on the X and Y counters
+ * and also handles the non-math related parts of the bresenham line algorithm
+ * control bits:
+ * /CE1 ----- DCOUNT 0 H [verified via tracing]
+ * /CE2 ----- ENA ERROR L [verified via tracing]
+ * addr bits: 76543210
+ * ||||\\\\-- DIR (vgDIR register low 4 bits)
+ * |||\------ C OUT aka ERROR CARRY (strobed in by STROBE L from the error counter's adder) [verified via tracing]
+ * ||\------- Y0 (the otherwise unused lsb of the Y register, used for bresenham) [verified via tracing]
+ * |\-------- feedback bit from d5 strobed by V CLK [verified via tracing]
+ * \--------- GND; the second half of the prom is blank (0x00)
+ * data bits: 76543210
+ * |||||||\-- ENA Y (enables change on Y counter)
+ * ||||||\--- ENA X (enables change on X counter)
+ * |||||\---- Y DIRECTION (high is count down, low is count up)
+ * ||||\----- X DIRECTION (high is count down, low is count up)
+ * |||\------ PIXEL WRT
+ * ||\------- feedback bit to a6, this bit is held in PRESET/1 condition by GO being inactive, and if the vector prom is disabled it is pulled to 1 [verified via tracing and schematics]
+ * |\-------- UNUSED, always 0
+ * \--------- UNUSED, always 0
+ * The VT125 prom @ E41 is literally identical to this, the same exact part: 23-059B1
+ */
TIMER_CALLBACK_MEMBER(vk100_state::execute_vg)
{
m_cout = 1; // hack for now
@@ -377,7 +397,7 @@ TIMER_CALLBACK_MEMBER(vk100_state::execute_vg)
m_vgPAT_Mask >>= 1; // shift the mask
if (m_vgPAT_Mask == 0) m_vgPAT_Mask = 0x80; // reset mask if it hits 0
}
- if (m_vgGO) machine().scheduler().timer_set(attotime::from_hz(XTAL_45_6192Mhz/3/12/2), timer_expired_delegate(FUNC(vk100_state::execute_vg),this)); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21
+ if (m_vgGO) timer_set(attotime::from_hz(XTAL_45_6192Mhz/3/12/2), TIMER_EXECUTE_VG); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21
}
/* ports 0x40 and 0x41: load low and high bytes of vector gen X register */
@@ -490,7 +510,7 @@ WRITE8_MEMBER(vk100_state::vgEX)
m_vgDownCount = VG_DU; // set down counter to length of major vector
m_VG_MODE = offset&3;
m_vgGO = 1;
- machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(vk100_state::execute_vg),this));
+ timer_set(attotime::zero, TIMER_EXECUTE_VG);
}
diff --git a/src/mess/drivers/x68k.c b/src/mess/drivers/x68k.c
index 8080fd1bf9a..8e3a53680c9 100644
--- a/src/mess/drivers/x68k.c
+++ b/src/mess/drivers/x68k.c
@@ -171,15 +171,76 @@ void x68k_state::mfp_init()
m_mfp.current_irq = -1; // No current interrupt
#if 0
- mfp_timer[0] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_a_callback),this));
- mfp_timer[1] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_b_callback),this));
- mfp_timer[2] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_c_callback),this));
- mfp_timer[3] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_d_callback),this));
- mfp_irq = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_update_irq),this));
+ mfp_timer[0] = timer_alloc(TIMER_MFP_TIMER_A);
+ mfp_timer[1] = timer_alloc(TIMER_MFP_TIMER_B);
+ mfp_timer[2] = timer_alloc(TIMER_MFP_TIMER_C);
+ mfp_timer[3] = timer_alloc(TIMER_MFP_TIMER_D);
+ mfp_irq = timer_alloc(TIMER_MFP_UPDATE_IRQ);
mfp_irq->adjust(attotime::zero, 0, attotime::from_usec(32));
#endif
}
+void x68k_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_MFP_UPDATE_IRQ:
+ //mfp_update_irq(ptr, param);
+ break;
+ case TIMER_MFP_TIMER_A:
+ //mfp_timer_a_callback(ptr, param);
+ break;
+ case TIMER_MFP_TIMER_B:
+ //mfp_timer_b_callback(ptr, param);
+ break;
+ case TIMER_MFP_TIMER_C:
+ //mfp_timer_c_callback(ptr, param);
+ break;
+ case TIMER_MFP_TIMER_D:
+ //mfp_timer_d_callback(ptr, param);
+ break;
+ case TIMER_X68K_LED:
+ x68k_led_callback(ptr, param);
+ break;
+ case TIMER_X68K_KEYBOARD_POLL:
+ x68k_keyboard_poll(ptr, param);
+ break;
+ case TIMER_X68K_SCC_ACK:
+ x68k_scc_ack(ptr, param);
+ break;
+ case TIMER_MD_6BUTTON_PORT1_TIMEOUT:
+ md_6button_port1_timeout(ptr, param);
+ break;
+ case TIMER_MD_6BUTTON_PORT2_TIMEOUT:
+ md_6button_port2_timeout(ptr, param);
+ break;
+ case TIMER_X68K_BUS_ERROR:
+ x68k_bus_error(ptr, param);
+ break;
+ case TIMER_X68K_NET_IRQ:
+ x68k_net_irq(ptr, param);
+ break;
+ case TIMER_X68K_CRTC_OPERATION_END:
+ x68k_crtc_operation_end(ptr, param);
+ break;
+ case TIMER_X68K_HSYNC:
+ x68k_hsync(ptr, param);
+ break;
+ case TIMER_X68K_CRTC_RASTER_END:
+ x68k_crtc_raster_end(ptr, param);
+ break;
+ case TIMER_X68K_CRTC_RASTER_IRQ:
+ x68k_crtc_raster_irq(ptr, param);
+ break;
+ case TIMER_X68K_CRTC_VBLANK_IRQ:
+ x68k_crtc_vblank_irq(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in x68k_state::device_timer");
+ }
+}
+
+
#ifdef UNUSED_FUNCTION
TIMER_CALLBACK_MEMBER(x68k_state::mfp_update_irq)
{
@@ -716,8 +777,8 @@ TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port2_timeout)
void x68k_state::md_6button_init()
{
- m_mdctrl.io_timeout1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::md_6button_port1_timeout),this));
- m_mdctrl.io_timeout2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::md_6button_port2_timeout),this));
+ m_mdctrl.io_timeout1 = timer_alloc(TIMER_MD_6BUTTON_PORT1_TIMEOUT);
+ m_mdctrl.io_timeout2 = timer_alloc(TIMER_MD_6BUTTON_PORT2_TIMEOUT);
}
UINT8 x68k_state::md_6button_r(int port)
@@ -1626,7 +1687,7 @@ READ16_MEMBER(x68k_state::x68k_rom0_r)
offset *= 2;
if(ACCESSING_BITS_0_7)
offset++;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),this), 0xbffffc+offset);
+ timer_set(m_maincpu->cycles_to_attotime(4), TIMER_X68K_BUS_ERROR, 0xbffffc+offset);
}
return 0xff;
}
@@ -1643,7 +1704,7 @@ WRITE16_MEMBER(x68k_state::x68k_rom0_w)
offset *= 2;
if(ACCESSING_BITS_0_7)
offset++;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),this), 0xbffffc+offset);
+ timer_set(m_maincpu->cycles_to_attotime(4), TIMER_X68K_BUS_ERROR, 0xbffffc+offset);
}
}
@@ -1659,7 +1720,7 @@ READ16_MEMBER(x68k_state::x68k_emptyram_r)
offset *= 2;
if(ACCESSING_BITS_0_7)
offset++;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),this), offset);
+ timer_set(m_maincpu->cycles_to_attotime(4), TIMER_X68K_BUS_ERROR, offset);
}
return 0xff;
}
@@ -1676,7 +1737,7 @@ WRITE16_MEMBER(x68k_state::x68k_emptyram_w)
offset *= 2;
if(ACCESSING_BITS_0_7)
offset++;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),this), offset);
+ timer_set(m_maincpu->cycles_to_attotime(4), TIMER_X68K_BUS_ERROR, offset);
}
}
@@ -1690,7 +1751,7 @@ READ16_MEMBER(x68k_state::x68k_exp_r)
offset *= 2;
if(ACCESSING_BITS_0_7)
offset++;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(16), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),this), 0xeafa00+offset);
+ timer_set(m_maincpu->cycles_to_attotime(16), TIMER_X68K_BUS_ERROR, 0xeafa00+offset);
// m_maincpu->set_input_line_and_vector(2,ASSERT_LINE,state->m_current_vector[2]);
}
return 0xffff;
@@ -1706,7 +1767,7 @@ WRITE16_MEMBER(x68k_state::x68k_exp_w)
offset *= 2;
if(ACCESSING_BITS_0_7)
offset++;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(16), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),this), 0xeafa00+offset);
+ timer_set(m_maincpu->cycles_to_attotime(16), TIMER_X68K_BUS_ERROR, 0xeafa00+offset);
// m_maincpu->set_input_line_and_vector(2,ASSERT_LINE,state->m_current_vector[2]);
}
}
@@ -2583,13 +2644,13 @@ DRIVER_INIT_MEMBER(x68k_state,x68000)
// init keyboard
m_keyboard.delay = 500; // 3*100+200
m_keyboard.repeat = 110; // 4^2*5+30
- m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_keyboard_poll),this));
- m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_hsync),this));
- m_raster_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_crtc_raster_irq),this));
- m_vblank_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_crtc_vblank_irq),this));
- m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_scc_ack),this));
- m_led_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_led_callback),this));
- m_net_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_net_irq),this));
+ m_kb_timer = timer_alloc(TIMER_X68K_KEYBOARD_POLL);
+ m_scanline_timer = timer_alloc(TIMER_X68K_HSYNC);
+ m_raster_irq = timer_alloc(TIMER_X68K_CRTC_RASTER_IRQ);
+ m_vblank_irq = timer_alloc(TIMER_X68K_CRTC_VBLANK_IRQ);
+ m_mouse_timer = timer_alloc(TIMER_X68K_SCC_ACK);
+ m_led_timer = timer_alloc(TIMER_X68K_LED);
+ m_net_timer = timer_alloc(TIMER_X68K_NET_IRQ);
// Initialise timers for 6-button MD controllers
md_6button_init();
diff --git a/src/mess/drivers/zrt80.c b/src/mess/drivers/zrt80.c
index 6560d43f149..df0b089ef1d 100644
--- a/src/mess/drivers/zrt80.c
+++ b/src/mess/drivers/zrt80.c
@@ -25,6 +25,11 @@
class zrt80_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_BEEP_OFF
+ };
+
zrt80_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -46,9 +51,12 @@ public:
const UINT8 *m_p_chargen;
virtual void machine_reset();
virtual void video_start();
- TIMER_CALLBACK_MEMBER(zrt80_beepoff);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
+
READ8_MEMBER( zrt80_state::zrt80_10_r )
{
UINT8 ret = m_term_data;
@@ -56,20 +64,28 @@ READ8_MEMBER( zrt80_state::zrt80_10_r )
return ret;
}
-TIMER_CALLBACK_MEMBER(zrt80_state::zrt80_beepoff)
+void zrt80_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
- m_beep->set_state(0);
+ switch (id)
+ {
+ case TIMER_BEEP_OFF:
+ m_beep->set_state(0);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in zrt80_state::device_timer");
+ }
}
+
WRITE8_MEMBER(zrt80_state::zrt80_30_w)
{
- machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(zrt80_state::zrt80_beepoff),this));
+ timer_set(attotime::from_msec(100), TIMER_BEEP_OFF);
m_beep->set_state(1);
}
WRITE8_MEMBER(zrt80_state::zrt80_38_w)
{
- machine().scheduler().timer_set(attotime::from_msec(400), timer_expired_delegate(FUNC(zrt80_state::zrt80_beepoff),this));
+ timer_set(attotime::from_msec(400), TIMER_BEEP_OFF);
m_beep->set_state(1);
}
diff --git a/src/mess/includes/atarist.h b/src/mess/includes/atarist.h
index 95f5d52de6b..8181f351863 100644
--- a/src/mess/includes/atarist.h
+++ b/src/mess/includes/atarist.h
@@ -72,6 +72,14 @@ enum
class st_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_MOUSE_TICK,
+ TIMER_SHIFTER_TICK,
+ TIMER_GLUE_TICK,
+ TIMER_BLITTER_TICK
+ };
+
st_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, M68000_TAG),
@@ -325,12 +333,11 @@ public:
floppy_image_device *floppy_devices[2];
- DECLARE_FLOPPY_FORMATS( floppy_formats );
- TIMER_CALLBACK_MEMBER(st_mouse_tick);
- TIMER_CALLBACK_MEMBER(atarist_shifter_tick);
- TIMER_CALLBACK_MEMBER(atarist_glue_tick);
- TIMER_CALLBACK_MEMBER(atarist_blitter_tick);
+ DECLARE_FLOPPY_FORMATS(floppy_formats);
IRQ_CALLBACK_MEMBER(atarist_int_ack);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class megast_state : public st_state
@@ -347,6 +354,12 @@ public:
class ste_state : public st_state
{
public:
+ enum
+ {
+ TIMER_DMASOUND_TICK,
+ TIMER_MICROWIRE_TICK
+ };
+
ste_state(const machine_config &mconfig, device_type type, const char *tag)
: st_state(mconfig, type, tag),
m_lmc1992(*this, LMC1992_TAG)
@@ -384,9 +397,6 @@ public:
DECLARE_READ8_MEMBER( mfp_gpio_r );
- TIMER_CALLBACK_MEMBER(atariste_dmasound_tick);
- TIMER_CALLBACK_MEMBER(atariste_microwire_tick);
-
void dmasound_set_state(int level);
void dmasound_tick();
void microwire_shift();
@@ -417,6 +427,9 @@ public:
// timers
emu_timer *m_microwire_timer;
emu_timer *m_dmasound_timer;
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class megaste_state : public ste_state
diff --git a/src/mess/includes/fm7.h b/src/mess/includes/fm7.h
index dfc34359d6c..74f62376686 100644
--- a/src/mess/includes/fm7.h
+++ b/src/mess/includes/fm7.h
@@ -105,6 +105,17 @@ struct fm7_alu_t
class fm7_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_FM7_BEEPER_OFF,
+ TIMER_FM77AV_ENCODER_ACK,
+ TIMER_FM7_IRQ,
+ TIMER_FM7_SUBTIMER_IRQ,
+ TIMER_FM7_KEYBOARD_POLL,
+ TIMER_FM77AV_ALU_TASK_END,
+ TIMER_FM77AV_VSYNC
+ };
+
fm7_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_shared_ram(*this, "shared_ram"),
@@ -291,6 +302,9 @@ public:
void fm7_mmr_refresh(address_space& space);
void key_press(UINT16 scancode);
void fm7_keyboard_poll_scan();
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /*FM7_H_*/
diff --git a/src/mess/includes/intv.h b/src/mess/includes/intv.h
index 0f424a5324d..e3deb52e29a 100644
--- a/src/mess/includes/intv.h
+++ b/src/mess/includes/intv.h
@@ -33,6 +33,13 @@ struct intv_sprite_type
class intv_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_INTV_INTERRUPT2_COMPLETE,
+ TIMER_INTV_INTERRUPT_COMPLETE,
+ TIMER_INTV_BTB_FILL
+ };
+
intv_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -264,6 +271,7 @@ protected:
void intv_stic_screenrefresh();
void draw_background(bitmap_ind16 &bitmap, int transparency);
void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground);
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /* INTV_H_ */
diff --git a/src/mess/includes/osi.h b/src/mess/includes/osi.h
index 3f4d5de2111..004f85e5458 100644
--- a/src/mess/includes/osi.h
+++ b/src/mess/includes/osi.h
@@ -28,6 +28,11 @@
class sb2m600_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_SETUP_BEEP
+ };
+
sb2m600_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, M6502_TAG),
@@ -68,7 +73,6 @@ public:
/* floppy state */
int m_fdc_index;
- TIMER_CALLBACK_MEMBER(setup_beep);
DECLARE_WRITE_LINE_MEMBER(osi470_index_callback);
required_device<cpu_device> m_maincpu;
@@ -88,6 +92,9 @@ public:
required_ioport m_io_sound;
required_ioport m_io_reset;
optional_device<beep_device> m_beeper;
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class c1p_state : public sb2m600_state
diff --git a/src/mess/includes/samcoupe.h b/src/mess/includes/samcoupe.h
index 114fe90f8f7..c4614a32b71 100644
--- a/src/mess/includes/samcoupe.h
+++ b/src/mess/includes/samcoupe.h
@@ -39,6 +39,13 @@
class samcoupe_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_IRQ_OFF,
+ TIMER_MOUSE_RESET,
+ TIMER_VIDEO_UPDATE
+ };
+
samcoupe_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -137,6 +144,9 @@ public:
void samcoupe_update_memory(address_space &space);
UINT8 samcoupe_mouse_r();
void samcoupe_irq(UINT8 src);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /* SAMCOUPE_H_ */
diff --git a/src/mess/includes/sg1000.h b/src/mess/includes/sg1000.h
index c761170e752..dee4f4e5e18 100644
--- a/src/mess/includes/sg1000.h
+++ b/src/mess/includes/sg1000.h
@@ -49,6 +49,11 @@ extern const cassette_interface sc3000_cassette_interface;
class sg1000_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_LIGHTGUN_TICK
+ };
+
sg1000_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, Z80_TAG),
@@ -79,6 +84,9 @@ public:
UINT8 m_tvdraw_data;
TIMER_CALLBACK_MEMBER(lightgun_tick);
DECLARE_WRITE_LINE_MEMBER(sg1000_vdp_interrupt);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class sc3000_state : public sg1000_state
diff --git a/src/mess/includes/studio2.h b/src/mess/includes/studio2.h
index ea5d77584b7..7efedfab25e 100644
--- a/src/mess/includes/studio2.h
+++ b/src/mess/includes/studio2.h
@@ -20,6 +20,11 @@
class studio2_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_SETUP_BEEP
+ };
+
studio2_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, CDP1802_TAG),
@@ -56,7 +61,9 @@ public:
/* keyboard state */
UINT8 m_keylatch;
DECLARE_DRIVER_INIT(studio2);
- TIMER_CALLBACK_MEMBER(setup_beep);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class visicom_state : public studio2_state
diff --git a/src/mess/includes/tmc1800.h b/src/mess/includes/tmc1800.h
index cf7550e7066..5a7cf5829a5 100644
--- a/src/mess/includes/tmc1800.h
+++ b/src/mess/includes/tmc1800.h
@@ -48,6 +48,11 @@ public:
class tmc1800_state : public tmc1800_base_state
{
public:
+ enum
+ {
+ TIMER_SETUP_BEEP
+ };
+
tmc1800_state(const machine_config &mconfig, device_type type, const char *tag)
: tmc1800_base_state(mconfig, type, tag),
m_vdc(*this, CDP1861_TAG)
@@ -69,7 +74,9 @@ public:
/* keyboard state */
int m_keylatch; /* key latch */
DECLARE_DRIVER_INIT(tmc1800);
- TIMER_CALLBACK_MEMBER(setup_beep);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class osc1000b_state : public tmc1800_base_state
diff --git a/src/mess/includes/x68k.h b/src/mess/includes/x68k.h
index eca1787935a..62c318d3479 100644
--- a/src/mess/includes/x68k.h
+++ b/src/mess/includes/x68k.h
@@ -44,6 +44,27 @@ enum
class x68k_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_MFP_UPDATE_IRQ,
+ TIMER_MFP_TIMER_A,
+ TIMER_MFP_TIMER_B,
+ TIMER_MFP_TIMER_C,
+ TIMER_MFP_TIMER_D,
+ TIMER_X68K_LED,
+ TIMER_X68K_KEYBOARD_POLL,
+ TIMER_X68K_SCC_ACK,
+ TIMER_MD_6BUTTON_PORT1_TIMEOUT,
+ TIMER_MD_6BUTTON_PORT2_TIMEOUT,
+ TIMER_X68K_BUS_ERROR,
+ TIMER_X68K_NET_IRQ,
+ TIMER_X68K_CRTC_OPERATION_END,
+ TIMER_X68K_HSYNC,
+ TIMER_X68K_CRTC_RASTER_END,
+ TIMER_X68K_CRTC_RASTER_IRQ,
+ TIMER_X68K_CRTC_VBLANK_IRQ,
+ };
+
x68k_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_mfpdev(*this, MC68901_TAG),
@@ -374,6 +395,7 @@ public:
DECLARE_WRITE32_MEMBER(x68k_tvram32_w);
DECLARE_READ32_MEMBER(x68k_tvram32_r);
IRQ_CALLBACK_MEMBER(x68k_int_ack);
+
private:
inline void x68k_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
void x68k_crtc_text_copy(int src, int dest);
@@ -382,6 +404,7 @@ private:
void x68k_draw_gfx_scanline(bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority);
void x68k_draw_gfx(bitmap_ind16 &bitmap,rectangle cliprect);
void x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect);
+
public:
required_device<cpu_device> m_maincpu;
required_device<okim6258_device> m_okim6258;
@@ -391,6 +414,9 @@ public:
void mfp_trigger_irq(int irq);
void mfp_set_timer(int timer, unsigned char data);
void mfp_recv_data(int data);
+
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
diff --git a/src/mess/includes/zx.h b/src/mess/includes/zx.h
index d833b840a5c..61a7aa806be 100644
--- a/src/mess/includes/zx.h
+++ b/src/mess/includes/zx.h
@@ -19,6 +19,13 @@
class zx_state : public driver_device
{
public:
+ enum
+ {
+ TIMER_TAPE_PULSE,
+ TIMER_ULA_NMI,
+ TIMER_ULA_IRQ
+ };
+
zx_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@@ -97,6 +104,7 @@ protected:
optional_ioport m_io_config;
void zx_ula_r(int offs, memory_region *region, const UINT8 param);
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /* ZX_H_ */
diff --git a/src/mess/machine/intv.c b/src/mess/machine/intv.c
index d399c2583ac..cabe91c2c55 100644
--- a/src/mess/machine/intv.c
+++ b/src/mess/machine/intv.c
@@ -675,11 +675,10 @@ INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt)
m_backtab_row = 0;
UINT8 row;
m_maincpu->adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(STIC_VBLANK_END), timer_expired_delegate(FUNC(intv_state::intv_interrupt_complete),this));
+ timer_set(m_maincpu->cycles_to_attotime(STIC_VBLANK_END), TIMER_INTV_INTERRUPT_COMPLETE);
for (row=0; row < STIC_BACKTAB_HEIGHT; row++)
{
- machine().scheduler().timer_set(m_maincpu
- ->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*m_row_delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), timer_expired_delegate(FUNC(intv_state::intv_btb_fill),this));
+ timer_set(m_maincpu->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*m_row_delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), TIMER_INTV_BTB_FILL);
}
if (m_row_delay == 0)
diff --git a/src/mess/machine/samcoupe.c b/src/mess/machine/samcoupe.c
index 3237696e5c4..347eac5c81f 100644
--- a/src/mess/machine/samcoupe.c
+++ b/src/mess/machine/samcoupe.c
@@ -294,10 +294,10 @@ UINT8 samcoupe_state::samcoupe_mouse_r()
void samcoupe_state::machine_start()
{
- m_mouse_reset = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(samcoupe_state::samcoupe_mouse_reset),this));
+ m_mouse_reset = timer_alloc(TIMER_MOUSE_RESET);
/* schedule our video updates */
- m_video_update_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(samcoupe_state::sam_video_update_callback),this));
+ m_video_update_timer = timer_alloc(TIMER_VIDEO_UPDATE);
m_video_update_timer->adjust(machine().primary_screen->time_until_pos(0, 0));
}
diff --git a/src/mess/machine/zx.c b/src/mess/machine/zx.c
index de9e2c19762..ec605df9cab 100644
--- a/src/mess/machine/zx.c
+++ b/src/mess/machine/zx.c
@@ -137,7 +137,7 @@ READ8_MEMBER( zx_state::zx80_io_r )
if ((m_cassette->input() < -0.75) && m_tape_bit)
{
m_tape_bit = 0x00;
- machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this));
+ timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE);
}
data &= ~m_tape_bit;
@@ -194,7 +194,7 @@ READ8_MEMBER( zx_state::zx81_io_r )
if ((m_cassette->input() < -0.75) && m_tape_bit)
{
m_tape_bit = 0x00;
- machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this));
+ timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE);
}
data &= ~m_tape_bit;
@@ -257,7 +257,7 @@ READ8_MEMBER( zx_state::pc8300_io_r )
if ((m_cassette->input() < -0.75) && m_tape_bit)
{
m_tape_bit = 0x00;
- machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this));
+ timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE);
}
data &= ~m_tape_bit;
@@ -325,7 +325,7 @@ READ8_MEMBER( zx_state::pow3000_io_r )
if ((m_cassette->input() < -0.75) && m_tape_bit)
{
m_tape_bit = 0x00;
- machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this));
+ timer_set(attotime::from_usec(362), TIMER_TAPE_PULSE);
}
data &= ~m_tape_bit;
diff --git a/src/mess/video/atarist.c b/src/mess/video/atarist.c
index 1331e59f818..9ab85ba6ab5 100644
--- a/src/mess/video/atarist.c
+++ b/src/mess/video/atarist.c
@@ -45,7 +45,6 @@ static const int BLITTER_NOPS[16][4] =
};
-
//**************************************************************************
// SHIFTER
//**************************************************************************
@@ -163,16 +162,6 @@ void st_state::shifter_tick()
//-------------------------------------------------
-// TIMER_CALLBACK( atarist_shifter_tick )
-//-------------------------------------------------
-
-TIMER_CALLBACK_MEMBER(st_state::atarist_shifter_tick)
-{
- shifter_tick();
-}
-
-
-//-------------------------------------------------
// shifter_load -
//-------------------------------------------------
@@ -293,16 +282,6 @@ void st_state::glue_tick()
//-------------------------------------------------
-// TIMER_CALLBACK( atarist_glue_tick )
-//-------------------------------------------------
-
-TIMER_CALLBACK_MEMBER(st_state::atarist_glue_tick)
-{
- glue_tick();
-}
-
-
-//-------------------------------------------------
// set_screen_parameters -
//-------------------------------------------------
@@ -745,16 +724,6 @@ void st_state::blitter_tick()
//-------------------------------------------------
-// TIMER_CALLBACK( atarist_blitter_tick )
-//-------------------------------------------------
-
-TIMER_CALLBACK_MEMBER(st_state::atarist_blitter_tick)
-{
- blitter_tick();
-}
-
-
-//-------------------------------------------------
// blitter_halftone_r -
//-------------------------------------------------
@@ -1080,7 +1049,7 @@ WRITE16_MEMBER( st_state::blitter_ctrl_w )
m_mfp->i3_w(m_blitter_done);
int nops = BLITTER_NOPS[m_blitter_op][m_blitter_hop]; // each NOP takes 4 cycles
- machine().scheduler().timer_set(attotime::from_hz((Y2/4)/(4*nops)), timer_expired_delegate(FUNC(st_state::atarist_blitter_tick),this));
+ timer_set(attotime::from_hz((Y2/4)/(4*nops)), TIMER_BLITTER_TICK);
}
}
}
@@ -1102,8 +1071,8 @@ WRITE16_MEMBER( st_state::blitter_ctrl_w )
void st_state::video_start()
{
- m_shifter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_state::atarist_shifter_tick),this));
- m_glue_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_state::atarist_glue_tick),this));
+ m_shifter_timer = timer_alloc(TIMER_SHIFTER_TICK);
+ m_glue_timer = timer_alloc(TIMER_GLUE_TICK);
// m_shifter_timer->adjust(machine().primary_screen->time_until_pos(0), 0, attotime::from_hz(Y2/4)); // 125 ns
m_glue_timer->adjust(machine().primary_screen->time_until_pos(0), 0, attotime::from_hz(Y2/16)); // 500 ns
diff --git a/src/mess/video/fm7.c b/src/mess/video/fm7.c
index a4d0a3817b9..a120e94f01a 100644
--- a/src/mess/video/fm7.c
+++ b/src/mess/video/fm7.c
@@ -626,7 +626,7 @@ void fm7_state::fm77av_line_draw()
// set timer to disable busy flag
// 1/16 us for each byte changed
- machine().scheduler().timer_set(attotime::from_usec(byte_count/16), timer_expired_delegate(FUNC(fm7_state::fm77av_alu_task_end),this));
+ timer_set(attotime::from_usec(byte_count/16), TIMER_FM77AV_ALU_TASK_END);
}
READ8_MEMBER(fm7_state::fm7_vram_r)
diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c
index 0537237d26d..93886d8bc69 100644
--- a/src/mess/video/x68k.c
+++ b/src/mess/video/x68k.c
@@ -281,7 +281,7 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_irq)
// end of HBlank period clears GPIP6 also?
end_time = machine().primary_screen->time_until_pos(scan,m_crtc.hend);
m_raster_irq->adjust(irq_time, scan);
- machine().scheduler().timer_set(end_time, timer_expired_delegate(FUNC(x68k_state::x68k_crtc_raster_end),this));
+ timer_set(end_time, TIMER_X68K_CRTC_RASTER_END);
logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,machine().primary_screen->vpos());
}
}
@@ -440,7 +440,7 @@ WRITE16_MEMBER(x68k_state::x68k_crtc_w )
if(data & 0x08) // text screen raster copy
{
x68k_crtc_text_copy((m_crtc.reg[22] & 0xff00) >> 8,(m_crtc.reg[22] & 0x00ff));
- machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(x68k_state::x68k_crtc_operation_end),this), 0x02); // time taken to do operation is a complete guess.
+ timer_set(attotime::from_msec(1), TIMER_X68K_CRTC_OPERATION_END, 0x02); // time taken to do operation is a complete guess.
}
if(data & 0x02) // high-speed graphic screen clear
{
@@ -448,7 +448,7 @@ WRITE16_MEMBER(x68k_state::x68k_crtc_w )
memset(m_gvram32,0,0x40000);
else
memset(m_gvram16,0,0x40000);
- machine().scheduler().timer_set(attotime::from_msec(10), timer_expired_delegate(FUNC(x68k_state::x68k_crtc_operation_end),this), 0x02); // time taken to do operation is a complete guess.
+ timer_set(attotime::from_msec(10), TIMER_X68K_CRTC_OPERATION_END, 0x02); // time taken to do operation is a complete guess.
}
break;
}
diff --git a/src/mess/video/zx.c b/src/mess/video/zx.c
index b5e38fa6c3c..a40b87cc847 100644
--- a/src/mess/video/zx.c
+++ b/src/mess/video/zx.c
@@ -25,6 +25,25 @@ int ula_frame_vsync = 0;
//int ula_scancode_count = 0;
int ula_scanline_count = 0;
+void zx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_TAPE_PULSE:
+ zx_tape_pulse(ptr, param);
+ break;
+ case TIMER_ULA_NMI:
+ zx_ula_nmi(ptr, param);
+ break;
+ case TIMER_ULA_IRQ:
+ zx_ula_irq(ptr, param);
+ break;
+ default:
+ assert_always(FALSE, "Unknown id in zx_state::device_timer");
+ }
+}
+
+
/*
* Toggle the video output between black and white.
* This happens whenever the ULA scanline IRQs are enabled/disabled.
@@ -158,7 +177,7 @@ void zx_state::zx_ula_r(int offs, memory_region *region, const UINT8 param)
for (y = m_charline_ptr; y < ARRAY_LENGTH(m_charline); y++)
m_charline[y] = 0;
- machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(((32 - m_charline_ptr) << 2)), timer_expired_delegate(FUNC(zx_state::zx_ula_irq),this));
+ timer_set(m_maincpu->cycles_to_attotime(((32 - m_charline_ptr) << 2)), TIMER_ULA_IRQ);
m_ula_irq_active++;
scanline = &bitmap.pix16(m_ula_scanline_count);
@@ -187,7 +206,7 @@ void zx_state::zx_ula_r(int offs, memory_region *region, const UINT8 param)
void zx_state::video_start()
{
- m_ula_nmi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zx_state::zx_ula_nmi),this));
+ m_ula_nmi = timer_alloc(TIMER_ULA_NMI);
m_ula_irq_active = 0;
m_screen->register_screen_bitmap(m_bitmap);
}