Anonymous timers begone! (nw)

This commit is contained in:
Andrew Gardner 2013-05-29 03:50:41 +00:00
parent 2b4023cddd
commit 7a00eb5a33
29 changed files with 407 additions and 107 deletions

View File

@ -92,6 +92,13 @@ struct asic_t
class amstrad_state : public driver_device
{
public:
enum
{
TIMER_PC2_LOW,
TIMER_VIDEO_UPDATE,
TIMER_SET_RESOLUTION
};
amstrad_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -290,6 +297,7 @@ protected:
void update_psg();
void amstrad_common_init();
unsigned char kccomp_get_colour_element(int colour_value);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -51,6 +51,12 @@ private:
class dai_state : public driver_device
{
public:
enum
{
TIMER_BOOTSTRAP,
TIMER_TMS5501
};
dai_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_pit(*this, "pit8253"),
@ -83,12 +89,13 @@ public:
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(dai_bootstrap_callback);
TIMER_CALLBACK_MEMBER(dai_timer);
required_device<cpu_device> m_maincpu;
required_device<cassette_image_device> m_cassette;
required_device<ram_device> m_ram;
void dai_update_memory(int dai_rom_bank);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -56,6 +56,13 @@ struct ULA
class electron_state : public driver_device
{
public:
enum
{
TIMER_TAPE_HANDLER,
TIMER_SETUP_BEEP,
TIMER_SCANLINE_INTERRUPT
};
electron_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -91,6 +98,9 @@ public:
inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
void electron_interrupt_handler(int mode, int interrupt);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( electron_cart );
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -17,6 +17,11 @@ struct kay_kbd_t;
class kaypro_state : public driver_device
{
public:
enum
{
TIMER_FLOPPY
};
kaypro_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -79,12 +84,14 @@ public:
UINT32 screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(kay_kbd_interrupt);
TIMER_CALLBACK_MEMBER(kaypro_timer_callback);
DECLARE_WRITE_LINE_MEMBER(kaypro_interrupt);
DECLARE_READ8_MEMBER(kaypro_sio_r);
DECLARE_WRITE8_MEMBER(kaypro_sio_w);
DECLARE_QUICKLOAD_LOAD_MEMBER(kayproii );
DECLARE_QUICKLOAD_LOAD_MEMBER(kaypro2x );
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -95,6 +95,14 @@ struct LYNX_TIMER
class lynx_state : public driver_device
{
public:
enum
{
TIMER_BLITTER,
TIMER_SHOT,
TIMER_UART_LOOPBACK,
TIMER_UART
};
lynx_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_mem_0000(*this, "mem_0000"),
@ -169,6 +177,9 @@ public:
void lynx_uart_reset();
int lynx_verify_cart (char *header, int kind);
DECLARE_QUICKLOAD_LOAD_MEMBER( lynx );
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -22,6 +22,12 @@
class osborne1_state : public driver_device
{
public:
enum
{
TIMER_VIDEO,
TIMER_SETUP
};
osborne1_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -111,6 +117,8 @@ protected:
required_memory_bank m_bank3;
required_memory_bank m_bank4;
required_memory_region m_region_maincpu;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -17,6 +17,11 @@
class pc1401_state : public driver_device
{
public:
enum
{
TIMER_POWER_UP
};
pc1401_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
@ -28,7 +33,6 @@ public:
UINT8 m_reg[0x100];
DECLARE_DRIVER_INIT(pc1401);
UINT32 screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pc1401_power_up);
DECLARE_READ_LINE_MEMBER(pc1401_reset);
DECLARE_READ_LINE_MEMBER(pc1401_brk);
DECLARE_WRITE8_MEMBER(pc1401_outa);
@ -41,6 +45,9 @@ public:
virtual void machine_start();
required_device<cpu_device> m_maincpu;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /* PC1401_H_ */

View File

@ -17,6 +17,11 @@
class pc1403_state : public driver_device
{
public:
enum
{
TIMER_POWER_UP
};
pc1403_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu") { }
@ -31,7 +36,6 @@ public:
DECLARE_DRIVER_INIT(pc1403);
UINT32 screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pc1403_power_up);
DECLARE_READ_LINE_MEMBER(pc1403_reset);
DECLARE_READ_LINE_MEMBER(pc1403_brk);
DECLARE_WRITE8_MEMBER(pc1403_outa);
@ -45,6 +49,9 @@ public:
virtual void video_start();
virtual void machine_start();
required_device<cpu_device> m_maincpu;
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /* PC1403_H_ */

View File

@ -14,6 +14,14 @@
class poly88_state : public driver_device
{
public:
enum
{
TIMER_USART,
TIMER_KEYBOARD,
TIMER_CASSETTE,
TIMER_SETUP_MACHINE_STATE
};
poly88_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_video_ram(*this, "video_ram"),
@ -55,6 +63,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(poly88_usart_rxready);
IRQ_CALLBACK_MEMBER(poly88_irq_callback);
DECLARE_SNAPSHOT_LOAD_MEMBER( poly88 );
protected:
required_device<cpu_device> m_maincpu;
required_device<i8251_device> m_uart;
@ -69,6 +78,7 @@ protected:
required_ioport m_line5;
required_ioport m_line6;
UINT8 row_number(UINT8 code);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -16,6 +16,11 @@
class radio86_state : public driver_device
{
public:
enum
{
TIMER_RESET
};
radio86_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -61,7 +66,6 @@ public:
DECLARE_DRIVER_INIT(radio86);
DECLARE_MACHINE_RESET(radio86);
DECLARE_PALETTE_INIT(radio86);
TIMER_CALLBACK_MEMBER(radio86_reset);
DECLARE_READ8_MEMBER(radio86_8255_portb_r2);
DECLARE_READ8_MEMBER(radio86_8255_portc_r2);
DECLARE_WRITE8_MEMBER(radio86_8255_porta_w2);
@ -75,6 +79,7 @@ public:
DECLARE_READ8_MEMBER(memory_read_byte);
DECLARE_WRITE8_MEMBER(memory_write_byte);
required_device<cpu_device> m_maincpu;
protected:
required_device<cassette_image_device> m_cassette;
optional_device<i8257_device> m_dma8257;
@ -101,6 +106,7 @@ protected:
optional_ioport m_io_cline7;
void radio86_init_keyboard();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -22,6 +22,14 @@
class sms_state : public driver_device
{
public:
enum
{
TIMER_RAPID_FIRE,
TIMER_LIGHTGUN_TICK,
TIMER_LPHASER_1,
TIMER_LPHASER_2
};
sms_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -213,7 +221,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
protected:
void setup_bios();
void setup_rom();
void setup_sms_cart();
@ -224,6 +231,7 @@ protected:
UINT16 screen_vpos_nonscaled(int scaled_vpos);
int lgun_bright_aim_area(emu_timer *timer, int lgun_x, int lgun_y);
void sms_get_inputs(address_space &space);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
class smssdisp_state : public sms_state

View File

@ -40,6 +40,13 @@ struct cass_data_t {
class sorcerer_state : public driver_device
{
public:
enum
{
TIMER_SERIAL,
TIMER_CASSETTE,
TIMER_RESET
};
sorcerer_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -91,6 +98,9 @@ public:
TIMER_CALLBACK_MEMBER(sorcerer_reset);
DECLARE_SNAPSHOT_LOAD_MEMBER( sorcerer );
DECLARE_QUICKLOAD_LOAD_MEMBER( sorcerer);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};
#endif /* SORCERER_H_ */

View File

@ -26,6 +26,12 @@ class specimx_sound_device; // defined below
class special_state : public driver_device
{
public:
enum
{
TIMER_RESET,
TIMER_PIT8253_GATES
};
special_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
@ -114,8 +120,6 @@ public:
UINT32 screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(special_reset);
TIMER_CALLBACK_MEMBER(setup_pit8253_gates);
void fdc_drq(bool state);
DECLARE_FLOPPY_FORMATS( specimx_floppy_formats );
@ -140,6 +144,8 @@ protected:
required_ioport m_io_line10;
required_ioport m_io_line11;
required_ioport m_io_line12;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -18,6 +18,12 @@
class ut88_state : public driver_device
{
public:
enum
{
TIMER_RESET,
TIMER_UPDATE_DISPLAY
};
ut88_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_cassette(*this, "cassette"),
@ -77,6 +83,7 @@ protected:
optional_ioport m_io_line7;
optional_ioport m_io_line8;
required_device<cpu_device> m_maincpu;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
};

View File

@ -224,6 +224,25 @@ TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_pc2_low)
}
void amstrad_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_PC2_LOW:
amstrad_pc2_low(ptr, param);
break;
case TIMER_VIDEO_UPDATE:
amstrad_video_update_timer(ptr, param);
break;
case TIMER_SET_RESOLUTION:
cb_set_resolution(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in amstrad_state::device_timer");
}
}
/*************************************************************************/
/* KC Compact
@ -590,7 +609,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_inde
{
int val;
machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),1);
timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1);
/* CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette */
val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; /* red */
@ -601,7 +620,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_inde
}
else
{
machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),0);
timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0);
}
m_GateArray_render_colours[PenIndex] = hw_colour_index;
}
@ -609,7 +628,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, UINT16 hw_colour_inde
void amstrad_state::aleste_vh_update_colour(int PenIndex, UINT16 hw_colour_index)
{
machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),0);
timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0);
m_GateArray_render_colours[PenIndex] = hw_colour_index+32;
}
@ -960,7 +979,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_vsync_changed)
m_gate_array.vsync = state ? 1 : 0;
/* Schedule a write to PC2 */
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),this));
timer_set(attotime::zero, TIMER_PC2_LOW);
}
@ -982,7 +1001,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_vsync_changed)
m_gate_array.vsync = state ? 1 : 0;
/* Schedule a write to PC2 */
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),this));
timer_set(attotime::zero, TIMER_PC2_LOW);
}
@ -2017,9 +2036,9 @@ WRITE8_MEMBER(amstrad_state::amstrad_cpc_io_w)
break;
case 0x01: /* Write to selected internal 6845 register Write Only */
if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 )
machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),1);
timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1);
else
machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),0);
timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0);
m_crtc->register_w( space, 0, data );
/* printer port bit 8 */
@ -2555,7 +2574,7 @@ READ8_MEMBER(amstrad_state::amstrad_ppi_portb_r)
logerror("amstrad_ppi_portb_r\n");
/* Schedule a write to PC2 */
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),this));
timer_set(attotime::zero, TIMER_PC2_LOW);
return data;
}
@ -2935,7 +2954,7 @@ MACHINE_RESET_MEMBER(amstrad_state,amstrad)
m_gate_array.hsync = 0;
m_gate_array.vsync = 0;
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this));
timer_set(attotime::zero, TIMER_SET_RESOLUTION);
}
@ -2987,7 +3006,7 @@ MACHINE_RESET_MEMBER(amstrad_state,plus)
space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this));
// multiface_init();
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this));
timer_set(attotime::zero, TIMER_SET_RESOLUTION);
}
MACHINE_START_MEMBER(amstrad_state,gx4000)
@ -3036,7 +3055,7 @@ MACHINE_RESET_MEMBER(amstrad_state,gx4000)
space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this));
space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this));
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this));
timer_set(attotime::zero, TIMER_SET_RESOLUTION);
}
MACHINE_START_MEMBER(amstrad_state,kccomp)
@ -3088,7 +3107,7 @@ MACHINE_RESET_MEMBER(amstrad_state,aleste)
amstrad_common_init();
amstrad_reset_machine();
machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this));
timer_set(attotime::zero, TIMER_SET_RESOLUTION);
}

