Removed anonymous timers from some drivers. (nw)

This commit is contained in:
Ivan Vangelista 2013-11-09 16:36:27 +00:00
parent 74e89a7814
commit 48b8a7526b
4 changed files with 74 additions and 32 deletions

View File

@ -50,7 +50,7 @@ public:
/* memory pointers */ /* memory pointers */
required_shared_ptr<UINT16> m_iodata; required_shared_ptr<UINT16> m_iodata;
/* input-related */ /* input-related */
UINT16 m_defender_sensor; UINT16 m_defender_sensor;
UINT16 m_shutter_sensor; UINT16 m_shutter_sensor;
@ -68,10 +68,18 @@ public:
DECLARE_MACHINE_RESET(drill); DECLARE_MACHINE_RESET(drill);
INTERRUPT_GEN_MEMBER(drill_vblank_irq); INTERRUPT_GEN_MEMBER(drill_vblank_irq);
//INTERRUPT_GEN_MEMBER(drill_device_irq); //INTERRUPT_GEN_MEMBER(drill_device_irq);
TIMER_CALLBACK_MEMBER(shutter_req);
TIMER_CALLBACK_MEMBER(defender_req);
void tile_decode(); void tile_decode();
DECLARE_WRITE_LINE_MEMBER(irqhandler); DECLARE_WRITE_LINE_MEMBER(irqhandler);
#ifdef UNUSED_FUNCTION
enum
{
TIMER_SHUTTER_REQ,
TIMER_DEFENDER_REQ
};
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
#endif
}; };
@ -136,14 +144,19 @@ WRITE16_MEMBER(_2mindril_state::drill_io_w)
PORT_DIPSETTING( 0x0800, DEF_STR( On ) ) PORT_DIPSETTING( 0x0800, DEF_STR( On ) )
*/ */
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
TIMER_CALLBACK_MEMBER(_2mindril_state::shutter_req) void _2mindril_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{ {
m_shutter_sensor = param; switch (id)
} {
case TIMER_SHUTTER_REQ:
TIMER_CALLBACK_MEMBER(_2mindril_state::defender_req) m_shutter_sensor = param;
{ break;
m_defender_sensor = param; case TIMER_DEFENDER_REQ:
m_defender_sensor = param;
break;
default:
assert_always(FALSE, "Unknown id in _2mindril_state::device_timer");
}
} }
#endif #endif
@ -153,23 +166,23 @@ WRITE16_MEMBER(_2mindril_state::sensors_w)
/*---- ---- ---- -x-- lamp*/ /*---- ---- ---- -x-- lamp*/
if (data & 1) if (data & 1)
{ {
//machine().scheduler().timer_set(attotime::from_seconds(2), FUNC(shutter_req ), 0x100); //timer_set( attotime::from_seconds(2), TIMER_SHUTTER_REQ, 0x100);
m_shutter_sensor = 0x100; m_shutter_sensor = 0x100;
} }
else if (data & 2) else if (data & 2)
{ {
//machine().scheduler().timer_set( attotime::from_seconds(2), FUNC(shutter_req ), 0x200); //timer_set( attotime::from_seconds(2), TIMER_SHUTTER_REQ, 0x200);
m_shutter_sensor = 0x200; m_shutter_sensor = 0x200;
} }
if (data & 0x1000 || data & 0x4000) if (data & 0x1000 || data & 0x4000)
{ {
//machine().scheduler().timer_set( attotime::from_seconds(2), FUNC(defender_req ), 0x800); //timer_set( attotime::from_seconds(2), TIMER_DEFENDER_REQ, 0x800);
m_defender_sensor = 0x800; m_defender_sensor = 0x800;
} }
else if (data & 0x2000 || data & 0x8000) else if (data & 0x2000 || data & 0x8000)
{ {
//machine().scheduler().timer_set( attotime::from_seconds(2), FUNC(defender_req ), 0x400); //timer_set( attotime::from_seconds(2), TIMER_DEFENDER_REQ, 0x400);
m_defender_sensor = 0x400; m_defender_sensor = 0x400;
} }
} }

View File

