Had time for a few more. (nw)

This commit is contained in:
Andrew Gardner 2013-05-15 18:45:55 +00:00
parent e7368bcefc
commit bb17e74fdc
14 changed files with 195 additions and 47 deletions

View File

@ -406,25 +406,26 @@ WRITE_LINE_MEMBER(fuuki16_state::soundirq)
also used for water effects and titlescreen linescroll on gogomile
*/
TIMER_CALLBACK_MEMBER(fuuki16_state::level_1_interrupt_callback)
void fuuki16_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_maincpu->set_input_line(1, HOLD_LINE);
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(248), timer_expired_delegate(FUNC(fuuki16_state::level_1_interrupt_callback),this));
}
TIMER_CALLBACK_MEMBER(fuuki16_state::vblank_interrupt_callback)
{
m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ
machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_start(), timer_expired_delegate(FUNC(fuuki16_state::vblank_interrupt_callback),this));
}
TIMER_CALLBACK_MEMBER(fuuki16_state::raster_interrupt_callback)
{
m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ
machine().primary_screen->update_partial(machine().primary_screen->vpos());
m_raster_interrupt_timer->adjust(machine().primary_screen->frame_period());
switch (id)
{
case TIMER_LEVEL_1_INTERRUPT:
m_maincpu->set_input_line(1, HOLD_LINE);
timer_set(machine().primary_screen->time_until_pos(248), TIMER_LEVEL_1_INTERRUPT);
break;
case TIMER_VBLANK_INTERRUPT:
m_maincpu->set_input_line(3, HOLD_LINE); // VBlank IRQ
timer_set(machine().primary_screen->time_until_vblank_start(), TIMER_VBLANK_INTERRUPT);
break;
case TIMER_RASTER_INTERRUPT:
m_maincpu->set_input_line(5, HOLD_LINE); // Raster Line IRQ
machine().primary_screen->update_partial(machine().primary_screen->vpos());
m_raster_interrupt_timer->adjust(machine().primary_screen->frame_period());
break;
default:
assert_always(FALSE, "Unknown id in fuuki16_state::device_timer");
}
}
@ -434,8 +435,7 @@ void fuuki16_state::machine_start()
membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x8000);
m_raster_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fuuki16_state::raster_interrupt_callback),this));
m_raster_interrupt_timer = timer_alloc(TIMER_RASTER_INTERRUPT);
}
@ -443,8 +443,8 @@ void fuuki16_state::machine_reset()
{
const rectangle &visarea = machine().primary_screen->visible_area();
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(248), timer_expired_delegate(FUNC(fuuki16_state::level_1_interrupt_callback),this));
machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_start(), timer_expired_delegate(FUNC(fuuki16_state::vblank_interrupt_callback),this));
timer_set(machine().primary_screen->time_until_pos(248), TIMER_LEVEL_1_INTERRUPT);
timer_set(machine().primary_screen->time_until_vblank_start(), TIMER_LEVEL_1_INTERRUPT);
m_raster_interrupt_timer->adjust(machine().primary_screen->time_until_pos(0, visarea.max_x + 1));
}

View File

@ -234,6 +234,18 @@ void gaplus_state::machine_reset()
m_subcpu->set_input_line(0, CLEAR_LINE);
}
void gaplus_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_NAMCOIO_RUN:
namcoio_run(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in gaplus_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(gaplus_state::namcoio_run)
{
device_t *io58xx = machine().device("58xx");
@ -259,10 +271,10 @@ INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_main_irq)
m_maincpu->set_input_line(0, ASSERT_LINE);
if (!namcoio_read_reset_line(io58xx)) /* give the cpu a tiny bit of time to write the command before processing it */
machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(gaplus_state::namcoio_run),this));
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN);
if (!namcoio_read_reset_line(io56xx)) /* give the cpu a tiny bit of time to write the command before processing it */
machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(gaplus_state::namcoio_run),this), 1);
timer_set(attotime::from_usec(50), TIMER_NAMCOIO_RUN, 1);
}
INTERRUPT_GEN_MEMBER(gaplus_state::gaplus_vblank_sub_irq)

View File

@ -113,15 +113,22 @@ void parodius_state::sound_nmi_callback( int param )
}
#endif
TIMER_CALLBACK_MEMBER(parodius_state::nmi_callback)
void parodius_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
switch (id)
{
case TIMER_NMI:
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
break;
default:
assert_always(FALSE, "Unknown id in parodius_state::device_timer");
}
}
WRITE8_MEMBER(parodius_state::sound_arm_nmi_w)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(parodius_state::nmi_callback),this)); /* kludge until the K053260 is emulated correctly */
timer_set(attotime::from_usec(50), TIMER_NMI); /* kludge until the K053260 is emulated correctly */
}
/********************************************/