View File

@ -17,6 +17,23 @@
#define LOG_DAI_PORT_R(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port read : %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0)
#define LOG_DAI_PORT_W(_port, _data, _comment) do { if (DEBUG_DAI_PORTS) logerror ("DAI port write: %04x, Data: %02x (%s)\n", _port, _data, _comment); } while (0)
void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_BOOTSTRAP:
m_maincpu->set_pc(0xc000);
break;
case TIMER_TMS5501:
m_tms5501->set_pio_bit_7((ioport("IN8")->read() & 0x04) ? 1:0);
timer_set(attotime::from_hz(100), TIMER_TMS5501);
break;
default:
assert_always(FALSE, "Unknown id in dai_state::device_timer");
}
}
/* Discrete I/O devices */
@ -33,11 +50,6 @@ void dai_state::dai_update_memory(int dai_rom_bank)
membank("bank2")->set_entry(dai_rom_bank);
}
TIMER_CALLBACK_MEMBER(dai_state::dai_bootstrap_callback)
{
m_maincpu->set_pc(0xc000);
}
READ8_MEMBER(dai_state::dai_keyboard_r)
{
@ -105,16 +117,11 @@ const struct pit8253_config dai_pit8253_intf =
}
};
TIMER_CALLBACK_MEMBER(dai_state::dai_timer)
{
m_tms5501->set_pio_bit_7((ioport("IN8")->read() & 0x04) ? 1:0);
}
void dai_state::machine_start()
{
membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x010000, 0x1000);
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(dai_state::dai_bootstrap_callback),this));
machine().scheduler().timer_pulse(attotime::from_hz(100), timer_expired_delegate(FUNC(dai_state::dai_timer),this)); /* timer for tms5501 */
timer_set(attotime::zero, TIMER_BOOTSTRAP);
timer_set(attotime::from_hz(100), TIMER_TMS5501);
memset(m_ram->pointer(), 0, m_ram->size());
}