@ -229,18 +229,25 @@ Notes - Has jumper setting for 122HZ or 61HZ)
#include "sound/dac.h" #include "sound/dac.h"
#include "includes/40love.h" #include "includes/40love.h"
TIMER_CALLBACK_MEMBER(fortyl_state::nmi_callback) void fortyl_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{ {
if (m_sound_nmi_enable) switch(id)
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); {
else case TIMER_NMI_CALLBACK:
m_pending_nmi = 1; if (m_sound_nmi_enable)
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
else
m_pending_nmi = 1;
break;
default:
assert_always(FALSE, "Unknown id in fortyl_state::device_timer");
}
} }
WRITE8_MEMBER(fortyl_state::sound_command_w) WRITE8_MEMBER(fortyl_state::sound_command_w)
{ {
soundlatch_byte_w(space, 0, data); soundlatch_byte_w(space, 0, data);
machine().scheduler().synchronize(timer_expired_delegate(FUNC(fortyl_state::nmi_callback),this), data); synchronize(TIMER_NMI_CALLBACK, data);
} }
WRITE8_MEMBER(fortyl_state::nmi_disable_w) WRITE8_MEMBER(fortyl_state::nmi_disable_w)

View File

@ -20,11 +20,12 @@ class acefruit_state : public driver_device
public: public:
acefruit_state(const machine_config &mconfig, device_type type, const char *tag) acefruit_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"), m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram") { }
m_maincpu(*this, "maincpu") { }
required_device<cpu_device> m_maincpu;
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram; required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_spriteram;
@ -42,9 +43,15 @@ public:
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(acefruit_vblank); INTERRUPT_GEN_MEMBER(acefruit_vblank);
TIMER_CALLBACK_MEMBER(acefruit_refresh);
void acefruit_update_irq(int vpos); void acefruit_update_irq(int vpos);
required_device<cpu_device> m_maincpu;
enum
{
TIMER_ACEFRUIT_REFRESH
};
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
}; };
@ -69,21 +76,29 @@ void acefruit_state::acefruit_update_irq(int vpos)
} }
TIMER_CALLBACK_MEMBER(acefruit_state::acefruit_refresh) void acefruit_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{ {
int vpos = m_screen->vpos(); int vpos = m_screen->vpos();
m_screen->update_partial(vpos ); switch(id)
acefruit_update_irq(vpos); {
case TIMER_ACEFRUIT_REFRESH:
m_screen->update_partial(vpos );
acefruit_update_irq(vpos);
vpos = ( ( vpos / 8 ) + 1 ) * 8; vpos = ( ( vpos / 8 ) + 1 ) * 8;
m_refresh_timer->adjust( m_screen->time_until_pos(vpos) ); m_refresh_timer->adjust( m_screen->time_until_pos(vpos) );
break;
default:
assert_always(FALSE, "Unknown id in acefruit_state::device_timer");
}
} }
void acefruit_state::video_start() void acefruit_state::video_start()
{ {
m_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(acefruit_state::acefruit_refresh),this)); m_refresh_timer = timer_alloc(TIMER_ACEFRUIT_REFRESH);
} }
INTERRUPT_GEN_MEMBER(acefruit_state::acefruit_vblank) INTERRUPT_GEN_MEMBER(acefruit_state::acefruit_vblank)

View File

@ -25,7 +25,7 @@ public:
required_shared_ptr<UINT8> m_colorram; required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_spriteram2; required_shared_ptr<UINT8> m_spriteram2;
optional_shared_ptr<UINT8> m_mcu_ram; optional_shared_ptr<UINT8> m_mcu_ram;
/* video-related */ /* video-related */
bitmap_ind16 *m_tmp_bitmap1; bitmap_ind16 *m_tmp_bitmap1;
bitmap_ind16 *m_tmp_bitmap2; bitmap_ind16 *m_tmp_bitmap2;
@ -109,10 +109,17 @@ public:
DECLARE_MACHINE_RESET(common); DECLARE_MACHINE_RESET(common);
DECLARE_MACHINE_RESET(ta7630); DECLARE_MACHINE_RESET(ta7630);
UINT32 screen_update_fortyl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_fortyl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(nmi_callback);
void redraw_pixels(); void redraw_pixels();
void fortyl_set_scroll_x( int offset ); void fortyl_set_scroll_x( int offset );
void fortyl_plot_pix( int offset ); void fortyl_plot_pix( int offset );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_pixram( bitmap_ind16 &bitmap, const rectangle &cliprect ); void draw_pixram( bitmap_ind16 &bitmap, const rectangle &cliprect );
enum
{
TIMER_NMI_CALLBACK
};
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
}; };