View File

@ -31,6 +31,13 @@
class tickee_state : public driver_device
{
public:
enum
{
TIMER_TRIGGER_GUN_INTERRUPT,
TIMER_CLEAR_GUN_INTERRUPT,
TIMER_SETUP_GUN_INTERRUPTS
};
tickee_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_tlc34076(*this, "tlc34076"),
@ -65,6 +72,9 @@ public:
TIMER_CALLBACK_MEMBER(setup_gun_interrupts);
required_device<cpu_device> m_maincpu;
optional_device<okim6295_device> m_oki;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@ -95,6 +105,25 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *
*
*************************************/
void tickee_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_TRIGGER_GUN_INTERRUPT:
trigger_gun_interrupt(ptr, param);
break;
case TIMER_CLEAR_GUN_INTERRUPT:
clear_gun_interrupt(ptr, param);
break;
case TIMER_SETUP_GUN_INTERRUPTS:
setup_gun_interrupts(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in tickee_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(tickee_state::trigger_gun_interrupt)
{
int which = param & 1;
@ -129,13 +158,13 @@ TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts)
/* generate interrupts for player 1's gun */
get_crosshair_xy(machine(), 0, &beamx, &beamy);
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::trigger_gun_interrupt),this), 0);
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::clear_gun_interrupt),this), 0);
timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), TIMER_TRIGGER_GUN_INTERRUPT, 0);
timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), TIMER_CLEAR_GUN_INTERRUPT, 0);
/* generate interrupts for player 2's gun */
get_crosshair_xy(machine(), 1, &beamx, &beamy);
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::trigger_gun_interrupt),this), 1);
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::clear_gun_interrupt),this), 1);
timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), TIMER_TRIGGER_GUN_INTERRUPT, 1);
timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), TIMER_CLEAR_GUN_INTERRUPT, 1);
}
@ -149,7 +178,7 @@ TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts)
VIDEO_START_MEMBER(tickee_state,tickee)
{
/* start a timer going on the first scanline of every frame */
m_setup_gun_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tickee_state::setup_gun_interrupts),this));
m_setup_gun_timer = timer_alloc(TIMER_SETUP_GUN_INTERRUPTS);
m_setup_gun_timer->adjust(machine().primary_screen->time_until_pos(0));
}

View File

@ -41,6 +41,19 @@ CUSTOM_INPUT_MEMBER(ultratnk_state::get_joystick)
}
void ultratnk_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_NMI:
nmi_callback(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in ultratnk_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(ultratnk_state::nmi_callback)
{
int scanline = param + 64;
@ -55,13 +68,13 @@ TIMER_CALLBACK_MEMBER(ultratnk_state::nmi_callback)
if (ioport("IN0")->read() & 0x40)
m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(ultratnk_state::nmi_callback),this), scanline);
timer_set(machine().primary_screen->time_until_pos(scanline), TIMER_NMI, scanline);
}
void ultratnk_state::machine_reset()
{
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(32), timer_expired_delegate(FUNC(ultratnk_state::nmi_callback),this), 32);
timer_set(machine().primary_screen->time_until_pos(32), TIMER_NMI, 32);
}

View File

@ -43,6 +43,19 @@ void videopin_state::update_plunger()
}
void videopin_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_INTERRUPT:
interrupt_callback(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in videopin_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback)
{
int scanline = param;
@ -56,13 +69,13 @@ TIMER_CALLBACK_MEMBER(videopin_state::interrupt_callback)
if (scanline >= 263)
scanline = 32;
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(videopin_state::interrupt_callback),this), scanline);
timer_set(machine().primary_screen->time_until_pos(scanline), TIMER_INTERRUPT, scanline);
}
void videopin_state::machine_reset()
{
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(32), timer_expired_delegate(FUNC(videopin_state::interrupt_callback),this), 32);
timer_set(machine().primary_screen->time_until_pos(32), TIMER_INTERRUPT, 32);
/* both output latches are cleared on reset */

View File

@ -9,6 +9,20 @@ Atari Wolf Pack (prototype) driver
#include "sound/s14001a.h"
#include "includes/wolfpack.h"
void wolfpack_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_PERIODIC:
periodic_callback(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in wolfpack_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(wolfpack_state::periodic_callback)
{
int scanline = param;
@ -20,13 +34,13 @@ TIMER_CALLBACK_MEMBER(wolfpack_state::periodic_callback)
if (scanline >= 262)
scanline = 0;
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(wolfpack_state::periodic_callback),this), scanline);
timer_set(machine().primary_screen->time_until_pos(scanline), TIMER_PERIODIC, scanline);
}
void wolfpack_state::machine_reset()
{
machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(wolfpack_state::periodic_callback),this));
timer_set(machine().primary_screen->time_until_pos(0), TIMER_PERIODIC);
}