View File

@ -12,6 +12,25 @@
#include "sound/beep.h"
#include "imagedev/cassette.h"
void electron_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_TAPE_HANDLER:
electron_tape_timer_handler(ptr, param);
break;
case TIMER_SETUP_BEEP:
setup_beep(ptr, param);
break;
case TIMER_SCANLINE_INTERRUPT:
electron_scanline_interrupt(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in electron_state::device_timer");
}
}
void electron_state::electron_tape_start()
{
if (m_ula.tape_running )
@ -335,8 +354,8 @@ void electron_state::machine_start()
m_ula.interrupt_status = 0x82;
m_ula.interrupt_control = 0x00;
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this));
m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this));
timer_set(attotime::zero, TIMER_SETUP_BEEP);
m_tape_timer = timer_alloc(TIMER_TAPE_HANDLER);
}
DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart )

View File

@ -278,16 +278,23 @@ WRITE8_MEMBER(kaypro_state::kaypro_sio_w)
*************************************************************************************/
TIMER_CALLBACK_MEMBER(kaypro_state::kaypro_timer_callback)
void kaypro_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
if (m_maincpu->state_int(Z80_HALT))
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
switch (id)
{
case TIMER_FLOPPY:
if (m_maincpu->state_int(Z80_HALT))
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
break;
default:
assert_always(FALSE, "Unknown id in kaypro_state::device_timer");
}
}
WRITE_LINE_MEMBER( kaypro_state::kaypro_fdc_intrq_w )
{
if (state)
machine().scheduler().timer_set(attotime::from_usec(25), timer_expired_delegate(FUNC(kaypro_state::kaypro_timer_callback),this));
timer_set(attotime::from_usec(25), TIMER_FLOPPY);
else
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
@ -295,7 +302,7 @@ WRITE_LINE_MEMBER( kaypro_state::kaypro_fdc_intrq_w )
WRITE_LINE_MEMBER( kaypro_state::kaypro_fdc_drq_w )
{
if (state)
machine().scheduler().timer_set(attotime::from_usec(25), timer_expired_delegate(FUNC(kaypro_state::kaypro_timer_callback),this));
timer_set(attotime::from_usec(25), TIMER_FLOPPY);
else
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);

View File

@ -580,6 +580,27 @@ void lynx_state::lynx_blit_lines()
}
}
void lynx_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_BLITTER:
lynx_blitter_timer(ptr, param);
break;
case TIMER_SHOT:
lynx_timer_shot(ptr, param);
break;
case TIMER_UART_LOOPBACK:
lynx_uart_loopback_timer(ptr, param);
break;
case TIMER_UART:
lynx_uart_timer(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in lynx_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(lynx_state::lynx_blitter_timer)
{
m_blitter.busy=0; // blitter finished
@ -763,7 +784,7 @@ void lynx_state::lynx_blitter()
}
}
machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(m_blitter.memory_accesses), timer_expired_delegate(FUNC(lynx_state::lynx_blitter_timer),this));
timer_set(m_maincpu->cycles_to_attotime(m_blitter.memory_accesses), TIMER_BLITTER);
}
@ -1356,7 +1377,7 @@ TIM_BORROWOUT EQU %00000001
void lynx_state::lynx_timer_init(int which)
{
memset(&m_timer[which], 0, sizeof(LYNX_TIMER));
m_timer[which].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lynx_state::lynx_timer_shot),this));
m_timer[which].timer = timer_alloc(TIMER_SHOT);
state_save_register_item(machine(), "Lynx", NULL, which, m_timer[which].bakup);
state_save_register_item(machine(), "Lynx", NULL, which, m_timer[which].cntrl1);
@ -1586,14 +1607,14 @@ TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_timer)
{
m_uart.data_to_send = m_uart.buffer;
m_uart.buffer_loaded = FALSE;
machine().scheduler().timer_set(attotime::from_usec(11*16), timer_expired_delegate(FUNC(lynx_state::lynx_uart_timer),this));
timer_set(attotime::from_usec(11*16), TIMER_UART);
}
else
{
m_uart.sending = FALSE;
m_uart.received = TRUE;
m_uart.data_received = m_uart.data_to_send;
machine().scheduler().timer_set(attotime::from_usec(11*16), timer_expired_delegate(FUNC(lynx_state::lynx_uart_loopback_timer),this));
timer_set(attotime::from_usec(11*16), TIMER_UART_LOOPBACK);
if (m_uart.serctl & 0x40)
{
m_mikey.data[0x81] |= 0x10;
@ -1652,7 +1673,7 @@ WRITE8_MEMBER(lynx_state::lynx_uart_w)
m_uart.sending = TRUE;
m_uart.data_to_send = data;
// timing not accurate, baude rate should be calculated from timer 4 backup value and clock rate
machine().scheduler().timer_set(attotime::from_usec(11*16), timer_expired_delegate(FUNC(lynx_state::lynx_uart_timer),this));
timer_set(attotime::from_usec(11*16), TIMER_UART);
}
break;
}

View File

@ -341,6 +341,22 @@ const pia6821_interface osborne1_video_pia_config =
//};
void osborne1_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_VIDEO:
osborne1_video_callback(ptr, param);
break;
case TIMER_SETUP:
setup_osborne1(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in osborne1_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(osborne1_state::osborne1_video_callback)
{
int y = machine().primary_screen->vpos();
@ -460,10 +476,10 @@ DRIVER_INIT_MEMBER(osborne1_state,osborne1)
/* Configure the 6850 ACIA */
// acia6850_config( 0, &osborne1_6850_config );
m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osborne1_state::osborne1_video_callback),this));
m_video_timer = timer_alloc(TIMER_VIDEO);
m_video_timer->adjust(machine().primary_screen->time_until_pos(1, 0 ));
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(osborne1_state::setup_osborne1),this));
timer_set(attotime::zero, TIMER_SETUP);
}

View File

@ -119,9 +119,16 @@ void pc1401_state::machine_start()
machine().device<nvram_device>("ram_nvram")->set_base(ram, 0x2800);
}
TIMER_CALLBACK_MEMBER(pc1401_state::pc1401_power_up)
void pc1401_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_power = 0;
switch (id)
{
case TIMER_POWER_UP:
m_power = 0;
break;
default:
assert_always(FALSE, "Unknown id in pc1401_state::device_timer");
}
}
DRIVER_INIT_MEMBER(pc1401_state,pc1401)
@ -228,5 +235,5 @@ DRIVER_INIT_MEMBER(pc1401_state,pc1401)
gfx[i]=i;
m_power = 1;
machine().scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1401_state::pc1401_power_up),this));
timer_set(attotime::from_seconds(1), TIMER_POWER_UP);
}