View File

@ -180,6 +180,11 @@ Check gticlub.c for details on the bottom board.
class zr107_state : public driver_device
{
public:
enum
{
TIMER_IRQ_OFF
};
zr107_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_workram(*this, "workram"),
@ -214,12 +219,14 @@ public:
UINT32 screen_update_zr107(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_jetwave(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(zr107_vblank);
TIMER_CALLBACK_MEMBER(irq_off);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_dsp;
optional_device<k001604_device> m_k001604;
optional_device<k056832_device> m_k056832;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
@ -420,7 +427,7 @@ void zr107_state::machine_start()
/* set conservative DRC options */
ppcdrc_set_options(m_maincpu, PPCDRC_COMPATIBLE_OPTIONS);
m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zr107_state::irq_off),this));
m_sound_irq_timer = timer_alloc(TIMER_IRQ_OFF);
/* configure fast RAM regions for DRC */
ppcdrc_add_fastram(m_maincpu, 0x00000000, 0x000fffff, FALSE, m_workram);
@ -688,9 +695,16 @@ static const adc083x_interface zr107_adc_interface = {
};
TIMER_CALLBACK_MEMBER(zr107_state::irq_off)
void zr107_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_audiocpu->set_input_line(param, CLEAR_LINE);
switch (id)
{
case TIMER_IRQ_OFF:
m_audiocpu->set_input_line(param, CLEAR_LINE);
break;
default:
assert_always(FALSE, "Unknown id in zr107_state::device_timer");
}
}
static void sound_irq_callback( running_machine &machine, int irq )
@ -699,7 +713,7 @@ static void sound_irq_callback( running_machine &machine, int irq )
int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
state->m_audiocpu->set_input_line(line, ASSERT_LINE);
machine.scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(zr107_state::irq_off),state), line);
state->timer_set(attotime::from_usec(5), zr107_state::TIMER_IRQ_OFF, line);
}
static const k056800_interface zr107_k056800_interface =

View File

@ -3,6 +3,13 @@
class fuuki16_state : public driver_device
{
public:
enum
{
TIMER_LEVEL_1_INTERRUPT,
TIMER_VBLANK_INTERRUPT,
TIMER_RASTER_INTERRUPT
};
fuuki16_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_vram(*this, "vram"),
@ -47,13 +54,13 @@ public:
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_fuuki16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(level_1_interrupt_callback);
TIMER_CALLBACK_MEMBER(vblank_interrupt_callback);
TIMER_CALLBACK_MEMBER(raster_interrupt_callback);
inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
inline void fuuki16_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
void fuuki16_draw_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, int i, int flag, int pri );
DECLARE_WRITE_LINE_MEMBER(soundirq);
required_device<okim6295_device> m_oki;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -10,6 +10,11 @@ struct star {
class gaplus_state : public driver_device
{
public:
enum
{
TIMER_NAMCOIO_RUN
};
gaplus_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_customio_3(*this,"customio_3"),
@ -63,4 +68,7 @@ public:
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_subcpu2;
required_device<samples_device> m_samples;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -8,6 +8,11 @@
class parodius_state : public driver_device
{
public:
enum
{
TIMER_NMI
};
parodius_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_ram(*this, "ram"),
@ -51,7 +56,9 @@ public:
virtual void machine_reset();
UINT32 screen_update_parodius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(parodius_interrupt);
TIMER_CALLBACK_MEMBER(nmi_callback);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
/*----------- defined in video/parodius.c -----------*/

View File

@ -9,6 +9,11 @@
class ultratnk_state : public driver_device
{
public:
enum
{
TIMER_NMI
};
ultratnk_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
@ -47,4 +52,7 @@ public:
TIMER_CALLBACK_MEMBER(nmi_callback);
required_device<cpu_device> m_maincpu;
required_device<discrete_device> m_discrete;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -18,6 +18,11 @@
class videopin_state : public driver_device
{
public:
enum
{
TIMER_INTERRUPT
};
videopin_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_video_ram(*this, "video_ram"),
@ -49,6 +54,9 @@ public:
double calc_plunger_pos();
required_device<cpu_device> m_maincpu;
required_device<discrete_device> m_discrete;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
/*----------- defined in audio/videopin.c -----------*/

View File

@ -1,6 +1,11 @@
class wolfpack_state : public driver_device
{
public:
enum
{
TIMER_PERIODIC
};
wolfpack_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_alpha_num_ram(*this, "alpha_num_ram"),
@ -63,4 +68,7 @@ public:
void draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_water(colortable_t *colortable, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};