View File

@ -146,9 +146,16 @@ void pc1403_state::machine_start()
machine().device<nvram_device>("ram_nvram")->set_base(ram, 0x8000);
}
TIMER_CALLBACK_MEMBER(pc1403_state::pc1403_power_up)
void pc1403_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_power=0;
switch (id)
{
case TIMER_POWER_UP:
m_power=0;
break;
default:
assert_always(FALSE, "Unknown id in pc1403_state::device_timer");
}
}
DRIVER_INIT_MEMBER(pc1403_state,pc1403)
@ -159,7 +166,7 @@ DRIVER_INIT_MEMBER(pc1403_state,pc1403)
for (i=0; i<128; i++) gfx[i]=i;
m_power = 1;
machine().scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1403_state::pc1403_power_up),this));
timer_set(attotime::from_seconds(1), TIMER_POWER_UP);
membank("bank1")->set_base(memregion("user1")->base());
}

View File

@ -12,6 +12,28 @@
#include "includes/poly88.h"
void poly88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_USART:
poly88_usart_timer_callback(ptr, param);
break;
case TIMER_KEYBOARD:
keyboard_callback(ptr, param);
break;
case TIMER_CASSETTE:
poly88_cassette_timer_callback(ptr, param);
break;
case TIMER_SETUP_MACHINE_STATE:
setup_machine_state(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in poly88_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(poly88_state::poly88_usart_timer_callback)
{
m_int_vector = 0xe7;
@ -21,7 +43,7 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_usart_timer_callback)
WRITE8_MEMBER(poly88_state::poly88_baud_rate_w)
{
logerror("poly88_baud_rate_w %02x\n",data);
m_usart_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(poly88_state::poly88_usart_timer_callback),this));
m_usart_timer = timer_alloc(TIMER_USART);
m_usart_timer->adjust(attotime::zero, 0, attotime::from_hz(300));
}
@ -128,6 +150,8 @@ TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback)
} else {
m_last_code = key_code;
}
timer_set(attotime::from_hz(24000), TIMER_KEYBOARD);
}
IRQ_CALLBACK_MEMBER(poly88_state::poly88_irq_callback)
@ -199,10 +223,10 @@ DRIVER_INIT_MEMBER(poly88_state,poly88)
{
m_previous_level = 0;
m_clk_level = m_clk_level_tape = 1;
m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(poly88_state::poly88_cassette_timer_callback),this));
m_cassette_timer = timer_alloc(TIMER_CASSETTE);
m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(600));
machine().scheduler().timer_pulse(attotime::from_hz(24000), timer_expired_delegate(FUNC(poly88_state::keyboard_callback),this));
timer_set(attotime::from_hz(24000), TIMER_KEYBOARD);
}
void poly88_state::machine_reset()
@ -211,7 +235,7 @@ void poly88_state::machine_reset()
m_intr = 0;
m_last_code = 0;
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(poly88_state::setup_machine_state),this));
timer_set(attotime::zero, TIMER_SETUP_MACHINE_STATE);
}
INTERRUPT_GEN_MEMBER(poly88_state::poly88_interrupt)

View File

@ -157,9 +157,16 @@ I8257_INTERFACE( radio86_dma )
{ DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_MEMBER("i8275", i8275_device, dack_w), DEVCB_NULL }
};
TIMER_CALLBACK_MEMBER(radio86_state::radio86_reset)
void radio86_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_bank1->set_entry(0);
switch (id)
{
case TIMER_RESET:
m_bank1->set_entry(0);
break;
default:
assert_always(FALSE, "Unknown id in radio86_state::device_timer");
}
}
@ -180,7 +187,7 @@ WRITE8_MEMBER(radio86_state::radio_io_w)
MACHINE_RESET_MEMBER(radio86_state,radio86)
{
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(radio86_state::radio86_reset),this));
timer_set(attotime::from_usec(10), TIMER_RESET);
m_bank1->set_entry(1);
m_keyboard_mask = 0;

View File

@ -16,6 +16,27 @@
#define LGUN_RADIUS 6
#define LGUN_X_INTERVAL 4
void sms_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_RAPID_FIRE:
rapid_fire_callback(ptr, param);
break;
case TIMER_LIGHTGUN_TICK:
lightgun_tick(ptr, param);
break;
case TIMER_LPHASER_1:
lphaser_1_callback(ptr, param);
break;
case TIMER_LPHASER_2:
lphaser_2_callback(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in sms_state::device_timer");
}
}
TIMER_CALLBACK_MEMBER(sms_state::rapid_fire_callback)
{
@ -329,7 +350,7 @@ void sms_state::sms_get_inputs( address_space &space )
}
/* Check if lightgun has been chosen as input: if so, enable crosshair */
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sms_state::lightgun_tick),this));
timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
/* Player 1 */
switch (m_port_ctrlsel->read_safe(0x00) & 0x0f)
@ -1035,18 +1056,18 @@ MACHINE_START_MEMBER(sms_state,sms)
{
char str[6];
m_rapid_fire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::rapid_fire_callback),this));
m_rapid_fire_timer = timer_alloc(TIMER_RAPID_FIRE);
m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10));
m_lphaser_1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::lphaser_1_callback),this));
m_lphaser_2_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::lphaser_2_callback),this));
m_lphaser_1_timer = timer_alloc(TIMER_LPHASER_1);
m_lphaser_2_timer = timer_alloc(TIMER_LPHASER_2);
m_left_lcd = machine().device("left_lcd");
m_right_lcd = machine().device("right_lcd");
m_space = &m_maincpu->space(AS_PROGRAM);
/* Check if lightgun has been chosen as input: if so, enable crosshair */
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sms_state::lightgun_tick),this));
timer_set(attotime::zero, TIMER_LIGHTGUN_TICK);
// alibaba and blockhol are ports of games for the MSX system. The
// MSX bios usually initializes callback "vectors" at the top of RAM.

View File

@ -27,6 +27,27 @@ TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_serial_tc)
#endif
void sorcerer_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_SERIAL:
#if SORCERER_USING_RS232
sorcerer_serial_tc(ptr, param);
#endif
break;
case TIMER_CASSETTE:
sorcerer_cassette_tc(ptr, param);
break;
case TIMER_RESET:
sorcerer_reset(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in sorcerer_state::device_timer");
}
}
/* timer to read cassette waveforms */
TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_cassette_tc)
@ -338,9 +359,9 @@ SNAPSHOT_LOAD_MEMBER( sorcerer_state,sorcerer)
void sorcerer_state::machine_start()
{
m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_cassette_tc),this));
m_cassette_timer = timer_alloc(TIMER_CASSETTE);
#if SORCERER_USING_RS232
m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_serial_tc),this));
m_serial_timer = timer_alloc(TIMER_SERIAL);
#endif
UINT16 endmem = 0xbfff;
@ -365,9 +386,9 @@ void sorcerer_state::machine_start()
MACHINE_START_MEMBER(sorcerer_state,sorcererd)
{
m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_cassette_tc),this));
m_cassette_timer = timer_alloc(TIMER_CASSETTE);
#if SORCERER_USING_RS232
m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_serial_tc),this));
m_serial_timer = timer_alloc(TIMER_SERIAL);
#endif
UINT16 endmem = 0xbbff;
@ -404,7 +425,7 @@ void sorcerer_state::machine_reset()
sorcerer_fe_w(space, 0, 0, 0xff);
membank("boot")->set_entry(1);
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(sorcerer_state::sorcerer_reset),this));
timer_set(attotime::from_usec(10), TIMER_RESET);
}

View File

@ -101,15 +101,30 @@ I8255_INTERFACE( specialist_ppi8255_interface )
DEVCB_DRIVER_MEMBER(special_state, specialist_8255_portc_w)
};
TIMER_CALLBACK_MEMBER(special_state::special_reset)
void special_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
m_bank1->set_entry(0);
switch (id)
{
case TIMER_RESET:
m_bank1->set_entry(0);
break;
case TIMER_PIT8253_GATES:
{
device_t *pit8253 = machine().device("pit8253");
pit8253_gate0_w(pit8253, 0);
pit8253_gate1_w(pit8253, 0);
pit8253_gate2_w(pit8253, 0);
break;
}
default:
assert_always(FALSE, "Unknown id in special_state::device_timer");
}
}
MACHINE_RESET_MEMBER(special_state,special)
{
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(special_state::special_reset),this));
timer_set(attotime::from_usec(10), TIMER_RESET);
m_bank1->set_entry(1);
}
@ -225,19 +240,10 @@ MACHINE_START_MEMBER(special_state,specimx)
m_fdc->setup_drq_cb(fd1793_t::line_cb(FUNC(special_state::fdc_drq), this));
}
TIMER_CALLBACK_MEMBER(special_state::setup_pit8253_gates)
{
device_t *pit8253 = machine().device("pit8253");
pit8253_gate0_w(pit8253, 0);
pit8253_gate1_w(pit8253, 0);
pit8253_gate2_w(pit8253, 0);
}
MACHINE_RESET_MEMBER(special_state,specimx)
{
specimx_set_bank(2, 0); // Initiali load ROM disk
machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(special_state::setup_pit8253_gates),this));
timer_set(attotime::zero, TIMER_PIT8253_GATES);
}
READ8_MEMBER( special_state::specimx_disk_ctrl_r )

View File

@ -14,6 +14,14 @@
#include "machine/i8255.h"
#include "includes/ut88.h"
static const UINT8 hex_to_7seg[16] =
{
0x3F, 0x06, 0x5B, 0x4F,
0x66, 0x6D, 0x7D, 0x07,
0x7F, 0x6F, 0x77, 0x7c,
0x39, 0x5e, 0x79, 0x71
};
/* Driver initialization */
DRIVER_INIT_MEMBER(ut88_state,ut88)
@ -25,6 +33,25 @@ DRIVER_INIT_MEMBER(ut88_state,ut88)
m_bank1->configure_entries(0, 2, RAM, 0xf800);
}
void ut88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_RESET:
m_bank1->set_entry(0);
break;
case TIMER_UPDATE_DISPLAY:
for (int i=0;i<6;i++)
output_set_digit_value(i, hex_to_7seg[m_lcd_digit[i]]);
timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY);
break;
default:
assert_always(FALSE, "Unknown id in ut88_state::device_timer");
}
}
READ8_MEMBER( ut88_state::ut88_8255_portb_r )
{
UINT8 data = 0xff;
@ -69,14 +96,9 @@ I8255A_INTERFACE( ut88_ppi8255_interface )
DEVCB_NULL,
};
TIMER_CALLBACK_MEMBER(ut88_state::ut88_reset)
{
m_bank1->set_entry(0);
}
MACHINE_RESET_MEMBER(ut88_state,ut88)
{
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(ut88_state::ut88_reset),this));
timer_set(attotime::from_usec(10), TIMER_RESET);
m_bank1->set_entry(1);
m_keyboard_mask = 0;
}
@ -148,29 +170,13 @@ WRITE8_MEMBER( ut88_state::ut88mini_write_led )
}
}
static const UINT8 hex_to_7seg[16] =
{
0x3F, 0x06, 0x5B, 0x4F,
0x66, 0x6D, 0x7D, 0x07,
0x7F, 0x6F, 0x77, 0x7c,
0x39, 0x5e, 0x79, 0x71
};
TIMER_CALLBACK_MEMBER(ut88_state::update_display)
{
int i;
for (i=0;i<6;i++)
output_set_digit_value(i, hex_to_7seg[m_lcd_digit[i]]);
}
DRIVER_INIT_MEMBER(ut88_state,ut88mini)
{
}
MACHINE_START_MEMBER(ut88_state,ut88mini)
{
machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(ut88_state::update_display),this));
timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY);
}
MACHINE_RESET_MEMBER(ut88_state,ut88mini)

View File

@ -45,7 +45,7 @@ void electron_state::video_start()
m_map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 );
m_map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 );
}
m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_scanline_interrupt),this));
m_scanline_timer = timer_alloc(TIMER_SCANLINE_INTERRUPT);
m_scanline_timer->adjust( machine().primary_screen->time_until_pos(0), 0, machine().primary_screen->scan_period() );
}