From e624f84f348ad700b12230a7513288c3ff97f5bf Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 24 Sep 2012 15:01:45 +0000 Subject: [PATCH] modernization or timer callbacks part 3 - final (no whatsnew) --- src/mame/drivers/2mindril.c | 12 +++--- src/mame/drivers/39in1.c | 52 +++++++++++----------- src/mame/drivers/acefruit.c | 14 +++--- src/mame/drivers/aces1.c | 20 ++++----- src/mame/drivers/alg.c | 20 ++++----- src/mame/drivers/aristmk4.c | 24 +++++------ src/mame/drivers/aristmk5.c | 20 ++++----- src/mame/drivers/astinvad.c | 18 ++++---- src/mame/drivers/beaminv.c | 10 ++--- src/mame/drivers/berzerk.c | 24 +++++------ src/mame/drivers/boxer.c | 36 ++++++++-------- src/mame/drivers/cball.c | 10 ++--- src/mame/drivers/clayshoo.c | 10 ++--- src/mame/drivers/cliffhgr.c | 18 ++++---- src/mame/drivers/crystal.c | 12 +++--- src/mame/drivers/cubeqst.c | 10 +++-- src/mame/drivers/destroyr.c | 24 +++++------ src/mame/drivers/enigma2.c | 22 +++++----- src/mame/drivers/esh.c | 7 +-- src/mame/drivers/famibox.c | 34 +++++++-------- src/mame/drivers/firebeat.c | 30 ++++++------- src/mame/drivers/flyball.c | 32 +++++++------- src/mame/drivers/gpworld.c | 7 +-- src/mame/drivers/gticlub.c | 8 ++-- src/mame/drivers/guab.c | 14 +++--- src/mame/drivers/halleys.c | 8 ++-- src/mame/drivers/hornet.c | 9 ++-- src/mame/drivers/jangou.c | 14 +++--- src/mame/drivers/jpmsys5.c | 34 +++++++-------- src/mame/drivers/kinst.c | 7 +-- src/mame/drivers/ksys573.c | 54 +++++++++++------------ src/mame/drivers/lgp.c | 7 +-- src/mame/drivers/mazerbla.c | 26 +++++------ src/mame/drivers/mgolf.c | 12 +++--- src/mame/drivers/missile.c | 26 +++++------ src/mame/drivers/mjsister.c | 16 +++---- src/mame/drivers/mlanding.c | 8 ++-- src/mame/drivers/mpu3.c | 12 +++--- src/mame/drivers/multigam.c | 8 ++-- src/mame/drivers/namcos23.c | 10 ++--- src/mame/drivers/nwk-tr.c | 7 +-- src/mame/drivers/peplus.c | 6 ++- src/mame/drivers/pipeline.c | 8 ++-- src/mame/drivers/rabbit.c | 8 ++-- src/mame/drivers/sbrkout.c | 38 ++++++++-------- src/mame/drivers/seattle.c | 24 +++++------ src/mame/drivers/sothello.c | 16 ++++--- src/mame/drivers/ssfindo.c | 24 +++++------ src/mame/drivers/taitogn.c | 10 ++--- src/mame/drivers/thayers.c | 19 ++++---- src/mame/drivers/tickee.c | 39 +++++++++-------- src/mame/drivers/tmmjprd.c | 7 +-- src/mame/drivers/tugboat.c | 9 ++-- src/mame/drivers/vegas.c | 20 ++++----- src/mame/drivers/viper.c | 19 ++++---- src/mame/drivers/zn.c | 10 ++--- src/mame/drivers/zr107.c | 8 ++-- src/mess/drivers/a2600.c | 10 ++--- src/mess/drivers/a7000.c | 38 ++++++++-------- src/mess/drivers/alphatro.c | 8 ++-- src/mess/drivers/amico2k.c | 10 ++--- src/mess/drivers/argo.c | 8 ++-- src/mess/drivers/c10.c | 8 ++-- src/mess/drivers/cat.c | 14 +++--- src/mess/drivers/craft.c | 79 +++++++++++++++++----------------- src/mess/drivers/dectalk.c | 11 ++--- src/mess/drivers/h19.c | 8 ++-- src/mess/drivers/ip20.c | 15 ++++--- src/mess/drivers/ip22.c | 41 +++++++++--------- src/mess/drivers/jr200.c | 7 +-- src/mess/drivers/mekd2.c | 7 +-- src/mess/drivers/ng_aes.c | 50 ++++++++++----------- src/mess/drivers/ngp.c | 36 ++++++++-------- src/mess/drivers/okean240.c | 8 ++-- src/mess/drivers/osbexec.c | 26 +++++------ src/mess/drivers/pb1000.c | 9 ++-- src/mess/drivers/pc6001.c | 14 +++--- src/mess/drivers/pc8801.c | 8 ++-- src/mess/drivers/pc88va.c | 20 ++++----- src/mess/drivers/pcfx.c | 14 +++--- src/mess/drivers/plan80.c | 8 ++-- src/mess/drivers/pockstat.c | 72 +++++++++++++++---------------- src/mess/drivers/psx.c | 12 +++--- src/mess/drivers/ptcsol.c | 86 ++++++++++++++++++------------------- src/mess/drivers/pv1000.c | 22 +++++----- src/mess/drivers/px4.c | 39 +++++++++-------- src/mess/drivers/scv.c | 14 +++--- src/mess/drivers/socrates.c | 24 +++++------ src/mess/drivers/supercon.c | 21 ++++----- src/mess/drivers/supracan.c | 64 +++++++++++++-------------- src/mess/drivers/sys2900.c | 8 ++-- src/mess/drivers/tec1.c | 38 ++++++++-------- src/mess/drivers/tutor.c | 12 +++--- src/mess/drivers/vg5k.c | 8 ++-- src/mess/drivers/vii.c | 16 +++---- src/mess/drivers/vk100.c | 66 ++++++++++++++-------------- src/mess/drivers/zrt80.c | 10 ++--- 97 files changed, 1008 insertions(+), 972 deletions(-) diff --git a/src/mame/drivers/2mindril.c b/src/mame/drivers/2mindril.c index 9f46d0f8791..c5d9056f35d 100644 --- a/src/mame/drivers/2mindril.c +++ b/src/mame/drivers/2mindril.c @@ -65,6 +65,8 @@ public: DECLARE_MACHINE_RESET(drill); INTERRUPT_GEN_MEMBER(drill_vblank_irq); //INTERRUPT_GEN_MEMBER(drill_device_irq); + TIMER_CALLBACK_MEMBER(shutter_req); + TIMER_CALLBACK_MEMBER(defender_req); }; @@ -132,16 +134,14 @@ WRITE16_MEMBER(_2mindril_state::drill_io_w) PORT_DIPSETTING( 0x0800, DEF_STR( On ) ) */ #ifdef UNUSED_FUNCTION -static TIMER_CALLBACK( shutter_req ) +TIMER_CALLBACK_MEMBER(_2mindril_state::shutter_req) { - _2mindril_state *state = machine.driver_data<_2mindril_state>(); - state->m_shutter_sensor = param; + m_shutter_sensor = param; } -static TIMER_CALLBACK( defender_req ) +TIMER_CALLBACK_MEMBER(_2mindril_state::defender_req) { - _2mindril_state *state = machine.driver_data<_2mindril_state>(); - state->m_defender_sensor = param; + m_defender_sensor = param; } #endif diff --git a/src/mame/drivers/39in1.c b/src/mame/drivers/39in1.c index 56d4dff1d14..e6f326890ba 100644 --- a/src/mame/drivers/39in1.c +++ b/src/mame/drivers/39in1.c @@ -76,6 +76,9 @@ public: virtual void machine_start(); UINT32 screen_update_39in1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(pxa255_vblank_start); + TIMER_CALLBACK_MEMBER(pxa255_dma_dma_end); + TIMER_CALLBACK_MEMBER(pxa255_ostimer_match); + TIMER_CALLBACK_MEMBER(pxa255_lcd_dma_eof); }; @@ -87,7 +90,7 @@ static void pxa255_dma_irq_check(running_machine& machine); static void pxa255_ostimer_irq_check(running_machine& machine); -static TIMER_CALLBACK( pxa255_ostimer_match ); + @@ -308,10 +311,9 @@ static void pxa255_dma_load_descriptor_and_start(running_machine& machine, int c dma_regs->dcsr[channel] &= ~PXA255_DCSR_STOPSTATE; } -static TIMER_CALLBACK( pxa255_dma_dma_end ) +TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_dma_dma_end) { - _39in1_state *state = machine.driver_data<_39in1_state>(); - PXA255_DMA_Regs *dma_regs = &state->m_dma_regs; + PXA255_DMA_Regs *dma_regs = &m_dma_regs; UINT32 sadr = dma_regs->dsadr[param]; UINT32 tadr = dma_regs->dtadr[param]; UINT32 count = dma_regs->dcmd[param] & 0x00001fff; @@ -320,18 +322,18 @@ static TIMER_CALLBACK( pxa255_dma_dma_end ) UINT16 temp16; UINT32 temp32; - address_space &space = machine.device("maincpu")->space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->space(AS_PROGRAM); switch(param) { case 3: for(index = 0; index < count; index += 4) { - state->m_words[index >> 2] = space.read_dword(sadr); - state->m_samples[(index >> 1) + 0] = (INT16)(state->m_words[index >> 2] >> 16); - state->m_samples[(index >> 1) + 1] = (INT16)(state->m_words[index >> 2] & 0xffff); + m_words[index >> 2] = space.read_dword(sadr); + m_samples[(index >> 1) + 0] = (INT16)(m_words[index >> 2] >> 16); + m_samples[(index >> 1) + 1] = (INT16)(m_words[index >> 2] & 0xffff); sadr += 4; } - dmadac_transfer(&state->m_dmadac[0], 2, 2, 2, count/4, state->m_samples); + dmadac_transfer(&m_dmadac[0], 2, 2, 2, count/4, m_samples); break; default: for(index = 0; index < count;) @@ -403,7 +405,7 @@ static TIMER_CALLBACK( pxa255_dma_dma_end ) { if(dma_regs->dcsr[param] & PXA255_DCSR_RUN) { - pxa255_dma_load_descriptor_and_start(machine, param); + pxa255_dma_load_descriptor_and_start(machine(), param); } else { @@ -416,7 +418,7 @@ static TIMER_CALLBACK( pxa255_dma_dma_end ) dma_regs->dcsr[param] &= ~PXA255_DCSR_RUN; dma_regs->dcsr[param] |= PXA255_DCSR_STOPSTATE; } - pxa255_dma_irq_check(machine); + pxa255_dma_irq_check(machine()); } READ32_MEMBER(_39in1_state::pxa255_dma_r) @@ -579,15 +581,14 @@ static void pxa255_ostimer_irq_check(running_machine& machine) //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0); } -static TIMER_CALLBACK( pxa255_ostimer_match ) +TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_ostimer_match) { - _39in1_state *state = machine.driver_data<_39in1_state>(); - PXA255_OSTMR_Regs *ostimer_regs = &state->m_ostimer_regs; + PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; - if (0) verboselog(machine, 3, "pxa255_ostimer_match channel %d\n", param); + if (0) verboselog(machine(), 3, "pxa255_ostimer_match channel %d\n", param); ostimer_regs->ossr |= (1 << param); ostimer_regs->oscr = ostimer_regs->osmr[param]; - pxa255_ostimer_irq_check(machine); + pxa255_ostimer_irq_check(machine()); } READ32_MEMBER(_39in1_state::pxa255_ostimer_r) @@ -1166,19 +1167,18 @@ static void pxa255_lcd_check_load_next_branch(running_machine& machine, int chan } } -static TIMER_CALLBACK( pxa255_lcd_dma_eof ) +TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_lcd_dma_eof) { - _39in1_state *state = machine.driver_data<_39in1_state>(); - PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs; + PXA255_LCD_Regs *lcd_regs = &m_lcd_regs; - if (0) verboselog( machine, 3, "End of frame callback\n" ); + if (0) verboselog( machine(), 3, "End of frame callback\n" ); if(lcd_regs->dma[param].ldcmd & PXA255_LDCMD_EOFINT) { lcd_regs->liidr = lcd_regs->dma[param].fidr; lcd_regs->lcsr |= PXA255_LCSR_EOF; } - pxa255_lcd_check_load_next_branch(machine, param); - pxa255_lcd_irq_check(machine); + pxa255_lcd_check_load_next_branch(machine(), param); + pxa255_lcd_irq_check(machine()); } READ32_MEMBER(_39in1_state::pxa255_lcd_r) @@ -1548,21 +1548,21 @@ static void pxa255_start(running_machine& machine) for(index = 0; index < 16; index++) { state->m_dma_regs.dcsr[index] = 0x00000008; - state->m_dma_regs.timer[index] = machine.scheduler().timer_alloc(FUNC(pxa255_dma_dma_end)); + state->m_dma_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_dma_dma_end),state)); } memset(&state->m_ostimer_regs, 0, sizeof(state->m_ostimer_regs)); for(index = 0; index < 4; index++) { state->m_ostimer_regs.osmr[index] = 0; - state->m_ostimer_regs.timer[index] = machine.scheduler().timer_alloc(FUNC(pxa255_ostimer_match)); + state->m_ostimer_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_ostimer_match),state)); } memset(&state->m_intc_regs, 0, sizeof(state->m_intc_regs)); memset(&state->m_lcd_regs, 0, sizeof(state->m_lcd_regs)); - state->m_lcd_regs.dma[0].eof = machine.scheduler().timer_alloc(FUNC(pxa255_lcd_dma_eof)); - state->m_lcd_regs.dma[1].eof = machine.scheduler().timer_alloc(FUNC(pxa255_lcd_dma_eof)); + state->m_lcd_regs.dma[0].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state)); + state->m_lcd_regs.dma[1].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state)); state->m_lcd_regs.trgbr = 0x00aa5500; state->m_lcd_regs.tcr = 0x0000754f; diff --git a/src/mame/drivers/acefruit.c b/src/mame/drivers/acefruit.c index 09cb272f917..a8e70ac99cb 100644 --- a/src/mame/drivers/acefruit.c +++ b/src/mame/drivers/acefruit.c @@ -41,6 +41,7 @@ public: virtual void palette_init(); UINT32 screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(acefruit_vblank); + TIMER_CALLBACK_MEMBER(acefruit_refresh); }; @@ -66,22 +67,21 @@ static void acefruit_update_irq(running_machine &machine, int vpos ) } -static TIMER_CALLBACK( acefruit_refresh ) +TIMER_CALLBACK_MEMBER(acefruit_state::acefruit_refresh) { - acefruit_state *state = machine.driver_data(); - int vpos = machine.primary_screen->vpos(); + int vpos = machine().primary_screen->vpos(); - machine.primary_screen->update_partial(vpos ); - acefruit_update_irq(machine, vpos ); + machine().primary_screen->update_partial(vpos ); + acefruit_update_irq(machine(), vpos ); vpos = ( ( vpos / 8 ) + 1 ) * 8; - state->m_refresh_timer->adjust( machine.primary_screen->time_until_pos(vpos) ); + m_refresh_timer->adjust( machine().primary_screen->time_until_pos(vpos) ); } void acefruit_state::video_start() { - m_refresh_timer = machine().scheduler().timer_alloc(FUNC(acefruit_refresh)); + m_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(acefruit_state::acefruit_refresh),this)); } INTERRUPT_GEN_MEMBER(acefruit_state::acefruit_vblank) diff --git a/src/mame/drivers/aces1.c b/src/mame/drivers/aces1.c index 93f3441196c..1178fee2a66 100644 --- a/src/mame/drivers/aces1.c +++ b/src/mame/drivers/aces1.c @@ -146,34 +146,34 @@ public: DECLARE_DRIVER_INIT(aces1); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(m_aces1_irq_timer_callback); + TIMER_CALLBACK_MEMBER(m_aces1_nmi_timer_callback); }; -static TIMER_CALLBACK( m_aces1_irq_timer_callback ) +TIMER_CALLBACK_MEMBER(aces1_state::m_aces1_irq_timer_callback) { - aces1_state *state = machine.driver_data(); // printf("irq\n"); - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); - state->aces1_reset_irq_timer(); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); + aces1_reset_irq_timer(); } -static TIMER_CALLBACK( m_aces1_nmi_timer_callback ) +TIMER_CALLBACK_MEMBER(aces1_state::m_aces1_nmi_timer_callback) { - aces1_state *state = machine.driver_data(); // printf("nmi\n"); - state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - state->aces1_reset_nmi_timer(); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + aces1_reset_nmi_timer(); } static void aces1_create_timers(running_machine &machine) { aces1_state *state = machine.driver_data(); - state->m_aces1_irq_timer = machine.scheduler().timer_alloc(FUNC(m_aces1_irq_timer_callback), 0); - state->m_aces1_nmi_timer = machine.scheduler().timer_alloc(FUNC(m_aces1_nmi_timer_callback), 0); + state->m_aces1_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_irq_timer_callback),state), 0); + state->m_aces1_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_nmi_timer_callback),state), 0); } void aces1_state::machine_start() diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index e06c45c0c38..2c438e375d7 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -59,9 +59,10 @@ public: DECLARE_MACHINE_START(alg); DECLARE_MACHINE_RESET(alg); DECLARE_VIDEO_START(alg); + TIMER_CALLBACK_MEMBER(response_timer); }; -static TIMER_CALLBACK( response_timer ); + @@ -115,7 +116,7 @@ VIDEO_START_MEMBER(alg_state,alg) MACHINE_START_MEMBER(alg_state,alg) { - m_serial_timer = machine().scheduler().timer_alloc(FUNC(response_timer)); + m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alg_state::response_timer),this)); m_serial_timer_active = FALSE; } @@ -133,24 +134,23 @@ MACHINE_RESET_MEMBER(alg_state,alg) * *************************************/ -static TIMER_CALLBACK( response_timer ) +TIMER_CALLBACK_MEMBER(alg_state::response_timer) { - alg_state *state = machine.driver_data(); /* if we still have data to send, do it now */ - if (state->m_laserdisc->data_available_r() == ASSERT_LINE) + if (m_laserdisc->data_available_r() == ASSERT_LINE) { - UINT8 data = state->m_laserdisc->data_r(); + UINT8 data = m_laserdisc->data_r(); if (data != 0x0a) mame_printf_debug("Sending serial data = %02X\n", data); - amiga_serial_in_w(machine, data); + amiga_serial_in_w(machine(), data); } /* if there's more to come, set another timer */ - if (state->m_laserdisc->data_available_r() == ASSERT_LINE) - state->m_serial_timer->adjust(amiga_get_serial_char_period(machine)); + if (m_laserdisc->data_available_r() == ASSERT_LINE) + m_serial_timer->adjust(amiga_get_serial_char_period(machine())); else - state->m_serial_timer_active = FALSE; + m_serial_timer_active = FALSE; } diff --git a/src/mame/drivers/aristmk4.c b/src/mame/drivers/aristmk4.c index 07bdf58336e..e7d0dfb9912 100644 --- a/src/mame/drivers/aristmk4.c +++ b/src/mame/drivers/aristmk4.c @@ -322,6 +322,9 @@ public: virtual void palette_init(); DECLARE_PALETTE_INIT(lions); UINT32 screen_update_aristmk4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(note_input_reset); + TIMER_CALLBACK_MEMBER(coin_input_reset); + TIMER_CALLBACK_MEMBER(hopper_reset); }; /* Partial Cashcade protocol */ @@ -484,10 +487,9 @@ READ8_MEMBER(aristmk4_state::u3_p3) } -static TIMER_CALLBACK(note_input_reset) +TIMER_CALLBACK_MEMBER(aristmk4_state::note_input_reset) { - aristmk4_state *state = machine.driver_data(); - state->m_insnote=0; //reset note input after 150msec + m_insnote=0; //reset note input after 150msec } READ8_MEMBER(aristmk4_state::bv_p0) @@ -504,7 +506,7 @@ READ8_MEMBER(aristmk4_state::bv_p0) case 0x02: bv_p0_ret=0x89; m_insnote++; - machine().scheduler().timer_set(attotime::from_msec(150), FUNC(note_input_reset)); + machine().scheduler().timer_set(attotime::from_msec(150), timer_expired_delegate(FUNC(aristmk4_state::note_input_reset),this)); break; default: break; //timer will reset the input @@ -630,16 +632,14 @@ VERSATILE INTERFACE ADAPTER CONFIGURATION ******************************************************************************/ -static TIMER_CALLBACK(coin_input_reset) +TIMER_CALLBACK_MEMBER(aristmk4_state::coin_input_reset) { - aristmk4_state *state = machine.driver_data(); - state->m_inscrd=0; //reset credit input after 150msec + m_inscrd=0; //reset credit input after 150msec } -static TIMER_CALLBACK(hopper_reset) +TIMER_CALLBACK_MEMBER(aristmk4_state::hopper_reset) { - aristmk4_state *state = machine.driver_data(); - state->m_hopper_motor=0x01; + m_hopper_motor=0x01; } // Port A read (SW1) @@ -686,7 +686,7 @@ READ8_MEMBER(aristmk4_state::via_b_r) case 0x02: ret=ret^0x20; m_inscrd++; - machine().scheduler().timer_set(attotime::from_msec(150), FUNC(coin_input_reset)); + machine().scheduler().timer_set(attotime::from_msec(150), timer_expired_delegate(FUNC(aristmk4_state::coin_input_reset),this)); break; default: break; //timer will reset the input @@ -698,7 +698,7 @@ READ8_MEMBER(aristmk4_state::via_b_r) { case 0x00: ret=ret^0x40; - machine().scheduler().timer_set(attotime::from_msec(175), FUNC(hopper_reset)); + machine().scheduler().timer_set(attotime::from_msec(175), timer_expired_delegate(FUNC(aristmk4_state::hopper_reset),this)); m_hopper_motor=0x02; break; case 0x01: diff --git a/src/mame/drivers/aristmk5.c b/src/mame/drivers/aristmk5.c index 6e35f42b281..2038cc00d79 100644 --- a/src/mame/drivers/aristmk5.c +++ b/src/mame/drivers/aristmk5.c @@ -83,14 +83,15 @@ public: DECLARE_DRIVER_INIT(aristmk5); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(mk5_VSYNC_callback); + TIMER_CALLBACK_MEMBER(mk5_2KHz_callback); }; -static TIMER_CALLBACK( mk5_VSYNC_callback ) +TIMER_CALLBACK_MEMBER(aristmk5_state::mk5_VSYNC_callback) { - aristmk5_state *state = machine.driver_data(); - state->m_ioc_regs[IRQ_STATUS_A] |= 0x08; //turn vsync bit on - state->m_mk5_VSYNC_timer->adjust(attotime::never); + m_ioc_regs[IRQ_STATUS_A] |= 0x08; //turn vsync bit on + m_mk5_VSYNC_timer->adjust(attotime::never); } WRITE32_MEMBER(aristmk5_state::Ns5w48) @@ -152,11 +153,10 @@ WRITE32_MEMBER(aristmk5_state::Ns5w48) } } -static TIMER_CALLBACK( mk5_2KHz_callback ) +TIMER_CALLBACK_MEMBER(aristmk5_state::mk5_2KHz_callback) { - aristmk5_state *state = machine.driver_data(); - state->m_ioc_regs[IRQ_STATUS_A] |= 0x01; - state->m_mk5_2KHz_timer->adjust(attotime::never); + m_ioc_regs[IRQ_STATUS_A] |= 0x01; + m_mk5_2KHz_timer->adjust(attotime::never); } @@ -379,8 +379,8 @@ void aristmk5_state::machine_start() // reset the DAC to centerline //machine().device("dac")->write_signed8(0x80); - m_mk5_2KHz_timer = machine().scheduler().timer_alloc(FUNC(mk5_2KHz_callback)); - m_mk5_VSYNC_timer = machine().scheduler().timer_alloc(FUNC(mk5_VSYNC_callback)); + m_mk5_2KHz_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_2KHz_callback),this)); + m_mk5_VSYNC_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_VSYNC_callback),this)); } void aristmk5_state::machine_reset() diff --git a/src/mame/drivers/astinvad.c b/src/mame/drivers/astinvad.c index e1b0bba8547..a439d6a2744 100644 --- a/src/mame/drivers/astinvad.c +++ b/src/mame/drivers/astinvad.c @@ -83,6 +83,8 @@ public: DECLARE_VIDEO_START(spaceint); UINT32 screen_update_astinvad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(kamikaze_int_off); + TIMER_CALLBACK_MEMBER(kamizake_int_gen); }; @@ -219,23 +221,21 @@ UINT32 astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rgb3 * *************************************/ -static TIMER_CALLBACK( kamikaze_int_off ) +TIMER_CALLBACK_MEMBER(astinvad_state::kamikaze_int_off) { - astinvad_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } -static TIMER_CALLBACK( kamizake_int_gen ) +TIMER_CALLBACK_MEMBER(astinvad_state::kamizake_int_gen) { - astinvad_state *state = machine.driver_data(); /* interrupts are asserted on every state change of the 128V line */ - state->m_maincpu->set_input_line(0, ASSERT_LINE); + m_maincpu->set_input_line(0, ASSERT_LINE); param ^= 128; - state->m_int_timer->adjust(machine.primary_screen->time_until_pos(param), param); + m_int_timer->adjust(machine().primary_screen->time_until_pos(param), param); /* an RC circuit turns the interrupt off after a short amount of time */ - machine.scheduler().timer_set(attotime::from_double(300 * 0.1e-6), FUNC(kamikaze_int_off)); + machine().scheduler().timer_set(attotime::from_double(300 * 0.1e-6), timer_expired_delegate(FUNC(astinvad_state::kamikaze_int_off),this)); } @@ -244,7 +244,7 @@ MACHINE_START_MEMBER(astinvad_state,kamikaze) m_samples = machine().device("samples"); - m_int_timer = machine().scheduler().timer_alloc(FUNC(kamizake_int_gen)); + m_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astinvad_state::kamizake_int_gen),this)); m_int_timer->adjust(machine().primary_screen->time_until_pos(128), 128); save_item(NAME(m_screen_flip)); diff --git a/src/mame/drivers/beaminv.c b/src/mame/drivers/beaminv.c index 41ff62ae6e3..25a1a5a1d3b 100644 --- a/src/mame/drivers/beaminv.c +++ b/src/mame/drivers/beaminv.c @@ -80,6 +80,7 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_beaminv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(interrupt_callback); }; @@ -97,27 +98,26 @@ public: static const int interrupt_lines[INTERRUPTS_PER_FRAME] = { 0x00, 0x80 }; -static TIMER_CALLBACK( interrupt_callback ) +TIMER_CALLBACK_MEMBER(beaminv_state::interrupt_callback) { - beaminv_state *state = machine.driver_data(); int interrupt_number = param; int next_interrupt_number; int next_vpos; - state->m_maincpu->set_input_line(0, HOLD_LINE); + m_maincpu->set_input_line(0, HOLD_LINE); /* set up for next interrupt */ next_interrupt_number = (interrupt_number + 1) % INTERRUPTS_PER_FRAME; next_vpos = interrupt_lines[next_interrupt_number]; - state->m_interrupt_timer->adjust(machine.primary_screen->time_until_pos(next_vpos), next_interrupt_number); + m_interrupt_timer->adjust(machine().primary_screen->time_until_pos(next_vpos), next_interrupt_number); } static void create_interrupt_timer( running_machine &machine ) { beaminv_state *state = machine.driver_data(); - state->m_interrupt_timer = machine.scheduler().timer_alloc(FUNC(interrupt_callback)); + state->m_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(beaminv_state::interrupt_callback),state)); } diff --git a/src/mame/drivers/berzerk.c b/src/mame/drivers/berzerk.c index cc6102b0da6..b324ca7bb5b 100644 --- a/src/mame/drivers/berzerk.c +++ b/src/mame/drivers/berzerk.c @@ -59,6 +59,8 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_berzerk(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(irq_callback); + TIMER_CALLBACK_MEMBER(nmi_callback); }; @@ -181,9 +183,8 @@ WRITE8_MEMBER(berzerk_state::irq_enable_w) } -static TIMER_CALLBACK( irq_callback ) +TIMER_CALLBACK_MEMBER(berzerk_state::irq_callback) { - berzerk_state *state = machine.driver_data(); int irq_number = param; UINT8 next_counter; UINT8 next_v256; @@ -191,8 +192,8 @@ static TIMER_CALLBACK( irq_callback ) int next_irq_number; /* set the IRQ line if enabled */ - if (state->m_irq_enabled) - machine.device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xfc); + if (m_irq_enabled) + machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xfc); /* set up for next interrupt */ next_irq_number = (irq_number + 1) % IRQS_PER_FRAME; @@ -200,14 +201,14 @@ static TIMER_CALLBACK( irq_callback ) next_v256 = irq_trigger_v256s[next_irq_number]; next_vpos = vsync_chain_counter_to_vpos(next_counter, next_v256); - state->m_irq_timer->adjust(machine.primary_screen->time_until_pos(next_vpos), next_irq_number); + m_irq_timer->adjust(machine().primary_screen->time_until_pos(next_vpos), next_irq_number); } static void create_irq_timer(running_machine &machine) { berzerk_state *state = machine.driver_data(); - state->m_irq_timer = machine.scheduler().timer_alloc(FUNC(irq_callback)); + state->m_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::irq_callback),state)); } @@ -261,9 +262,8 @@ READ8_MEMBER(berzerk_state::nmi_disable_r) } -static TIMER_CALLBACK( nmi_callback ) +TIMER_CALLBACK_MEMBER(berzerk_state::nmi_callback) { - berzerk_state *state = machine.driver_data(); int nmi_number = param; UINT8 next_counter; UINT8 next_v256; @@ -271,8 +271,8 @@ static TIMER_CALLBACK( nmi_callback ) int next_nmi_number; /* pulse the NMI line if enabled */ - if (state->m_nmi_enabled) - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_nmi_enabled) + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); /* set up for next interrupt */ next_nmi_number = (nmi_number + 1) % NMIS_PER_FRAME; @@ -280,14 +280,14 @@ static TIMER_CALLBACK( nmi_callback ) next_v256 = nmi_trigger_v256s[next_nmi_number]; next_vpos = vsync_chain_counter_to_vpos(next_counter, next_v256); - state->m_nmi_timer->adjust(machine.primary_screen->time_until_pos(next_vpos), next_nmi_number); + m_nmi_timer->adjust(machine().primary_screen->time_until_pos(next_vpos), next_nmi_number); } static void create_nmi_timer(running_machine &machine) { berzerk_state *state = machine.driver_data(); - state->m_nmi_timer = machine.scheduler().timer_alloc(FUNC(nmi_callback)); + state->m_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::nmi_callback),state)); } diff --git a/src/mame/drivers/boxer.c b/src/mame/drivers/boxer.c index 802808208b4..765da82543b 100644 --- a/src/mame/drivers/boxer.c +++ b/src/mame/drivers/boxer.c @@ -50,6 +50,8 @@ public: virtual void machine_reset(); virtual void palette_init(); UINT32 screen_update_boxer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pot_interrupt); + TIMER_CALLBACK_MEMBER(periodic_callback); }; /************************************* @@ -58,24 +60,22 @@ public: * *************************************/ -static TIMER_CALLBACK( pot_interrupt ) +TIMER_CALLBACK_MEMBER(boxer_state::pot_interrupt) { - boxer_state *state = machine.driver_data(); int mask = param; - if (state->m_pot_latch & mask) - state->m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + if (m_pot_latch & mask) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); - state->m_pot_state |= mask; + m_pot_state |= mask; } -static TIMER_CALLBACK( periodic_callback ) +TIMER_CALLBACK_MEMBER(boxer_state::periodic_callback) { - boxer_state *state = machine.driver_data(); int scanline = param; - state->m_maincpu->set_input_line(0, ASSERT_LINE); + m_maincpu->set_input_line(0, ASSERT_LINE); if (scanline == 0) { @@ -85,18 +85,18 @@ static TIMER_CALLBACK( periodic_callback ) memset(mask, 0, sizeof mask); - mask[state->ioport("STICK0_X")->read()] |= 0x01; - mask[state->ioport("STICK0_Y")->read()] |= 0x02; - mask[state->ioport("PADDLE0")->read()] |= 0x04; - mask[state->ioport("STICK1_X")->read()] |= 0x08; - mask[state->ioport("STICK1_Y")->read()] |= 0x10; - mask[state->ioport("PADDLE1")->read()] |= 0x20; + mask[ioport("STICK0_X")->read()] |= 0x01; + mask[ioport("STICK0_Y")->read()] |= 0x02; + mask[ioport("PADDLE0")->read()] |= 0x04; + mask[ioport("STICK1_X")->read()] |= 0x08; + mask[ioport("STICK1_Y")->read()] |= 0x10; + mask[ioport("PADDLE1")->read()] |= 0x20; for (i = 1; i < 256; i++) if (mask[i] != 0) - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(i), FUNC(pot_interrupt), mask[i]); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(i), timer_expired_delegate(FUNC(boxer_state::pot_interrupt),this), mask[i]); - state->m_pot_state = 0; + m_pot_state = 0; } scanline += 64; @@ -104,7 +104,7 @@ static TIMER_CALLBACK( periodic_callback ) if (scanline >= 262) scanline = 0; - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(periodic_callback), scanline); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(boxer_state::periodic_callback),this), scanline); } @@ -436,7 +436,7 @@ void boxer_state::machine_start() void boxer_state::machine_reset() { - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(periodic_callback)); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(boxer_state::periodic_callback),this)); m_pot_state = 0; m_pot_latch = 0; diff --git a/src/mame/drivers/cball.c b/src/mame/drivers/cball.c index 478bb7bdb0c..31e6038d3e0 100644 --- a/src/mame/drivers/cball.c +++ b/src/mame/drivers/cball.c @@ -33,6 +33,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_cball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(interrupt_callback); }; @@ -74,19 +75,18 @@ UINT32 cball_state::screen_update_cball(screen_device &screen, bitmap_ind16 &bit } -static TIMER_CALLBACK( interrupt_callback ) +TIMER_CALLBACK_MEMBER(cball_state::interrupt_callback) { - cball_state *state = machine.driver_data(); int scanline = param; - generic_pulse_irq_line(state->m_maincpu, 0, 1); + generic_pulse_irq_line(*m_maincpu, 0, 1); scanline = scanline + 32; if (scanline >= 262) scanline = 16; - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(cball_state::interrupt_callback),this), scanline); } @@ -97,7 +97,7 @@ void cball_state::machine_start() void cball_state::machine_reset() { - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), FUNC(interrupt_callback), 16); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), timer_expired_delegate(FUNC(cball_state::interrupt_callback),this), 16); } diff --git a/src/mame/drivers/clayshoo.c b/src/mame/drivers/clayshoo.c index 3cfadf46646..be7cd10fcd4 100644 --- a/src/mame/drivers/clayshoo.c +++ b/src/mame/drivers/clayshoo.c @@ -41,6 +41,7 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_clayshoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(reset_analog_bit); }; @@ -100,10 +101,9 @@ READ8_MEMBER(clayshoo_state::input_port_r) * *************************************/ -static TIMER_CALLBACK( reset_analog_bit ) +TIMER_CALLBACK_MEMBER(clayshoo_state::reset_analog_bit) { - clayshoo_state *state = machine.driver_data(); - state->m_analog_port_val &= ~param; + m_analog_port_val &= ~param; } @@ -137,8 +137,8 @@ READ8_MEMBER(clayshoo_state::analog_r) static void create_analog_timers( running_machine &machine ) { clayshoo_state *state = machine.driver_data(); - state->m_analog_timer_1 = machine.scheduler().timer_alloc(FUNC(reset_analog_bit)); - state->m_analog_timer_2 = machine.scheduler().timer_alloc(FUNC(reset_analog_bit)); + state->m_analog_timer_1 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),state)); + state->m_analog_timer_2 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),state)); } diff --git a/src/mame/drivers/cliffhgr.c b/src/mame/drivers/cliffhgr.c index 156511feb9f..01d67336589 100644 --- a/src/mame/drivers/cliffhgr.c +++ b/src/mame/drivers/cliffhgr.c @@ -112,6 +112,7 @@ public: DECLARE_DRIVER_INIT(cliff); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(cliff_irq_callback); }; @@ -186,32 +187,31 @@ WRITE8_MEMBER(cliffhgr_state::cliff_ldwire_w) /********************************************************/ -static TIMER_CALLBACK( cliff_irq_callback ) +TIMER_CALLBACK_MEMBER(cliffhgr_state::cliff_irq_callback) { - cliffhgr_state *state = machine.driver_data(); - state->m_phillips_code = 0; + m_phillips_code = 0; switch (param) { case 17: - state->m_phillips_code = state->m_laserdisc->get_field_code(LASERDISC_CODE_LINE17, true); + m_phillips_code = m_laserdisc->get_field_code(LASERDISC_CODE_LINE17, true); param = 18; break; case 18: - state->m_phillips_code = state->m_laserdisc->get_field_code(LASERDISC_CODE_LINE18, true); + m_phillips_code = m_laserdisc->get_field_code(LASERDISC_CODE_LINE18, true); param = 17; break; } /* if we have a valid code, trigger an IRQ */ - if (state->m_phillips_code & 0x800000) + if (m_phillips_code & 0x800000) { // printf("%2d:code = %06X\n", param, phillips_code); - machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); } - state->m_irq_timer->adjust(machine.primary_screen->time_until_pos(param * 2), param); + m_irq_timer->adjust(machine().primary_screen->time_until_pos(param * 2), param); } WRITE_LINE_MEMBER(cliffhgr_state::vdp_interrupt) @@ -223,7 +223,7 @@ WRITE_LINE_MEMBER(cliffhgr_state::vdp_interrupt) void cliffhgr_state::machine_start() { - m_irq_timer = machine().scheduler().timer_alloc(FUNC(cliff_irq_callback)); + m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cliffhgr_state::cliff_irq_callback),this)); } void cliffhgr_state::machine_reset() diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c index 4e57ce312a0..ee849c108e7 100644 --- a/src/mame/drivers/crystal.c +++ b/src/mame/drivers/crystal.c @@ -193,6 +193,7 @@ public: UINT32 screen_update_crystal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_crystal(screen_device &screen, bool state); INTERRUPT_GEN_MEMBER(crystal_interrupt); + TIMER_CALLBACK_MEMBER(Timercb); }; static void IntReq( running_machine &machine, int num ) @@ -300,16 +301,15 @@ WRITE32_MEMBER(crystal_state::Banksw_w) membank("bank1")->set_base(machine().root_device().memregion("user2")->base()); } -static TIMER_CALLBACK( Timercb ) +TIMER_CALLBACK_MEMBER(crystal_state::Timercb) { - crystal_state *state = machine.driver_data(); int which = (int)(FPTR)ptr; static const int num[] = { 0, 1, 9, 10 }; - if (!(state->m_Timerctrl[which] & 2)) - state->m_Timerctrl[which] &= ~1; + if (!(m_Timerctrl[which] & 2)) + m_Timerctrl[which] &= ~1; - IntReq(machine, num[which]); + IntReq(machine(), num[which]); } INLINE void Timer_w( address_space &space, int which, UINT32 data, UINT32 mem_mask ) @@ -589,7 +589,7 @@ void crystal_state::machine_start() machine().device("maincpu")->execute().set_irq_acknowledge_callback(icallback); for (i = 0; i < 4; i++) - m_Timer[i] = machine().scheduler().timer_alloc(FUNC(Timercb), (void*)(FPTR)i); + m_Timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(crystal_state::Timercb),this), (void*)(FPTR)i); PatchReset(machine()); diff --git a/src/mame/drivers/cubeqst.c b/src/mame/drivers/cubeqst.c index d237bd8ad77..405b738b83f 100644 --- a/src/mame/drivers/cubeqst.c +++ b/src/mame/drivers/cubeqst.c @@ -58,6 +58,7 @@ public: virtual void palette_init(); UINT32 screen_update_cubeqst(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank); + TIMER_CALLBACK_MEMBER(delayed_bank_swap); }; @@ -256,19 +257,20 @@ WRITE16_MEMBER(cubeqst_state::control_w) * *************************************/ -static TIMER_CALLBACK( delayed_bank_swap ) +TIMER_CALLBACK_MEMBER(cubeqst_state::delayed_bank_swap) { - cubeqcpu_swap_line_banks(machine.device("line_cpu")); + cubeqcpu_swap_line_banks(machine().device("line_cpu")); /* TODO: This is a little dubious */ - cubeqcpu_clear_stack(machine.device("line_cpu")); + cubeqcpu_clear_stack(machine().device("line_cpu")); } static void swap_linecpu_banks(running_machine &machine) { + cubeqst_state *state = machine.driver_data(); /* Best sync up before we switch banks around */ - machine.scheduler().synchronize(FUNC(delayed_bank_swap)); + machine.scheduler().synchronize(timer_expired_delegate(FUNC(cubeqst_state::delayed_bank_swap),state)); } diff --git a/src/mame/drivers/destroyr.c b/src/mame/drivers/destroyr.c index 6f0d27ea2ee..f63bccda99f 100644 --- a/src/mame/drivers/destroyr.c +++ b/src/mame/drivers/destroyr.c @@ -52,6 +52,8 @@ public: virtual void machine_reset(); virtual void palette_init(); UINT32 screen_update_destroyr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(destroyr_dial_callback); + TIMER_CALLBACK_MEMBER(destroyr_frame_callback); }; @@ -121,9 +123,8 @@ UINT32 destroyr_state::screen_update_destroyr(screen_device &screen, bitmap_ind1 return 0; } -static TIMER_CALLBACK( destroyr_dial_callback ) +TIMER_CALLBACK_MEMBER(destroyr_state::destroyr_dial_callback) { - destroyr_state *state = machine.driver_data(); int dial = param; /* Analog inputs come from the player's depth control potentiometer. @@ -133,31 +134,30 @@ static TIMER_CALLBACK( destroyr_dial_callback ) computer then reads the VSYNC data functions to tell where the cursor should be located. */ - state->m_potsense[dial] = 1; + m_potsense[dial] = 1; - if (state->m_potmask[dial]) + if (m_potmask[dial]) { - state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } -static TIMER_CALLBACK( destroyr_frame_callback ) +TIMER_CALLBACK_MEMBER(destroyr_state::destroyr_frame_callback) { - destroyr_state *state = machine.driver_data(); - state->m_potsense[0] = 0; - state->m_potsense[1] = 0; + m_potsense[0] = 0; + m_potsense[1] = 0; /* PCB supports two dials, but cab has only got one */ - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(state->ioport("PADDLE")->read()), FUNC(destroyr_dial_callback)); - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(0), FUNC(destroyr_frame_callback)); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(ioport("PADDLE")->read()), timer_expired_delegate(FUNC(destroyr_state::destroyr_dial_callback),this)); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(destroyr_state::destroyr_frame_callback),this)); } void destroyr_state::machine_reset() { - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(destroyr_frame_callback)); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(destroyr_state::destroyr_frame_callback),this)); m_cursor = 0; m_wavemod = 0; diff --git a/src/mame/drivers/enigma2.c b/src/mame/drivers/enigma2.c index 07b07cb2db1..86912af51a3 100644 --- a/src/mame/drivers/enigma2.c +++ b/src/mame/drivers/enigma2.c @@ -91,6 +91,8 @@ public: virtual void machine_reset(); UINT32 screen_update_enigma2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_enigma2a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(interrupt_clear_callback); + TIMER_CALLBACK_MEMBER(interrupt_assert_callback); }; @@ -113,24 +115,22 @@ INLINE int vysnc_chain_counter_to_vpos( UINT16 counter ) } -static TIMER_CALLBACK( interrupt_clear_callback ) +TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_clear_callback) { - enigma2_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } -static TIMER_CALLBACK( interrupt_assert_callback ) +TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_assert_callback) { - enigma2_state *state = machine.driver_data(); UINT16 next_counter; int next_vpos; /* compute vector and set the interrupt line */ - int vpos = machine.primary_screen->vpos(); + int vpos = machine().primary_screen->vpos(); UINT16 counter = vpos_to_vysnc_chain_counter(vpos); UINT8 vector = 0xc7 | ((counter & 0x80) >> 3) | ((~counter & 0x80) >> 4); - state->m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector); + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector); /* set up for next interrupt */ if (counter == INT_TRIGGER_COUNT_1) @@ -139,16 +139,16 @@ static TIMER_CALLBACK( interrupt_assert_callback ) next_counter = INT_TRIGGER_COUNT_1; next_vpos = vysnc_chain_counter_to_vpos(next_counter); - state->m_interrupt_assert_timer->adjust(machine.primary_screen->time_until_pos(next_vpos)); - state->m_interrupt_clear_timer->adjust(machine.primary_screen->time_until_pos(vpos + 1)); + m_interrupt_assert_timer->adjust(machine().primary_screen->time_until_pos(next_vpos)); + m_interrupt_clear_timer->adjust(machine().primary_screen->time_until_pos(vpos + 1)); } static void create_interrupt_timers( running_machine &machine ) { enigma2_state *state = machine.driver_data(); - state->m_interrupt_clear_timer = machine.scheduler().timer_alloc(FUNC(interrupt_clear_callback)); - state->m_interrupt_assert_timer = machine.scheduler().timer_alloc(FUNC(interrupt_assert_callback)); + state->m_interrupt_clear_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_clear_callback),state)); + state->m_interrupt_assert_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_assert_callback),state)); } diff --git a/src/mame/drivers/esh.c b/src/mame/drivers/esh.c index e1b7cc45338..e758c85b86d 100644 --- a/src/mame/drivers/esh.c +++ b/src/mame/drivers/esh.c @@ -51,6 +51,7 @@ public: virtual void palette_init(); UINT32 screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_callback_esh); + TIMER_CALLBACK_MEMBER(irq_stop); }; @@ -279,16 +280,16 @@ static GFXDECODE_START( esh ) GFXDECODE_ENTRY("gfx1", 0, esh_gfx_layout, 0x0, 0x20) GFXDECODE_END -static TIMER_CALLBACK( irq_stop ) +TIMER_CALLBACK_MEMBER(esh_state::irq_stop) { - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } INTERRUPT_GEN_MEMBER(esh_state::vblank_callback_esh) { // IRQ device.execute().set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_usec(50), FUNC(irq_stop)); + machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(esh_state::irq_stop),this)); } void esh_state::machine_start() diff --git a/src/mame/drivers/famibox.c b/src/mame/drivers/famibox.c index 29b25e84664..49b04dd2220 100644 --- a/src/mame/drivers/famibox.c +++ b/src/mame/drivers/famibox.c @@ -110,6 +110,8 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_famibox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(famicombox_attract_timer_callback); + TIMER_CALLBACK_MEMBER(famicombox_gameplay_timer_callback); }; /****************************************************** @@ -282,32 +284,30 @@ static void famicombox_reset(running_machine &machine) machine.device("maincpu")->reset(); } -static TIMER_CALLBACK(famicombox_attract_timer_callback) +TIMER_CALLBACK_MEMBER(famibox_state::famicombox_attract_timer_callback) { - famibox_state *state = machine.driver_data(); - state->m_attract_timer->adjust(attotime::never, 0, attotime::never); - if ( BIT(state->m_exception_mask,1) ) + m_attract_timer->adjust(attotime::never, 0, attotime::never); + if ( BIT(m_exception_mask,1) ) { - state->m_exception_cause &= ~0x02; - famicombox_reset(machine); + m_exception_cause &= ~0x02; + famicombox_reset(machine()); } } -static TIMER_CALLBACK(famicombox_gameplay_timer_callback) +TIMER_CALLBACK_MEMBER(famibox_state::famicombox_gameplay_timer_callback) { - famibox_state *state = machine.driver_data(); - if (state->m_coins > 0) - state->m_coins--; + if (m_coins > 0) + m_coins--; - if (state->m_coins == 0) + if (m_coins == 0) { - state->m_gameplay_timer->adjust(attotime::never, 0, attotime::never); - if ( BIT(state->m_exception_mask,4) ) + m_gameplay_timer->adjust(attotime::never, 0, attotime::never); + if ( BIT(m_exception_mask,4) ) { - state->m_exception_cause &= ~0x10; - famicombox_reset(machine); + m_exception_cause &= ~0x10; + famicombox_reset(machine()); } } } @@ -570,8 +570,8 @@ void famibox_state::machine_start() famicombox_bankswitch(machine(), 0); - m_attract_timer = machine().scheduler().timer_alloc(FUNC(famicombox_attract_timer_callback)); - m_gameplay_timer = machine().scheduler().timer_alloc(FUNC(famicombox_gameplay_timer_callback)); + m_attract_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_attract_timer_callback),this)); + m_gameplay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_gameplay_timer_callback),this)); m_exception_cause = 0xff; m_exception_mask = 0; m_attract_timer_period = 0; diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 6556e5d7801..c3096aed7da 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -218,6 +218,7 @@ public: DECLARE_READ32_MEMBER(ppc_spu_share_r); DECLARE_WRITE32_MEMBER(ppc_spu_share_w); DECLARE_READ16_MEMBER(spu_unk_r); + TIMER_CALLBACK_MEMBER(keyboard_timer_callback); }; @@ -1475,9 +1476,8 @@ static const int keyboard_notes[24] = 0x53, // B2 }; -static TIMER_CALLBACK( keyboard_timer_callback ) +TIMER_CALLBACK_MEMBER(firebeat_state::keyboard_timer_callback) { - firebeat_state *state = machine.driver_data(); static const int kb_uart_channel[2] = { 1, 0 }; static const char *const keynames[] = { "KEYBOARD_P1", "KEYBOARD_P2" }; int keyboard; @@ -1485,38 +1485,38 @@ static TIMER_CALLBACK( keyboard_timer_callback ) for (keyboard=0; keyboard < 2; keyboard++) { - UINT32 kbstate = machine.root_device().ioport(keynames[keyboard])->read(); + UINT32 kbstate = machine().root_device().ioport(keynames[keyboard])->read(); int uart_channel = kb_uart_channel[keyboard]; - if (kbstate != state->m_keyboard_state[keyboard]) + if (kbstate != m_keyboard_state[keyboard]) { for (i=0; i < 24; i++) { int kbnote = keyboard_notes[i]; - if ((state->m_keyboard_state[keyboard] & (1 << i)) != 0 && (kbstate & (1 << i)) == 0) + if ((m_keyboard_state[keyboard] & (1 << i)) != 0 && (kbstate & (1 << i)) == 0) { // key was on, now off -> send Note Off message - pc16552d_rx_data(machine, 1, uart_channel, 0x80); - pc16552d_rx_data(machine, 1, uart_channel, kbnote); - pc16552d_rx_data(machine, 1, uart_channel, 0x7f); + pc16552d_rx_data(machine(), 1, uart_channel, 0x80); + pc16552d_rx_data(machine(), 1, uart_channel, kbnote); + pc16552d_rx_data(machine(), 1, uart_channel, 0x7f); } - else if ((state->m_keyboard_state[keyboard] & (1 << i)) == 0 && (kbstate & (1 << i)) != 0) + else if ((m_keyboard_state[keyboard] & (1 << i)) == 0 && (kbstate & (1 << i)) != 0) { // key was off, now on -> send Note On message - pc16552d_rx_data(machine, 1, uart_channel, 0x90); - pc16552d_rx_data(machine, 1, uart_channel, kbnote); - pc16552d_rx_data(machine, 1, uart_channel, 0x7f); + pc16552d_rx_data(machine(), 1, uart_channel, 0x90); + pc16552d_rx_data(machine(), 1, uart_channel, kbnote); + pc16552d_rx_data(machine(), 1, uart_channel, 0x7f); } } } else { // no messages, send Active Sense message instead - pc16552d_rx_data(machine, 1, uart_channel, 0xfe); + pc16552d_rx_data(machine(), 1, uart_channel, 0xfe); } - state->m_keyboard_state[keyboard] = kbstate; + m_keyboard_state[keyboard] = kbstate; } } @@ -2287,7 +2287,7 @@ static void init_keyboard(running_machine &machine) { firebeat_state *state = machine.driver_data(); // set keyboard timer - state->m_keyboard_timer = machine.scheduler().timer_alloc(FUNC(keyboard_timer_callback)); + state->m_keyboard_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(firebeat_state::keyboard_timer_callback),state)); state->m_keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); } diff --git a/src/mame/drivers/flyball.c b/src/mame/drivers/flyball.c index 9540a9b4a1a..554e34fdd56 100644 --- a/src/mame/drivers/flyball.c +++ b/src/mame/drivers/flyball.c @@ -61,6 +61,8 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_flyball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(flyball_joystick_callback); + TIMER_CALLBACK_MEMBER(flyball_quarter_callback); }; @@ -129,42 +131,40 @@ UINT32 flyball_state::screen_update_flyball(screen_device &screen, bitmap_ind16 } -static TIMER_CALLBACK( flyball_joystick_callback ) +TIMER_CALLBACK_MEMBER(flyball_state::flyball_joystick_callback) { - flyball_state *state = machine.driver_data(); int potsense = param; - if (potsense & ~state->m_potmask) - generic_pulse_irq_line(state->m_maincpu, 0, 1); + if (potsense & ~m_potmask) + generic_pulse_irq_line(*m_maincpu, 0, 1); - state->m_potsense |= potsense; + m_potsense |= potsense; } -static TIMER_CALLBACK( flyball_quarter_callback ) +TIMER_CALLBACK_MEMBER(flyball_state::flyball_quarter_callback) { - flyball_state *state = machine.driver_data(); int scanline = param; int potsense[64], i; memset(potsense, 0, sizeof potsense); - potsense[state->ioport("STICK1_Y")->read()] |= 1; - potsense[state->ioport("STICK1_X")->read()] |= 2; - potsense[state->ioport("STICK0_Y")->read()] |= 4; - potsense[state->ioport("STICK0_X")->read()] |= 8; + potsense[ioport("STICK1_Y")->read()] |= 1; + potsense[ioport("STICK1_X")->read()] |= 2; + potsense[ioport("STICK0_Y")->read()] |= 4; + potsense[ioport("STICK0_X")->read()] |= 8; for (i = 0; i < 64; i++) if (potsense[i] != 0) - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline + i), FUNC(flyball_joystick_callback), potsense[i]); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline + i), timer_expired_delegate(FUNC(flyball_state::flyball_joystick_callback),this), potsense[i]); scanline += 0x40; scanline &= 0xff; - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(flyball_quarter_callback), scanline); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(flyball_state::flyball_quarter_callback),this), scanline); - state->m_potsense = 0; - state->m_potmask = 0; + m_potsense = 0; + m_potmask = 0; } @@ -398,7 +398,7 @@ void flyball_state::machine_reset() machine().device("maincpu")->reset(); - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(flyball_quarter_callback)); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(flyball_state::flyball_quarter_callback),this)); m_pitcher_vert = 0; m_pitcher_horz = 0; diff --git a/src/mame/drivers/gpworld.c b/src/mame/drivers/gpworld.c index 61f79def776..1267dc48b3b 100644 --- a/src/mame/drivers/gpworld.c +++ b/src/mame/drivers/gpworld.c @@ -73,6 +73,7 @@ public: virtual void machine_start(); UINT32 screen_update_gpworld(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_callback_gpworld); + TIMER_CALLBACK_MEMBER(irq_stop); }; @@ -425,9 +426,9 @@ static INPUT_PORTS_START( gpworld ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END -static TIMER_CALLBACK( irq_stop ) +TIMER_CALLBACK_MEMBER(gpworld_state::irq_stop) { - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } INTERRUPT_GEN_MEMBER(gpworld_state::vblank_callback_gpworld) @@ -442,7 +443,7 @@ INTERRUPT_GEN_MEMBER(gpworld_state::vblank_callback_gpworld) /* The time the IRQ line stays high is set just long enough to happen after the NMI - hacky? */ device.execute().set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_usec(100), FUNC(irq_stop)); + machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(gpworld_state::irq_stop),this)); } static const gfx_layout gpworld_tile_layout = diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c index 171f213dfe0..e1322b8b9a4 100644 --- a/src/mame/drivers/gticlub.c +++ b/src/mame/drivers/gticlub.c @@ -264,6 +264,7 @@ public: DECLARE_MACHINE_RESET(gticlub); DECLARE_MACHINE_RESET(hangplt); INTERRUPT_GEN_MEMBER(gticlub_vblank); + TIMER_CALLBACK_MEMBER(irq_off); }; @@ -707,17 +708,18 @@ static const sharc_config sharc_cfg = }; -static TIMER_CALLBACK( irq_off ) +TIMER_CALLBACK_MEMBER(gticlub_state::irq_off) { - machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); + machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); } static void sound_irq_callback( running_machine &machine, int irq ) { + gticlub_state *state = machine.driver_data(); int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2; machine.device("audiocpu")->execute().set_input_line(line, ASSERT_LINE); - machine.scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off), line); + machine.scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(gticlub_state::irq_off),state), line); } static const k056800_interface gticlub_k056800_interface = diff --git a/src/mame/drivers/guab.c b/src/mame/drivers/guab.c index c33c95a1931..09d50e35a5d 100644 --- a/src/mame/drivers/guab.c +++ b/src/mame/drivers/guab.c @@ -99,6 +99,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_guab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(fdc_data_callback); }; @@ -324,11 +325,10 @@ enum wd1770_status }; -static TIMER_CALLBACK( fdc_data_callback ) +TIMER_CALLBACK_MEMBER(guab_state::fdc_data_callback) { - guab_state *state = machine.driver_data(); - struct wd1770 &fdc = state->m_fdc; - UINT8* disk = (UINT8*)state->memregion("user1")->base(); + struct wd1770 &fdc = m_fdc; + UINT8* disk = (UINT8*)memregion("user1")->base(); int more_data = 0; /* @@ -374,7 +374,7 @@ static TIMER_CALLBACK( fdc_data_callback ) if (more_data) { - state->m_fdc_timer->adjust(attotime::from_usec(USEC_DELAY)); + m_fdc_timer->adjust(attotime::from_usec(USEC_DELAY)); } else { @@ -384,7 +384,7 @@ static TIMER_CALLBACK( fdc_data_callback ) } fdc.status |= DATA_REQUEST; - machine.device("maincpu")->execute().set_input_line(INT_FLOPPYCTRL, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(INT_FLOPPYCTRL, ASSERT_LINE); } @@ -805,7 +805,7 @@ static const sn76496_config psg_intf = void guab_state::machine_start() { - m_fdc_timer = machine().scheduler().timer_alloc(FUNC(fdc_data_callback)); + m_fdc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(guab_state::fdc_data_callback),this)); } void guab_state::machine_reset() diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c index 637611ad49d..7afa64ed15c 100644 --- a/src/mame/drivers/halleys.c +++ b/src/mame/drivers/halleys.c @@ -266,6 +266,7 @@ public: virtual void palette_init(); UINT32 screen_update_halleys(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_benberob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(blitter_reset); }; @@ -1040,10 +1041,9 @@ READ8_MEMBER(halleys_state::blitter_r) } -static TIMER_CALLBACK( blitter_reset ) +TIMER_CALLBACK_MEMBER(halleys_state::blitter_reset) { - halleys_state *state = machine.driver_data(); - state->m_blitter_busy = 0; + m_blitter_busy = 0; } @@ -2238,7 +2238,7 @@ DRIVER_INIT_MEMBER(halleys_state,benberob) init_common(machine()); - m_blitter_reset_timer = machine().scheduler().timer_alloc(FUNC(blitter_reset)); + m_blitter_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(halleys_state::blitter_reset),this)); } diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c index c3e53be1926..ac5c26ebe47 100644 --- a/src/mame/drivers/hornet.c +++ b/src/mame/drivers/hornet.c @@ -371,6 +371,7 @@ public: DECLARE_MACHINE_RESET(hornet_2board); UINT32 screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_hornet_2board(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(irq_off); }; @@ -880,7 +881,7 @@ static const sharc_config sharc_cfg = NMI: SCI */ -static TIMER_CALLBACK( irq_off ); + void hornet_state::machine_start() { @@ -898,7 +899,7 @@ void hornet_state::machine_start() state_save_register_global_pointer(machine(), m_jvs_sdata, 1024); state_save_register_global(machine(), m_jvs_sdata_ptr); - m_sound_irq_timer = machine().scheduler().timer_alloc(FUNC(irq_off)); + m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::irq_off),this)); } void hornet_state::machine_reset() @@ -933,9 +934,9 @@ static const adc12138_interface hornet_adc_interface = { adc12138_input_callback }; -static TIMER_CALLBACK( irq_off ) +TIMER_CALLBACK_MEMBER(hornet_state::irq_off) { - machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); + machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); } static void sound_irq_callback( running_machine &machine, int irq ) diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c index 2f3cf3f1a5e..d0d9a27fa78 100644 --- a/src/mame/drivers/jangou.c +++ b/src/mame/drivers/jangou.c @@ -90,6 +90,7 @@ public: DECLARE_MACHINE_START(common); DECLARE_MACHINE_RESET(common); UINT32 screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); }; @@ -328,17 +329,16 @@ WRITE8_MEMBER(jangou_state::cvsd_w) m_cvsd_shiftreg = data; } -static TIMER_CALLBACK( cvsd_bit_timer_callback ) +TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback) { - jangou_state *state = machine.driver_data(); /* Data is shifted out at the MSB */ - hc55516_digit_w(state->m_cvsd, (state->m_cvsd_shiftreg >> 7) & 1); - state->m_cvsd_shiftreg <<= 1; + hc55516_digit_w(m_cvsd, (m_cvsd_shiftreg >> 7) & 1); + m_cvsd_shiftreg <<= 1; /* Trigger an IRQ for every 8 shifted bits */ - if ((++state->m_cvsd_shift_cnt & 7) == 0) - state->m_cpu_1->execute().set_input_line(0, HOLD_LINE); + if ((++m_cvsd_shift_cnt & 7) == 0) + m_cpu_1->execute().set_input_line(0, HOLD_LINE); } @@ -907,7 +907,7 @@ static SOUND_START( jangou ) jangou_state *state = machine.driver_data(); /* Create a timer to feed the CVSD DAC with sample bits */ - state->m_cvsd_bit_timer = machine.scheduler().timer_alloc(FUNC(cvsd_bit_timer_callback)); + state->m_cvsd_bit_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(jangou_state::cvsd_bit_timer_callback),state)); state->m_cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024)); } diff --git a/src/mame/drivers/jpmsys5.c b/src/mame/drivers/jpmsys5.c index 11f0c3f0605..3e50915bf9c 100644 --- a/src/mame/drivers/jpmsys5.c +++ b/src/mame/drivers/jpmsys5.c @@ -107,6 +107,7 @@ public: DECLARE_MACHINE_START(jpmsys5); DECLARE_MACHINE_RESET(jpmsys5); UINT32 screen_update_jpmsys5v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(touch_cb); }; @@ -409,10 +410,9 @@ ADDRESS_MAP_END *************************************/ /* Serial bit transmission callback */ -static TIMER_CALLBACK( touch_cb ) +TIMER_CALLBACK_MEMBER(jpmsys5_state::touch_cb) { - jpmsys5_state *state = machine.driver_data(); - switch (state->m_touch_state) + switch (m_touch_state) { case IDLE: { @@ -420,38 +420,38 @@ static TIMER_CALLBACK( touch_cb ) } case START: { - state->m_touch_shift_cnt = 0; - state->m_a2_data_in = 0; - state->m_touch_state = DATA; + m_touch_shift_cnt = 0; + m_a2_data_in = 0; + m_touch_state = DATA; break; } case DATA: { - state->m_a2_data_in = (state->m_touch_data[state->m_touch_data_count] >> (state->m_touch_shift_cnt)) & 1; + m_a2_data_in = (m_touch_data[m_touch_data_count] >> (m_touch_shift_cnt)) & 1; - if (++state->m_touch_shift_cnt == 8) - state->m_touch_state = STOP1; + if (++m_touch_shift_cnt == 8) + m_touch_state = STOP1; break; } case STOP1: { - state->m_a2_data_in = 1; - state->m_touch_state = STOP2; + m_a2_data_in = 1; + m_touch_state = STOP2; break; } case STOP2: { - state->m_a2_data_in = 1; + m_a2_data_in = 1; - if (++state->m_touch_data_count == 3) + if (++m_touch_data_count == 3) { - state->m_touch_timer->reset(); - state->m_touch_state = IDLE; + m_touch_timer->reset(); + m_touch_state = IDLE; } else { - state->m_touch_state = START; + m_touch_state = START; } break; @@ -690,7 +690,7 @@ static ACIA6850_INTERFACE( acia2_if ) MACHINE_START_MEMBER(jpmsys5_state,jpmsys5v) { membank("bank1")->set_base(memregion("maincpu")->base()+0x20000); - m_touch_timer = machine().scheduler().timer_alloc(FUNC(touch_cb)); + m_touch_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jpmsys5_state::touch_cb),this)); } MACHINE_RESET_MEMBER(jpmsys5_state,jpmsys5v) diff --git a/src/mame/drivers/kinst.c b/src/mame/drivers/kinst.c index 8b9a86c4914..a97e9264e7c 100644 --- a/src/mame/drivers/kinst.c +++ b/src/mame/drivers/kinst.c @@ -164,6 +164,7 @@ public: virtual void machine_reset(); UINT32 screen_update_kinst(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(irq0_start); + TIMER_CALLBACK_MEMBER(irq0_stop); }; @@ -276,16 +277,16 @@ UINT32 kinst_state::screen_update_kinst(screen_device &screen, bitmap_ind16 &bit * *************************************/ -static TIMER_CALLBACK( irq0_stop ) +TIMER_CALLBACK_MEMBER(kinst_state::irq0_stop) { - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } INTERRUPT_GEN_MEMBER(kinst_state::irq0_start) { device.execute().set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_usec(50), FUNC(irq0_stop)); + machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(kinst_state::irq0_stop),this)); } diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 515cdad733b..2297d26e425 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -583,6 +583,7 @@ public: DECLARE_DRIVER_INIT(ddrdigital); DECLARE_DRIVER_INIT(konami573); DECLARE_MACHINE_RESET(konami573); + TIMER_CALLBACK_MEMBER(atapi_xfer_end); }; INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) @@ -693,61 +694,60 @@ WRITE32_MEMBER(ksys573_state::control_w) } } -static TIMER_CALLBACK( atapi_xfer_end ) +TIMER_CALLBACK_MEMBER(ksys573_state::atapi_xfer_end) { - ksys573_state *state = machine.driver_data(); - UINT32 *p_n_psxram = state->m_p_n_psxram; - UINT8 *atapi_regs = state->m_atapi_regs; - int i, n_this; + UINT32 *p_n_psxram = m_p_n_psxram; + UINT8 *atapi_regs = m_atapi_regs; + int i, n_state; UINT8 sector_buffer[ 4096 ]; - state->m_atapi_timer->adjust(attotime::never); + m_atapi_timer->adjust(attotime::never); -// verboselog( machine, 2, "atapi_xfer_end( %d ) atapi_xferlen = %d, atapi_xfermod=%d\n", x, atapi_xfermod, atapi_xferlen ); +// verboselog( machine(), 2, "atapi_xfer_end( %d ) atapi_xferlen = %d, atapi_xfermod=%d\n", x, atapi_xfermod, atapi_xferlen ); // mame_printf_debug("ATAPI: xfer_end. xferlen = %d, atapi_xfermod = %d\n", atapi_xferlen, atapi_xfermod); - while( state->m_atapi_xferlen > 0 ) + while( m_atapi_xferlen > 0 ) { // get a sector from the SCSI device - state->m_inserted_cdrom->ReadData( sector_buffer, 2048 ); + m_inserted_cdrom->ReadData( sector_buffer, 2048 ); - state->m_atapi_xferlen -= 2048; + m_atapi_xferlen -= 2048; i = 0; - n_this = 2048 / 4; - while( n_this > 0 ) + n_state = 2048 / 4; + while( n_state > 0 ) { - p_n_psxram[ state->m_atapi_xferbase / 4 ] = + p_n_psxram[ m_atapi_xferbase / 4 ] = ( sector_buffer[ i + 0 ] << 0 ) | ( sector_buffer[ i + 1 ] << 8 ) | ( sector_buffer[ i + 2 ] << 16 ) | ( sector_buffer[ i + 3 ] << 24 ); - state->m_atapi_xferbase += 4; + m_atapi_xferbase += 4; i += 4; - n_this--; + n_state--; } } - if (state->m_atapi_xfermod > MAX_TRANSFER_SIZE) + if (m_atapi_xfermod > MAX_TRANSFER_SIZE) { - state->m_atapi_xferlen = MAX_TRANSFER_SIZE; - state->m_atapi_xfermod = state->m_atapi_xfermod - MAX_TRANSFER_SIZE; + m_atapi_xferlen = MAX_TRANSFER_SIZE; + m_atapi_xfermod = m_atapi_xfermod - MAX_TRANSFER_SIZE; } else { - state->m_atapi_xferlen = state->m_atapi_xfermod; - state->m_atapi_xfermod = 0; + m_atapi_xferlen = m_atapi_xfermod; + m_atapi_xfermod = 0; } - if (state->m_atapi_xferlen > 0) + if (m_atapi_xferlen > 0) { //mame_printf_debug("ATAPI: starting next piece of multi-part transfer\n"); - atapi_regs[ATAPI_REG_COUNTLOW] = state->m_atapi_xferlen & 0xff; - atapi_regs[ATAPI_REG_COUNTHIGH] = (state->m_atapi_xferlen>>8)&0xff; + atapi_regs[ATAPI_REG_COUNTLOW] = m_atapi_xferlen & 0xff; + atapi_regs[ATAPI_REG_COUNTHIGH] = (m_atapi_xferlen>>8)&0xff; - state->m_atapi_timer->adjust(machine.device("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (state->m_atapi_xferlen/2048)))); + m_atapi_timer->adjust(machine().device("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (m_atapi_xferlen/2048)))); } else { @@ -756,9 +756,9 @@ static TIMER_CALLBACK( atapi_xfer_end ) atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO | ATAPI_INTREASON_COMMAND; } - psx_irq_set(machine, 0x400); + psx_irq_set(machine(), 0x400); - verboselog( machine, 2, "atapi_xfer_end: %d %d\n", state->m_atapi_xferlen, state->m_atapi_xfermod ); + verboselog( machine(), 2, "atapi_xfer_end: %d %d\n", m_atapi_xferlen, m_atapi_xfermod ); } READ32_MEMBER(ksys573_state::atapi_r) @@ -1131,7 +1131,7 @@ static void atapi_init(running_machine &machine) state->m_atapi_data_len = 0; state->m_atapi_cdata_wait = 0; - state->m_atapi_timer = machine.scheduler().timer_alloc(FUNC(atapi_xfer_end)); + state->m_atapi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ksys573_state::atapi_xfer_end),state)); state->m_atapi_timer->adjust(attotime::never); state->m_available_cdroms[ 0 ] = machine.device( ":cdrom0" ); diff --git a/src/mame/drivers/lgp.c b/src/mame/drivers/lgp.c index 77809a49946..f1ee3a3e0ff 100644 --- a/src/mame/drivers/lgp.c +++ b/src/mame/drivers/lgp.c @@ -88,6 +88,7 @@ public: virtual void machine_start(); UINT32 screen_update_lgp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_callback_lgp); + TIMER_CALLBACK_MEMBER(irq_stop); }; @@ -332,9 +333,9 @@ static GFXDECODE_START( lgp ) GFXDECODE_ENTRY("gfx4", 0, lgp_gfx_layout_16x32, 0x0, 0x100) GFXDECODE_END -static TIMER_CALLBACK( irq_stop ) +TIMER_CALLBACK_MEMBER(lgp_state::irq_stop) { - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } INTERRUPT_GEN_MEMBER(lgp_state::vblank_callback_lgp) @@ -350,7 +351,7 @@ INTERRUPT_GEN_MEMBER(lgp_state::vblank_callback_lgp) void lgp_state::machine_start() { - m_irq_timer = machine().scheduler().timer_alloc(FUNC(irq_stop)); + m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lgp_state::irq_stop),this)); } diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index 25d0ea68d2f..234420172c4 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -146,6 +146,9 @@ public: UINT32 screen_update_mazerbla(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_test_vcu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(sound_interrupt); + TIMER_CALLBACK_MEMBER(deferred_ls670_0_w); + TIMER_CALLBACK_MEMBER(deferred_ls670_1_w); + TIMER_CALLBACK_MEMBER(delayed_sound_w); }; @@ -790,19 +793,18 @@ READ8_MEMBER(mazerbla_state::ls670_0_r) return m_ls670_0[offset]; } -static TIMER_CALLBACK( deferred_ls670_0_w ) +TIMER_CALLBACK_MEMBER(mazerbla_state::deferred_ls670_0_w) { - mazerbla_state *state = machine.driver_data(); int offset = (param >> 8) & 255; int data = param & 255; - state->m_ls670_0[offset] = data; + m_ls670_0[offset] = data; } WRITE8_MEMBER(mazerbla_state::ls670_0_w) { /* do this on a timer to let the CPUs synchronize */ - machine().scheduler().synchronize(FUNC(deferred_ls670_0_w), (offset << 8) | data); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(mazerbla_state::deferred_ls670_0_w),this), (offset << 8) | data); } READ8_MEMBER(mazerbla_state::ls670_1_r) @@ -814,19 +816,18 @@ READ8_MEMBER(mazerbla_state::ls670_1_r) return m_ls670_1[offset]; } -static TIMER_CALLBACK( deferred_ls670_1_w ) +TIMER_CALLBACK_MEMBER(mazerbla_state::deferred_ls670_1_w) { - mazerbla_state *state = machine.driver_data(); int offset = (param >> 8) & 255; int data = param & 255; - state->m_ls670_1[offset] = data; + m_ls670_1[offset] = data; } WRITE8_MEMBER(mazerbla_state::ls670_1_w) { /* do this on a timer to let the CPUs synchronize */ - machine().scheduler().synchronize(FUNC(deferred_ls670_1_w), (offset << 8) | data); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(mazerbla_state::deferred_ls670_1_w),this), (offset << 8) | data); } @@ -955,18 +956,17 @@ READ8_MEMBER(mazerbla_state::soundcommand_r) return m_soundlatch; } -static TIMER_CALLBACK( delayed_sound_w ) +TIMER_CALLBACK_MEMBER(mazerbla_state::delayed_sound_w) { - mazerbla_state *state = machine.driver_data(); - state->m_soundlatch = param; + m_soundlatch = param; /* cause NMI on sound CPU */ - state->m_subcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_subcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } WRITE8_MEMBER(mazerbla_state::main_sound_w) { - machine().scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(mazerbla_state::delayed_sound_w),this), data & 0xff); } WRITE8_MEMBER(mazerbla_state::sound_int_clear_w) diff --git a/src/mame/drivers/mgolf.c b/src/mame/drivers/mgolf.c index 64c6388d718..f43c52e5e3e 100644 --- a/src/mame/drivers/mgolf.c +++ b/src/mame/drivers/mgolf.c @@ -39,6 +39,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_mgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(interrupt_callback); }; @@ -113,21 +114,20 @@ static void update_plunger( running_machine &machine ) } -static TIMER_CALLBACK( interrupt_callback ) +TIMER_CALLBACK_MEMBER(mgolf_state::interrupt_callback) { - mgolf_state *state = machine.driver_data(); int scanline = param; - update_plunger(machine); + update_plunger(machine()); - generic_pulse_irq_line(state->m_maincpu, 0, 1); + generic_pulse_irq_line(*m_maincpu, 0, 1); scanline = scanline + 32; if (scanline >= 262) scanline = 16; - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(mgolf_state::interrupt_callback),this), scanline); } @@ -316,7 +316,7 @@ void mgolf_state::machine_start() void mgolf_state::machine_reset() { - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), FUNC(interrupt_callback), 16); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), timer_expired_delegate(FUNC(mgolf_state::interrupt_callback),this), 16); m_mask = 0; m_prev = 0; diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index 2a22d2a65d1..cfb94113c4b 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -382,6 +382,8 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(clock_irq); + TIMER_CALLBACK_MEMBER(adjust_cpu_speed); }; @@ -436,20 +438,19 @@ INLINE void schedule_next_irq(running_machine &machine, int curv) } -static TIMER_CALLBACK( clock_irq ) +TIMER_CALLBACK_MEMBER(missile_state::clock_irq) { - missile_state *state = machine.driver_data(); int curv = param; /* assert the IRQ if not already asserted */ - state->m_irq_state = (~curv >> 5) & 1; - state->m_maincpu->set_input_line(0, state->m_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_irq_state = (~curv >> 5) & 1; + m_maincpu->set_input_line(0, m_irq_state ? ASSERT_LINE : CLEAR_LINE); /* force an update while we're here */ - machine.primary_screen->update_partial(v_to_scanline(state, curv)); + machine().primary_screen->update_partial(v_to_scanline(this, curv)); /* find the next edge */ - schedule_next_irq(machine, curv); + schedule_next_irq(machine(), curv); } @@ -468,20 +469,19 @@ CUSTOM_INPUT_MEMBER(missile_state::get_vblank) * *************************************/ -static TIMER_CALLBACK( adjust_cpu_speed ) +TIMER_CALLBACK_MEMBER(missile_state::adjust_cpu_speed) { - missile_state *state = machine.driver_data(); int curv = param; /* starting at scanline 224, the CPU runs at half speed */ if (curv == 224) - state->m_maincpu->set_unscaled_clock(MASTER_CLOCK/16); + m_maincpu->set_unscaled_clock(MASTER_CLOCK/16); else - state->m_maincpu->set_unscaled_clock(MASTER_CLOCK/8); + m_maincpu->set_unscaled_clock(MASTER_CLOCK/8); /* scanline for the next run */ curv ^= 224; - state->m_cpu_timer->adjust(machine.primary_screen->time_until_pos(v_to_scanline(state, curv)), curv); + m_cpu_timer->adjust(machine().primary_screen->time_until_pos(v_to_scanline(this, curv)), curv); } @@ -522,11 +522,11 @@ void missile_state::machine_start() space.set_direct_update_handler(direct_update_delegate(FUNC(missile_state::missile_direct_handler), this)); /* create a timer to speed/slow the CPU */ - m_cpu_timer = machine().scheduler().timer_alloc(FUNC(adjust_cpu_speed)); + m_cpu_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(missile_state::adjust_cpu_speed),this)); m_cpu_timer->adjust(machine().primary_screen->time_until_pos(v_to_scanline(this, 0), 0)); /* create a timer for IRQs and set up the first callback */ - m_irq_timer = machine().scheduler().timer_alloc(FUNC(clock_irq)); + m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(missile_state::clock_irq),this)); m_irq_state = 0; schedule_next_irq(machine(), -32); diff --git a/src/mame/drivers/mjsister.c b/src/mame/drivers/mjsister.c index 5d604f66d5e..5968a3b26d0 100644 --- a/src/mame/drivers/mjsister.c +++ b/src/mame/drivers/mjsister.c @@ -61,6 +61,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_mjsister(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(dac_callback); }; @@ -165,17 +166,16 @@ UINT32 mjsister_state::screen_update_mjsister(screen_device &screen, bitmap_ind1 * *************************************/ -static TIMER_CALLBACK( dac_callback ) +TIMER_CALLBACK_MEMBER(mjsister_state::dac_callback) { - mjsister_state *state = machine.driver_data(); - UINT8 *DACROM = state->memregion("samples")->base(); + UINT8 *DACROM = memregion("samples")->base(); - state->m_dac->write_unsigned8(DACROM[(state->m_dac_bank * 0x10000 + state->m_dac_adr++) & 0x1ffff]); + m_dac->write_unsigned8(DACROM[(m_dac_bank * 0x10000 + m_dac_adr++) & 0x1ffff]); - if (((state->m_dac_adr & 0xff00 ) >> 8) != state->m_dac_adr_e) - machine.scheduler().timer_set(attotime::from_hz(MCLK) * 1024, FUNC(dac_callback)); + if (((m_dac_adr & 0xff00 ) >> 8) != m_dac_adr_e) + machine().scheduler().timer_set(attotime::from_hz(MCLK) * 1024, timer_expired_delegate(FUNC(mjsister_state::dac_callback),this)); else - state->m_dac_busy = 0; + m_dac_busy = 0; } WRITE8_MEMBER(mjsister_state::mjsister_dac_adr_s_w) @@ -189,7 +189,7 @@ WRITE8_MEMBER(mjsister_state::mjsister_dac_adr_e_w) m_dac_adr = m_dac_adr_s << 8; if (m_dac_busy == 0) - machine().scheduler().synchronize(FUNC(dac_callback)); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(mjsister_state::dac_callback),this)); m_dac_busy = 1; } diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c index 5b761a7228d..9768c26f578 100644 --- a/src/mame/drivers/mlanding.c +++ b/src/mame/drivers/mlanding.c @@ -78,6 +78,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_mlanding(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(dma_complete); }; @@ -312,10 +313,9 @@ static void ml_msm5205_vck(device_t *device) } } -static TIMER_CALLBACK( dma_complete ) +TIMER_CALLBACK_MEMBER(mlanding_state::dma_complete) { - mlanding_state *state = machine.driver_data(); - state->m_dma_active = 0; + m_dma_active = 0; } /* TODO: this uses many bits */ @@ -329,7 +329,7 @@ WRITE16_MEMBER(mlanding_state::ml_sub_reset_w) if (pixels) { m_dma_active = 1; - machine().scheduler().timer_set(attotime::from_msec(20), FUNC(dma_complete)); + machine().scheduler().timer_set(attotime::from_msec(20), timer_expired_delegate(FUNC(mlanding_state::dma_complete),this)); } if(!(data & 0x40)) // unknown line used diff --git a/src/mame/drivers/mpu3.c b/src/mame/drivers/mpu3.c index 49085089aba..16f559797ed 100644 --- a/src/mame/drivers/mpu3.c +++ b/src/mame/drivers/mpu3.c @@ -185,12 +185,13 @@ emu_timer *m_ic21_timer; DECLARE_DRIVER_INIT(m3hprvpr); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(ic21_timeout); }; #define DISPLAY_PORT 0 #define METER_PORT 1 #define BWB_FUNCTIONALITY 2 -static TIMER_CALLBACK( ic21_timeout ); + static void update_triacs(running_machine &machine) { @@ -353,11 +354,10 @@ static void ic21_setup(mpu3_state *state) } } -static TIMER_CALLBACK( ic21_timeout ) +TIMER_CALLBACK_MEMBER(mpu3_state::ic21_timeout) { - mpu3_state *state = machine.driver_data(); - state->m_ic11_active=0; - ic21_output(state,0); + m_ic11_active=0; + ic21_output(this,0); } READ8_MEMBER(mpu3_state::pia_ic3_porta_r) @@ -785,7 +785,7 @@ static const stepper_interface mpu3_reel_interface = static void mpu3_config_common(running_machine &machine) { mpu3_state *state = machine.driver_data(); - state->m_ic21_timer = machine.scheduler().timer_alloc(FUNC(ic21_timeout)); + state->m_ic21_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mpu3_state::ic21_timeout),state)); } void mpu3_state::machine_start() diff --git a/src/mame/drivers/multigam.c b/src/mame/drivers/multigam.c index 1bc025270cf..68d4da62963 100644 --- a/src/mame/drivers/multigam.c +++ b/src/mame/drivers/multigam.c @@ -145,6 +145,7 @@ public: DECLARE_MACHINE_RESET(multigm3); DECLARE_MACHINE_START(supergm3); UINT32 screen_update_multigam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(mmc1_resync_callback); }; @@ -693,10 +694,9 @@ static void multigam_init_mapper02(running_machine &machine, UINT8* prg_base, in *******************************************************/ -static TIMER_CALLBACK( mmc1_resync_callback ) +TIMER_CALLBACK_MEMBER(multigam_state::mmc1_resync_callback) { - multigam_state *state = machine.driver_data(); - state->m_mmc1_reg_write_enable = 1; + m_mmc1_reg_write_enable = 1; } WRITE8_MEMBER(multigam_state::mmc1_rom_switch_w) @@ -710,7 +710,7 @@ WRITE8_MEMBER(multigam_state::mmc1_rom_switch_w) else { m_mmc1_reg_write_enable = 0; - machine().scheduler().synchronize(FUNC(mmc1_resync_callback)); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(multigam_state::mmc1_resync_callback),this)); } int reg = (offset >> 13); diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c index 6a1de93007c..acd323341d4 100644 --- a/src/mame/drivers/namcos23.c +++ b/src/mame/drivers/namcos23.c @@ -1439,6 +1439,7 @@ public: DECLARE_MACHINE_RESET(gmen); UINT32 screen_update_ss23(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(s23_interrupt); + TIMER_CALLBACK_MEMBER(c361_timer_cb); }; @@ -1749,14 +1750,13 @@ READ16_MEMBER(namcos23_state::s23_ctl_r) } // raster timer. TC2 indicates it's probably one-shot since it resets it each VBL... -static TIMER_CALLBACK( c361_timer_cb ) +TIMER_CALLBACK_MEMBER(namcos23_state::c361_timer_cb) { - namcos23_state *state = machine.driver_data(); - c361_t &c361 = state->m_c361; + c361_t &c361 = m_c361; if (c361.scanline != 511) { - machine.device("maincpu")->execute().set_input_line(MIPS3_IRQ1, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(MIPS3_IRQ1, ASSERT_LINE); c361.timer->adjust(attotime::never); } } @@ -2452,7 +2452,7 @@ INTERRUPT_GEN_MEMBER(namcos23_state::s23_interrupt) MACHINE_START_MEMBER(namcos23_state,s23) { c361_t &c361 = m_c361; - c361.timer = machine().scheduler().timer_alloc(FUNC(c361_timer_cb)); + c361.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos23_state::c361_timer_cb),this)); c361.timer->adjust(attotime::never); } diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index a68801b383a..d711257c1ee 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -255,6 +255,7 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(irq_off); }; @@ -510,9 +511,9 @@ WRITE32_MEMBER(nwktr_state::lanc2_w) /*****************************************************************************/ -static TIMER_CALLBACK( irq_off ) +TIMER_CALLBACK_MEMBER(nwktr_state::irq_off) { - machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); + machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); } void nwktr_state::machine_start() @@ -523,7 +524,7 @@ void nwktr_state::machine_start() /* configure fast RAM regions for DRC */ ppcdrc_add_fastram(machine().device("maincpu"), 0x00000000, 0x003fffff, FALSE, m_work_ram); - m_sound_irq_timer = machine().scheduler().timer_alloc(FUNC(irq_off)); + m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nwktr_state::irq_off),this)); } static ADDRESS_MAP_START( nwktr_map, AS_PROGRAM, 32, nwktr_state ) diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index e18aa67380f..e400310db93 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -267,6 +267,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_peplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(assert_lp_cb); }; static const UINT8 id_022[8] = { 0x00, 0x01, 0x04, 0x09, 0x13, 0x16, 0x18, 0x00 }; @@ -372,13 +373,14 @@ WRITE8_MEMBER(peplus_state::peplus_crtc_mode_w) /* Reset timing logic */ } -static TIMER_CALLBACK(assert_lp_cb) +TIMER_CALLBACK_MEMBER(peplus_state::assert_lp_cb) { downcast((device_t*)ptr)->assert_light_pen_input(); } static void handle_lightpen( device_t *device ) { + peplus_state *state = device->machine().driver_data(); int x_val = device->machine().root_device().ioport("TOUCH_X")->read_safe(0x00); int y_val = device->machine().root_device().ioport("TOUCH_Y")->read_safe(0x00); const rectangle &vis_area = device->machine().primary_screen->visible_area(); @@ -387,7 +389,7 @@ static void handle_lightpen( device_t *device ) xt = x_val * vis_area.width() / 1024 + vis_area.min_x; yt = y_val * vis_area.height() / 1024 + vis_area.min_y; - device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), FUNC(assert_lp_cb), 0, device); + device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), timer_expired_delegate(FUNC(peplus_state::assert_lp_cb),state), 0, device); } WRITE_LINE_MEMBER(peplus_state::crtc_vsync) diff --git a/src/mame/drivers/pipeline.c b/src/mame/drivers/pipeline.c index e54bbb8de08..00dad67732a 100644 --- a/src/mame/drivers/pipeline.c +++ b/src/mame/drivers/pipeline.c @@ -102,6 +102,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_pipeline(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(protection_deferred_w); }; @@ -178,15 +179,14 @@ READ8_MEMBER(pipeline_state::protection_r) return m_fromMCU; } -static TIMER_CALLBACK( protection_deferred_w ) +TIMER_CALLBACK_MEMBER(pipeline_state::protection_deferred_w) { - pipeline_state *state = machine.driver_data(); - state->m_toMCU = param; + m_toMCU = param; } WRITE8_MEMBER(pipeline_state::protection_w) { - machine().scheduler().synchronize(FUNC(protection_deferred_w), data); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(pipeline_state::protection_deferred_w),this), data); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100)); } diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c index 68c9e3b5b22..467b2dbc00e 100644 --- a/src/mame/drivers/rabbit.c +++ b/src/mame/drivers/rabbit.c @@ -139,6 +139,7 @@ public: virtual void video_start(); UINT32 screen_update_rabbit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(rabbit_vblank_interrupt); + TIMER_CALLBACK_MEMBER(rabbit_blit_done); }; @@ -558,10 +559,9 @@ WRITE32_MEMBER(rabbit_state::rabbit_rombank_w) #define BLITCMDLOG 0 #define BLITLOG 0 -static TIMER_CALLBACK( rabbit_blit_done ) +TIMER_CALLBACK_MEMBER(rabbit_state::rabbit_blit_done) { - rabbit_state *state = machine.driver_data(); - machine.device("maincpu")->execute().set_input_line(state->m_bltirqlevel, HOLD_LINE); + machine().device("maincpu")->execute().set_input_line(m_bltirqlevel, HOLD_LINE); } static void rabbit_do_blit(running_machine &machine) @@ -609,7 +609,7 @@ static void rabbit_do_blit(running_machine &machine) if (!blt_amount) { if(BLITLOG) mame_printf_debug("end of blit list\n"); - machine.scheduler().timer_set(attotime::from_usec(500), FUNC(rabbit_blit_done)); + machine.scheduler().timer_set(attotime::from_usec(500), timer_expired_delegate(FUNC(rabbit_state::rabbit_blit_done),state)); return; } diff --git a/src/mame/drivers/sbrkout.c b/src/mame/drivers/sbrkout.c index cc9c3a79486..983b80499f5 100644 --- a/src/mame/drivers/sbrkout.c +++ b/src/mame/drivers/sbrkout.c @@ -67,6 +67,8 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_sbrkout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(scanline_callback); + TIMER_CALLBACK_MEMBER(pot_trigger_callback); }; @@ -89,8 +91,8 @@ public: * *************************************/ -static TIMER_CALLBACK( scanline_callback ); -static TIMER_CALLBACK( pot_trigger_callback ); + + @@ -104,8 +106,8 @@ void sbrkout_state::machine_start() { UINT8 *videoram = m_videoram; membank("bank1")->set_base(&videoram[0x380]); - m_scanline_timer = machine().scheduler().timer_alloc(FUNC(scanline_callback)); - m_pot_timer = machine().scheduler().timer_alloc(FUNC(pot_trigger_callback)); + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::scanline_callback),this)); + m_pot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::pot_trigger_callback),this)); save_item(NAME(m_sync2_value)); save_item(NAME(m_pot_mask)); @@ -126,34 +128,33 @@ void sbrkout_state::machine_reset() * *************************************/ -static TIMER_CALLBACK( scanline_callback ) +TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback) { - sbrkout_state *state = machine.driver_data(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; int scanline = param; /* force a partial update before anything happens */ - machine.primary_screen->update_partial(scanline); + machine().primary_screen->update_partial(scanline); /* if this is a rising edge of 16V, assert the CPU interrupt */ if (scanline % 32 == 16) - machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); /* update the DAC state */ - machine.device("dac")->write_unsigned8((videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0); + machine().device("dac")->write_unsigned8((videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0); /* on the VBLANK, read the pot and schedule an interrupt time for it */ - if (scanline == machine.primary_screen->visible_area().max_y + 1) + if (scanline == machine().primary_screen->visible_area().max_y + 1) { - UINT8 potvalue = state->ioport("PADDLE")->read(); - state->m_pot_timer->adjust(machine.primary_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128)); + UINT8 potvalue = ioport("PADDLE")->read(); + m_pot_timer->adjust(machine().primary_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128)); } /* call us back in 4 scanlines */ scanline += 4; - if (scanline >= machine.primary_screen->height()) + if (scanline >= machine().primary_screen->height()) scanline = 0; - state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(scanline), scanline); + m_scanline_timer->adjust(machine().primary_screen->time_until_pos(scanline), scanline); } @@ -210,11 +211,10 @@ static void update_nmi_state(running_machine &machine) } -static TIMER_CALLBACK( pot_trigger_callback ) +TIMER_CALLBACK_MEMBER(sbrkout_state::pot_trigger_callback) { - sbrkout_state *state = machine.driver_data(); - state->m_pot_trigger[param] = 1; - update_nmi_state(machine); + m_pot_trigger[param] = 1; + update_nmi_state(machine()); } diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c index fc76c347eb0..7b31b1c95b2 100644 --- a/src/mame/drivers/seattle.c +++ b/src/mame/drivers/seattle.c @@ -494,6 +494,7 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_seattle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(galileo_timer_callback); }; @@ -506,7 +507,7 @@ public: static void vblank_assert(device_t *device, int state); static void update_vblank_irq(running_machine &machine); static void galileo_reset(running_machine &machine); -static TIMER_CALLBACK( galileo_timer_callback ); + static void galileo_perform_dma(address_space &space, int which); static void voodoo_stall(device_t *device, int stall); static void widget_reset(running_machine &machine); @@ -540,10 +541,10 @@ void seattle_state::machine_start() m_voodoo = machine().device("voodoo"); /* allocate timers for the galileo */ - m_galileo.timer[0].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); - m_galileo.timer[1].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); - m_galileo.timer[2].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); - m_galileo.timer[3].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); + m_galileo.timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); + m_galileo.timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); + m_galileo.timer[2].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); + m_galileo.timer[3].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); /* set the fastest DRC options, but strict verification */ mips3drc_set_options(machine().device("maincpu"), MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY); @@ -940,29 +941,28 @@ static void update_galileo_irqs(running_machine &machine) } -static TIMER_CALLBACK( galileo_timer_callback ) +TIMER_CALLBACK_MEMBER(seattle_state::galileo_timer_callback) { - seattle_state *state = machine.driver_data(); int which = param; - galileo_timer *timer = &state->m_galileo.timer[which]; + galileo_timer *timer = &m_galileo.timer[which]; if (LOG_TIMERS) logerror("timer %d fired\n", which); /* copy the start value from the registers */ - timer->count = state->m_galileo.reg[GREG_TIMER0_COUNT + which]; + timer->count = m_galileo.reg[GREG_TIMER0_COUNT + which]; if (which != 0) timer->count &= 0xffffff; /* if we're a timer, adjust the timer to fire again */ - if (state->m_galileo.reg[GREG_TIMER_CONTROL] & (2 << (2 * which))) + if (m_galileo.reg[GREG_TIMER_CONTROL] & (2 << (2 * which))) timer->timer->adjust(TIMER_PERIOD * timer->count, which); else timer->active = timer->count = 0; /* trigger the interrupt */ - state->m_galileo.reg[GREG_INT_STATE] |= 1 << (GINT_T0EXP_SHIFT + which); - update_galileo_irqs(machine); + m_galileo.reg[GREG_INT_STATE] |= 1 << (GINT_T0EXP_SHIFT + which); + update_galileo_irqs(machine()); } diff --git a/src/mame/drivers/sothello.c b/src/mame/drivers/sothello.c index f0db267e30b..bf7169e1dc1 100644 --- a/src/mame/drivers/sothello.c +++ b/src/mame/drivers/sothello.c @@ -66,6 +66,8 @@ public: DECLARE_READ8_MEMBER(subcpu_status_r); DECLARE_WRITE8_MEMBER(msm_cfg_w); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(subcpu_suspend); + TIMER_CALLBACK_MEMBER(subcpu_resume); }; @@ -94,27 +96,27 @@ WRITE8_MEMBER(sothello_state::bank_w) membank("bank1")->set_base(&RAM[bank*0x4000+0x10000]); } -static TIMER_CALLBACK( subcpu_suspend ) +TIMER_CALLBACK_MEMBER(sothello_state::subcpu_suspend) { - machine.device("sub")->suspend(SUSPEND_REASON_HALT, 1); + machine().device("sub")->suspend(SUSPEND_REASON_HALT, 1); } -static TIMER_CALLBACK( subcpu_resume ) +TIMER_CALLBACK_MEMBER(sothello_state::subcpu_resume) { - machine.device("sub")->resume(SUSPEND_REASON_HALT); - machine.device("sub")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + machine().device("sub")->resume(SUSPEND_REASON_HALT); + machine().device("sub")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } READ8_MEMBER(sothello_state::subcpu_halt_set) { - machine().scheduler().synchronize(FUNC(subcpu_suspend)); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(sothello_state::subcpu_suspend),this)); m_subcpu_status|=2; return 0; } READ8_MEMBER(sothello_state::subcpu_halt_clear) { - machine().scheduler().synchronize(FUNC(subcpu_resume)); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(sothello_state::subcpu_resume),this)); m_subcpu_status&=~1; m_subcpu_status&=~2; return 0; diff --git a/src/mame/drivers/ssfindo.c b/src/mame/drivers/ssfindo.c index d0e9997d2e9..cde71f83162 100644 --- a/src/mame/drivers/ssfindo.c +++ b/src/mame/drivers/ssfindo.c @@ -248,6 +248,8 @@ public: virtual void machine_reset(); UINT32 screen_update_ssfindo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(ssfindo_interrupt); + TIMER_CALLBACK_MEMBER(PS7500_Timer0_callback); + TIMER_CALLBACK_MEMBER(PS7500_Timer1_callback); }; @@ -290,13 +292,12 @@ WRITE32_MEMBER(ssfindo_state::FIFO_w) m_PS7500_FIFO[1]++; //autoinc } } -static TIMER_CALLBACK( PS7500_Timer0_callback ) +TIMER_CALLBACK_MEMBER(ssfindo_state::PS7500_Timer0_callback) { - ssfindo_state *state = machine.driver_data(); - state->m_PS7500_IO[IRQSTA]|=0x20; - if(state->m_PS7500_IO[IRQMSKA]&0x20) + m_PS7500_IO[IRQSTA]|=0x20; + if(m_PS7500_IO[IRQMSKA]&0x20) { - generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE, 1); + generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE, 1); } } @@ -311,13 +312,12 @@ static void PS7500_startTimer0(running_machine &machine) state->m_PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); } -static TIMER_CALLBACK( PS7500_Timer1_callback ) +TIMER_CALLBACK_MEMBER(ssfindo_state::PS7500_Timer1_callback) { - ssfindo_state *state = machine.driver_data(); - state->m_PS7500_IO[IRQSTA]|=0x40; - if(state->m_PS7500_IO[IRQMSKA]&0x40) + m_PS7500_IO[IRQSTA]|=0x40; + if(m_PS7500_IO[IRQMSKA]&0x40) { - generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE, 1); + generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE, 1); } } @@ -857,8 +857,8 @@ ROM_END DRIVER_INIT_MEMBER(ssfindo_state,common) { ssfindo_speedup = 0; - m_PS7500timer0 = machine().scheduler().timer_alloc(FUNC(PS7500_Timer0_callback)); - m_PS7500timer1 = machine().scheduler().timer_alloc(FUNC(PS7500_Timer1_callback)); + m_PS7500timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer0_callback),this)); + m_PS7500timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer1_callback),this)); } diff --git a/src/mame/drivers/taitogn.c b/src/mame/drivers/taitogn.c index 642ed8b6951..d5e4a9b4286 100644 --- a/src/mame/drivers/taitogn.c +++ b/src/mame/drivers/taitogn.c @@ -388,6 +388,7 @@ public: DECLARE_DRIVER_INIT(coh3002t_mp); DECLARE_DRIVER_INIT(coh3002t); DECLARE_MACHINE_RESET(coh3002t); + TIMER_CALLBACK_MEMBER(dip_timer_fired); }; @@ -782,15 +783,14 @@ WRITE32_MEMBER(taitogn_state::znsecsel_w) } } -static TIMER_CALLBACK( dip_timer_fired ) +TIMER_CALLBACK_MEMBER(taitogn_state::dip_timer_fired) { - taitogn_state *state = machine.driver_data(); - psx_sio_input( machine, 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); + psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); if( param ) { - state->m_dip_timer->adjust(machine.device("maincpu")->cycles_to_attotime(50)); + m_dip_timer->adjust(machine().device("maincpu")->cycles_to_attotime(50)); } } @@ -868,7 +868,7 @@ DRIVER_INIT_MEMBER(taitogn_state,coh3002t) znsec_init(0, tt10); znsec_init(1, tt16); psx_sio_install_handler(machine(), 0, sio_pad_handler); - m_dip_timer = machine().scheduler().timer_alloc( FUNC(dip_timer_fired), NULL ); + m_dip_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(taitogn_state::dip_timer_fired),this), NULL ); UINT32 metalength; memset(m_cis, 0xff, 512); diff --git a/src/mame/drivers/thayers.c b/src/mame/drivers/thayers.c index b6b5b473144..7646cc51b41 100644 --- a/src/mame/drivers/thayers.c +++ b/src/mame/drivers/thayers.c @@ -82,6 +82,8 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_ready_r); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(intrq_tick); + TIMER_CALLBACK_MEMBER(ssi263_phoneme_tick); }; @@ -106,9 +108,9 @@ static void check_interrupt(running_machine &machine) } } -static TIMER_CALLBACK( intrq_tick ) +TIMER_CALLBACK_MEMBER(thayers_state::intrq_tick) { - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); } WRITE8_MEMBER(thayers_state::intrq_w) @@ -117,7 +119,7 @@ WRITE8_MEMBER(thayers_state::intrq_w) machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); - machine().scheduler().timer_set(attotime::from_usec(8250), FUNC(intrq_tick)); + machine().scheduler().timer_set(attotime::from_usec(8250), timer_expired_delegate(FUNC(thayers_state::intrq_tick),this)); } READ8_MEMBER(thayers_state::irqstate_r) @@ -470,11 +472,10 @@ static const char SSI263_PHONEMES[0x40][5] = "L", "L1", "LF", "W", "B", "D", "KV", "P", "T", "K", "HV", "HVC", "HF", "HFC", "HN", "Z", "S", "J", "SCH", "V", "F", "THV", "TH", "M", "N", "NG", ":A", ":OH", ":U", ":UH", "E2", "LB" }; -static TIMER_CALLBACK( ssi263_phoneme_tick ) +TIMER_CALLBACK_MEMBER(thayers_state::ssi263_phoneme_tick) { - thayers_state *state = machine.driver_data(); - state->m_ssi_data_request = 0; - check_interrupt(machine); + m_ssi_data_request = 0; + check_interrupt(machine()); } WRITE8_MEMBER(thayers_state::ssi263_register_w) @@ -499,11 +500,11 @@ WRITE8_MEMBER(thayers_state::ssi263_register_w) case 0: case 1: // phoneme timing response - machine().scheduler().timer_set(attotime::from_usec(phoneme_time), FUNC(ssi263_phoneme_tick)); + machine().scheduler().timer_set(attotime::from_usec(phoneme_time), timer_expired_delegate(FUNC(thayers_state::ssi263_phoneme_tick),this)); break; case 2: // frame timing response - machine().scheduler().timer_set(attotime::from_usec(frame_time), FUNC(ssi263_phoneme_tick)); + machine().scheduler().timer_set(attotime::from_usec(frame_time), timer_expired_delegate(FUNC(thayers_state::ssi263_phoneme_tick),this)); break; case 3: // disable A/_R output diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c index cc3a823be6e..26fdae68eff 100644 --- a/src/mame/drivers/tickee.c +++ b/src/mame/drivers/tickee.c @@ -56,6 +56,9 @@ public: DECLARE_MACHINE_RESET(tickee); DECLARE_VIDEO_START(tickee); DECLARE_MACHINE_RESET(rapidfir); + TIMER_CALLBACK_MEMBER(trigger_gun_interrupt); + TIMER_CALLBACK_MEMBER(clear_gun_interrupt); + TIMER_CALLBACK_MEMBER(setup_gun_interrupts); }; @@ -86,49 +89,47 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int * * *************************************/ -static TIMER_CALLBACK( trigger_gun_interrupt ) +TIMER_CALLBACK_MEMBER(tickee_state::trigger_gun_interrupt) { - tickee_state *state = machine.driver_data(); int which = param & 1; - int beamx = (machine.primary_screen->hpos()/2)-58; + int beamx = (machine().primary_screen->hpos()/2)-58; /* once we're ready to fire, set the X coordinate and assert the line */ - state->m_gunx[which] = beamx; + m_gunx[which] = beamx; /* fire the IRQ at the correct moment */ - machine.device("maincpu")->execute().set_input_line(param, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(param, ASSERT_LINE); } -static TIMER_CALLBACK( clear_gun_interrupt ) +TIMER_CALLBACK_MEMBER(tickee_state::clear_gun_interrupt) { /* clear the IRQ on the next scanline? */ - machine.device("maincpu")->execute().set_input_line(param, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(param, CLEAR_LINE); } -static TIMER_CALLBACK( setup_gun_interrupts ) +TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts) { - tickee_state *state = machine.driver_data(); int beamx, beamy; /* set a timer to do this again next frame */ - state->m_setup_gun_timer->adjust(machine.primary_screen->time_until_pos(0)); + m_setup_gun_timer->adjust(machine().primary_screen->time_until_pos(0)); /* only do work if the palette is flashed */ - if (state->m_control) - if (!state->m_control[2]) + if (m_control) + if (!m_control[2]) return; /* 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 + state->m_beamyadd, beamx + state->m_beamxadd), FUNC(trigger_gun_interrupt), 0); - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(beamy + state->m_beamyadd + 1, beamx + state->m_beamxadd), FUNC(clear_gun_interrupt), 0); + 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); /* 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 + state->m_beamyadd, beamx + state->m_beamxadd), FUNC(trigger_gun_interrupt), 1); - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(beamy + state->m_beamyadd + 1, beamx + state->m_beamxadd), FUNC(clear_gun_interrupt), 1); + 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); } @@ -142,7 +143,7 @@ static TIMER_CALLBACK( 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(FUNC(setup_gun_interrupts)); + m_setup_gun_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tickee_state::setup_gun_interrupts),this)); m_setup_gun_timer->adjust(machine().primary_screen->time_until_pos(0)); } diff --git a/src/mame/drivers/tmmjprd.c b/src/mame/drivers/tmmjprd.c index 25da5f81f0d..979c5104014 100644 --- a/src/mame/drivers/tmmjprd.c +++ b/src/mame/drivers/tmmjprd.c @@ -69,6 +69,7 @@ public: virtual void video_start(); UINT32 screen_update_tmmjprd_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_tmmjprd_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(tmmjprd_blit_done); }; @@ -378,9 +379,9 @@ READ32_MEMBER(tmmjprd_state::randomtmmjprds) #define BLITLOG 0 #if 0 -static TIMER_CALLBACK( tmmjprd_blit_done ) +TIMER_CALLBACK_MEMBER(tmmjprd_state::tmmjprd_blit_done) { - machine.device("maincpu")->execute().set_input_line(3, HOLD_LINE); + machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE); } static void tmmjprd_do_blit(running_machine &machine) @@ -428,7 +429,7 @@ static void tmmjprd_do_blit(running_machine &machine) if (!blt_amount) { if(BLITLOG) mame_printf_debug("end of blit list\n"); - machine.scheduler().timer_set(attotime::from_usec(500), FUNC(tmmjprd_blit_done)); + machine.scheduler().timer_set(attotime::from_usec(500), timer_expired_delegate(FUNC(tmmjprd_state::tmmjprd_blit_done),this)); return; } diff --git a/src/mame/drivers/tugboat.c b/src/mame/drivers/tugboat.c index 91aadc3143f..b68504bb772 100644 --- a/src/mame/drivers/tugboat.c +++ b/src/mame/drivers/tugboat.c @@ -50,6 +50,7 @@ public: virtual void machine_reset(); virtual void palette_init(); UINT32 screen_update_tugboat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(interrupt_gen); }; @@ -202,15 +203,15 @@ static const pia6821_interface pia1_intf = DEVCB_NULL /* IRQB */ }; -static TIMER_CALLBACK( interrupt_gen ) +TIMER_CALLBACK_MEMBER(tugboat_state::interrupt_gen) { - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); - machine.scheduler().timer_set(machine.primary_screen->frame_period(), FUNC(interrupt_gen)); + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); + machine().scheduler().timer_set(machine().primary_screen->frame_period(), timer_expired_delegate(FUNC(tugboat_state::interrupt_gen),this)); } void tugboat_state::machine_reset() { - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(30*8+4), FUNC(interrupt_gen)); + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(30*8+4), timer_expired_delegate(FUNC(tugboat_state::interrupt_gen),this)); } diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c index b539d1bd86b..3fe6a13eb0b 100644 --- a/src/mame/drivers/vegas.c +++ b/src/mame/drivers/vegas.c @@ -502,6 +502,7 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_vegas(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(nile_timer_callback); }; @@ -512,7 +513,7 @@ public: * *************************************/ -static TIMER_CALLBACK( nile_timer_callback ); + static void ide_interrupt(device_t *device, int state); static void remap_dynamic_addresses(running_machine &machine); @@ -543,8 +544,8 @@ void vegas_state::machine_start() /* allocate timers for the NILE */ m_timer[0] = machine().scheduler().timer_alloc(FUNC_NULL); m_timer[1] = machine().scheduler().timer_alloc(FUNC_NULL); - m_timer[2] = machine().scheduler().timer_alloc(FUNC(nile_timer_callback)); - m_timer[3] = machine().scheduler().timer_alloc(FUNC(nile_timer_callback)); + m_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vegas_state::nile_timer_callback),this)); + m_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vegas_state::nile_timer_callback),this)); /* identify our sound board */ if (machine().device("dsio") != NULL) @@ -918,11 +919,10 @@ static void update_nile_irqs(running_machine &machine) } -static TIMER_CALLBACK( nile_timer_callback ) +TIMER_CALLBACK_MEMBER(vegas_state::nile_timer_callback) { - vegas_state *state = machine.driver_data(); int which = param; - UINT32 *regs = &state->m_nile_regs[NREG_T0CTRL + which * 4]; + UINT32 *regs = &m_nile_regs[NREG_T0CTRL + which * 4]; if (LOG_TIMERS) logerror("timer %d fired\n", which); /* adjust the timer to fire again */ @@ -931,16 +931,16 @@ static TIMER_CALLBACK( nile_timer_callback ) if (regs[1] & 2) logerror("Unexpected value: timer %d is prescaled\n", which); if (scale != 0) - state->m_timer[which]->adjust(TIMER_PERIOD * scale, which); + m_timer[which]->adjust(TIMER_PERIOD * scale, which); } /* trigger the interrupt */ if (which == 2) - state->m_nile_irq_state |= 1 << 6; + m_nile_irq_state |= 1 << 6; if (which == 3) - state->m_nile_irq_state |= 1 << 5; + m_nile_irq_state |= 1 << 5; - update_nile_irqs(machine); + update_nile_irqs(machine()); } diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index e33870737f7..c152acba73f 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -350,6 +350,8 @@ public: virtual void machine_reset(); UINT32 screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(viper_vblank); + TIMER_CALLBACK_MEMBER(epic_global_timer_callback); + TIMER_CALLBACK_MEMBER(ds2430_timer_callback); }; UINT32 viper_state::screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) @@ -609,7 +611,7 @@ static const char* epic_get_register_name(UINT32 reg) } #endif -static TIMER_CALLBACK(epic_global_timer_callback) +TIMER_CALLBACK_MEMBER(viper_state::epic_global_timer_callback) { int timer_num = param; @@ -627,7 +629,7 @@ static TIMER_CALLBACK(epic_global_timer_callback) epic.global_timer[timer_num].timer->reset(); } - mpc8240_interrupt(machine, MPC8240_GTIMER0_IRQ + timer_num); + mpc8240_interrupt(machine(), MPC8240_GTIMER0_IRQ + timer_num); } @@ -1172,10 +1174,11 @@ static void mpc8240_interrupt(running_machine &machine, int irq) static void mpc8240_epic_init(running_machine &machine) { - epic.global_timer[0].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); - epic.global_timer[1].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); - epic.global_timer[2].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); - epic.global_timer[3].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); + viper_state *state = machine.driver_data(); + epic.global_timer[0].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); + epic.global_timer[1].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); + epic.global_timer[2].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); + epic.global_timer[3].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); } static void mpc8240_epic_reset(void) @@ -1606,7 +1609,7 @@ static UINT8 *ds2430_rom; static UINT8 ds2430_addr; -static TIMER_CALLBACK(ds2430_timer_callback) +TIMER_CALLBACK_MEMBER(viper_state::ds2430_timer_callback) { printf("DS2430 timer callback\n"); @@ -1965,7 +1968,7 @@ static void ide_interrupt(device_t *device, int state) void viper_state::machine_start() { - ds2430_timer = machine().scheduler().timer_alloc(FUNC(ds2430_timer_callback)); + ds2430_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::ds2430_timer_callback),this)); ds2430_bit_timer = machine().device("ds2430_timer2"); mpc8240_epic_init(machine()); diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index 3111dd3cf41..a5d53362804 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -118,6 +118,7 @@ public: DECLARE_MACHINE_RESET(coh1002v); DECLARE_MACHINE_RESET(coh1002m); INTERRUPT_GEN_MEMBER(qsound_interrupt); + TIMER_CALLBACK_MEMBER(dip_timer_fired); }; INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) @@ -420,14 +421,13 @@ WRITE32_MEMBER(zn_state::znsecsel_w) verboselog( machine(), 2, "znsecsel_w( %08x, %08x, %08x )\n", offset, data, mem_mask ); } -static TIMER_CALLBACK( dip_timer_fired ) +TIMER_CALLBACK_MEMBER(zn_state::dip_timer_fired) { - zn_state *state = machine.driver_data(); - psx_sio_input( machine, 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); + psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); if( param ) { - state->m_dip_timer->adjust( machine.device( "maincpu" )->cycles_to_attotime(50 ) ); + m_dip_timer->adjust( machine().device( "maincpu" )->cycles_to_attotime(50 ) ); } } @@ -531,7 +531,7 @@ static void zn_driver_init( running_machine &machine ) n_game++; } - state->m_dip_timer = machine.scheduler().timer_alloc( FUNC(dip_timer_fired), NULL ); + state->m_dip_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(zn_state::dip_timer_fired),state), NULL ); } static void psx_spu_irq(device_t *device, UINT32 data) diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c index e8ad1332557..8309b20f226 100644 --- a/src/mame/drivers/zr107.c +++ b/src/mame/drivers/zr107.c @@ -208,6 +208,7 @@ 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); }; @@ -677,17 +678,18 @@ static const adc083x_interface zr107_adc_interface = { }; -static TIMER_CALLBACK( irq_off ) +TIMER_CALLBACK_MEMBER(zr107_state::irq_off) { - machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); + machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); } static void sound_irq_callback( running_machine &machine, int irq ) { + zr107_state *state = machine.driver_data(); int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2; machine.device("audiocpu")->execute().set_input_line(line, ASSERT_LINE); - machine.scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off), line); + machine.scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(zr107_state::irq_off),state), line); } static const k056800_interface zr107_k056800_interface = diff --git a/src/mess/drivers/a2600.c b/src/mess/drivers/a2600.c index 9040d40edf9..19b73a3de75 100644 --- a/src/mess/drivers/a2600.c +++ b/src/mess/drivers/a2600.c @@ -114,6 +114,7 @@ public: virtual void machine_reset(); DECLARE_MACHINE_START(a2600); DECLARE_MACHINE_START(a2600p); + TIMER_CALLBACK_MEMBER(modeDPC_timer_callback); }; @@ -959,15 +960,14 @@ void a2600_state::modeDPC_decrement_counter(UINT8 data_fetcher) modeDPC_check_flag(data_fetcher ); } -static TIMER_CALLBACK(modeDPC_timer_callback) +TIMER_CALLBACK_MEMBER(a2600_state::modeDPC_timer_callback) { - a2600_state *state = machine.driver_data(); int data_fetcher; for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ ) { - if ( state->m_dpc.df[data_fetcher].osc_clk ) + if ( m_dpc.df[data_fetcher].osc_clk ) { - state->modeDPC_decrement_counter(data_fetcher ); + modeDPC_decrement_counter(data_fetcher ); } } } @@ -1592,7 +1592,7 @@ static void common_init(running_machine &machine) state->m_extra_RAM = machine.memory().region_alloc("user2", 0x8600, 1, ENDIANNESS_LITTLE); memset( state->m_riot_ram, 0x00, 0x80 ); state->m_current_reset_bank_counter = 0xFF; - state->m_dpc.oscillator = machine.scheduler().timer_alloc(FUNC(modeDPC_timer_callback)); + state->m_dpc.oscillator = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_state::modeDPC_timer_callback),state)); } MACHINE_START_MEMBER(a2600_state,a2600) diff --git a/src/mess/drivers/a7000.c b/src/mess/drivers/a7000.c index f16dfb31952..fc0da6c93ff 100644 --- a/src/mess/drivers/a7000.c +++ b/src/mess/drivers/a7000.c @@ -55,6 +55,9 @@ public: virtual void machine_start(); UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(IOMD_timer0_callback); + TIMER_CALLBACK_MEMBER(IOMD_timer1_callback); + TIMER_CALLBACK_MEMBER(flyback_timer_callback); }; @@ -568,36 +571,33 @@ void a7000_state::fire_iomd_timer(int timer) m_IOMD_timer[timer]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val)); } -static TIMER_CALLBACK( IOMD_timer0_callback ) +TIMER_CALLBACK_MEMBER(a7000_state::IOMD_timer0_callback) { - a7000_state *state = machine.driver_data(); - state->m_IRQ_status_A|=0x20; - if(state->m_IRQ_mask_A&0x20) + m_IRQ_status_A|=0x20; + if(m_IRQ_mask_A&0x20) { - generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE,1); + generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE,1); } } -static TIMER_CALLBACK( IOMD_timer1_callback ) +TIMER_CALLBACK_MEMBER(a7000_state::IOMD_timer1_callback) { - a7000_state *state = machine.driver_data(); - state->m_IRQ_status_A|=0x40; - if(state->m_IRQ_mask_A&0x40) + m_IRQ_status_A|=0x40; + if(m_IRQ_mask_A&0x40) { - generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE,1); + generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE,1); } } -static TIMER_CALLBACK( flyback_timer_callback ) +TIMER_CALLBACK_MEMBER(a7000_state::flyback_timer_callback) { - a7000_state *state = machine.driver_data(); - state->m_IRQ_status_A|=0x08; - if(state->m_IRQ_mask_A&0x08) + m_IRQ_status_A|=0x08; + if(m_IRQ_mask_A&0x08) { - generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE,1); + generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE,1); } - state->m_flyback_timer->adjust(machine.primary_screen->time_until_pos(state->m_vidc20_vert_reg[VDER])); + m_flyback_timer->adjust(machine().primary_screen->time_until_pos(m_vidc20_vert_reg[VDER])); } void a7000_state::viddma_transfer_start() @@ -766,9 +766,9 @@ INPUT_PORTS_END void a7000_state::machine_start() { - m_IOMD_timer[0] = machine().scheduler().timer_alloc(FUNC(IOMD_timer0_callback)); - m_IOMD_timer[1] = machine().scheduler().timer_alloc(FUNC(IOMD_timer1_callback)); - m_flyback_timer = machine().scheduler().timer_alloc(FUNC(flyback_timer_callback)); + m_IOMD_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a7000_state::IOMD_timer0_callback),this)); + m_IOMD_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a7000_state::IOMD_timer1_callback),this)); + m_flyback_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a7000_state::flyback_timer_callback),this)); m_io_id = 0xd4e7; } diff --git a/src/mess/drivers/alphatro.c b/src/mess/drivers/alphatro.c index c7472cf0b48..de8516f5e70 100644 --- a/src/mess/drivers/alphatro.c +++ b/src/mess/drivers/alphatro.c @@ -71,12 +71,12 @@ private: static const device_timer_id SERIAL_TIMER = 1; UINT8 m_timer_bit; virtual void palette_init(); + TIMER_CALLBACK_MEMBER(alphatro_beepoff); }; -static TIMER_CALLBACK( alphatro_beepoff ) +TIMER_CALLBACK_MEMBER(alphatro_state::alphatro_beepoff) { - alphatro_state *state = machine.driver_data(); - beep_set_state(state->m_beep, 0); + beep_set_state(m_beep, 0); } READ8_MEMBER( alphatro_state::port10_r ) @@ -101,7 +101,7 @@ WRITE8_MEMBER( alphatro_state::port10_w ) if (length) { - machine().scheduler().timer_set(attotime::from_msec(length), FUNC(alphatro_beepoff)); + machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(alphatro_state::alphatro_beepoff),this)); beep_set_state(m_beep, 1); } diff --git a/src/mess/drivers/amico2k.c b/src/mess/drivers/amico2k.c index 22ef11b0485..acc7314ef81 100644 --- a/src/mess/drivers/amico2k.c +++ b/src/mess/drivers/amico2k.c @@ -52,6 +52,7 @@ public: // timers emu_timer *m_led_refresh_timer; + TIMER_CALLBACK_MEMBER(led_refresh); }; @@ -97,13 +98,12 @@ static INPUT_PORTS_START( amico2k ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END -static TIMER_CALLBACK( led_refresh ) +TIMER_CALLBACK_MEMBER(amico2k_state::led_refresh) { - amico2k_state *state = machine.driver_data(); - if (state->m_ls145_p > 3) + if (m_ls145_p > 3) { - output_set_digit_value(state->m_ls145_p - 4, state->m_segment); + output_set_digit_value(m_ls145_p - 4, m_segment); } } @@ -206,7 +206,7 @@ static I8255_INTERFACE( ppi_intf ) void amico2k_state::machine_start() { - m_led_refresh_timer = machine().scheduler().timer_alloc(FUNC(led_refresh)); + m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amico2k_state::led_refresh),this)); // state saving save_item(NAME(m_ls145_p)); diff --git a/src/mess/drivers/argo.c b/src/mess/drivers/argo.c index 13ce4a0b5d1..891702e482f 100644 --- a/src/mess/drivers/argo.c +++ b/src/mess/drivers/argo.c @@ -49,6 +49,7 @@ 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); }; // write to videoram if following 'out b9,61' otherwise write to the unknown 'extra' ram @@ -249,16 +250,15 @@ INPUT_PORTS_END /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( argo_boot ) +TIMER_CALLBACK_MEMBER(argo_state::argo_boot) { - argo_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } void argo_state::machine_reset() { membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(5), FUNC(argo_boot)); + machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(argo_state::argo_boot),this)); } DRIVER_INIT_MEMBER(argo_state,argo) diff --git a/src/mess/drivers/c10.c b/src/mess/drivers/c10.c index aaf52759d5c..61ad539bbc9 100644 --- a/src/mess/drivers/c10.c +++ b/src/mess/drivers/c10.c @@ -29,6 +29,7 @@ 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); }; @@ -51,16 +52,15 @@ static INPUT_PORTS_START( c10 ) INPUT_PORTS_END /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( c10_reset ) +TIMER_CALLBACK_MEMBER(c10_state::c10_reset) { - c10_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } void c10_state::machine_reset() { membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(4), FUNC(c10_reset)); + machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(c10_state::c10_reset),this)); } void c10_state::video_start() diff --git a/src/mess/drivers/cat.c b/src/mess/drivers/cat.c index 13ee3e58d9b..a4a4607d7ab 100644 --- a/src/mess/drivers/cat.c +++ b/src/mess/drivers/cat.c @@ -71,6 +71,8 @@ public: DECLARE_VIDEO_START(swyft); UINT32 screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(keyboard_callback); + TIMER_CALLBACK_MEMBER(swyft_reset); }; WRITE16_MEMBER( cat_state::cat_video_status_w ) @@ -297,9 +299,9 @@ static INPUT_PORTS_START( swyft ) INPUT_PORTS_END -static TIMER_CALLBACK(keyboard_callback) +TIMER_CALLBACK_MEMBER(cat_state::keyboard_callback) { - machine.device("maincpu")->execute().set_input_line(M68K_IRQ_1, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(M68K_IRQ_1, ASSERT_LINE); } static IRQ_CALLBACK(cat_int_ack) @@ -312,7 +314,7 @@ MACHINE_START_MEMBER(cat_state,cat) { m_duart_inp = 0x0e; - m_keyboard_timer = machine().scheduler().timer_alloc(FUNC(keyboard_callback)); + m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::keyboard_callback),this)); machine().device("nvram")->set_base(m_p_sram, 0x4000); } @@ -353,9 +355,9 @@ UINT32 cat_state::screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, return 0; } -static TIMER_CALLBACK( swyft_reset ) +TIMER_CALLBACK_MEMBER(cat_state::swyft_reset) { - memset(machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0xe2341), 0xff, 1); + memset(machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0xe2341), 0xff, 1); } MACHINE_START_MEMBER(cat_state,swyft) @@ -364,7 +366,7 @@ MACHINE_START_MEMBER(cat_state,swyft) MACHINE_RESET_MEMBER(cat_state,swyft) { - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(swyft_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(cat_state::swyft_reset),this)); } VIDEO_START_MEMBER(cat_state,swyft) diff --git a/src/mess/drivers/craft.c b/src/mess/drivers/craft.c index afa92d084f6..f3d0b184839 100644 --- a/src/mess/drivers/craft.c +++ b/src/mess/drivers/craft.c @@ -37,9 +37,9 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, * I/O devices * \****************************************************/ -static TIMER_CALLBACK( avr8_timer0_tick ); -static TIMER_CALLBACK( avr8_timer1_tick ); -static TIMER_CALLBACK( avr8_timer2_tick ); + + + class craft_state : public driver_device { @@ -74,13 +74,16 @@ public: DECLARE_DRIVER_INIT(craft); virtual void machine_reset(); UINT32 screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(avr8_timer0_tick); + TIMER_CALLBACK_MEMBER(avr8_timer1_tick); + TIMER_CALLBACK_MEMBER(avr8_timer2_tick); }; void craft_state::machine_start() { - m_timer0_timer = machine().scheduler().timer_alloc(FUNC(avr8_timer0_tick)); - m_timer1_timer = machine().scheduler().timer_alloc(FUNC(avr8_timer1_tick)); - m_timer2_timer = machine().scheduler().timer_alloc(FUNC(avr8_timer2_tick)); + m_timer0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(craft_state::avr8_timer0_tick),this)); + m_timer1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(craft_state::avr8_timer1_tick),this)); + m_timer2_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(craft_state::avr8_timer2_tick),this)); } enum { @@ -92,18 +95,17 @@ enum static const char avr8_reg_name[4] = { 'A', 'B', 'C', 'D' }; -static TIMER_CALLBACK( avr8_timer0_tick ) +TIMER_CALLBACK_MEMBER(craft_state::avr8_timer0_tick) { // TODO } -static TIMER_CALLBACK( avr8_timer1_tick ) +TIMER_CALLBACK_MEMBER(craft_state::avr8_timer1_tick) { /* TODO: Handle comparison, setting OC1x pins, detection of BOTTOM and TOP - craft_state *state = machine.driver_data(); UINT16 count = AVR8_TCNT1; - count += state->m_timer1_increment; + count += m_timer1_increment; for(INT32 reg = AVR8_REG_A; reg <= AVR8_REG_B; reg++) { @@ -111,7 +113,7 @@ static TIMER_CALLBACK( avr8_timer1_tick ) switch(mode) { case 0: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); break; case 1: @@ -128,14 +130,14 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_PWM_10_PC: case Avr8::WGM1_PWM_PFC_ICR: case Avr8::WGM1_PWM_PC_ICR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); break; case Avr8::WGM1_FAST_PWM_ICR: case Avr8::WGM1_FAST_PWM_OCR: case Avr8::WGM1_PWM_PFC_OCR: case Avr8::WGM1_PWM_PC_OCR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Toggle OC1A on compare match, OC1B disconnected\n"); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Toggle OC1A on compare match, OC1B disconnected\n"); break; } break; @@ -146,7 +148,7 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_NORMAL: case Avr8::WGM1_CTC_OCR: case Avr8::WGM1_CTC_ICR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match\n", avr8_reg_name[reg]); break; case Avr8::WGM1_PWM_8_PC: @@ -156,7 +158,7 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_PWM_PC_ICR: case Avr8::WGM1_PWM_PFC_OCR: case Avr8::WGM1_PWM_PC_OCR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Clear OC1%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Clear OC1%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); break; case Avr8::WGM1_FAST_PWM_8: @@ -164,7 +166,7 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_FAST_PWM_10: case Avr8::WGM1_FAST_PWM_ICR: case Avr8::WGM1_FAST_PWM_OCR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match, set at BOTTOM\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match, set at BOTTOM\n", avr8_reg_name[reg]); break; } break; @@ -175,7 +177,7 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_NORMAL: case Avr8::WGM1_CTC_OCR: case Avr8::WGM1_CTC_ICR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match\n", avr8_reg_name[reg]); break; case Avr8::WGM1_PWM_8_PC: @@ -185,7 +187,7 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_PWM_PC_ICR: case Avr8::WGM1_PWM_PFC_OCR: case Avr8::WGM1_PWM_PC_OCR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Set OC1%c on match when up-counting, clear on match when down-counting\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Set OC1%c on match when up-counting, clear on match when down-counting\n", avr8_reg_name[reg]); break; case Avr8::WGM1_FAST_PWM_8: @@ -193,12 +195,12 @@ static TIMER_CALLBACK( avr8_timer1_tick ) case Avr8::WGM1_FAST_PWM_10: case Avr8::WGM1_FAST_PWM_ICR: case Avr8::WGM1_FAST_PWM_OCR: - //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match, clear at BOTTOM\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match, clear at BOTTOM\n", avr8_reg_name[reg]); break; } break; default: - verboselog(machine, 0, "avr8_update_timer1_compare_mode: Unknown COM1%c mode setting (%d)\n", avr8_reg_name[reg], mode); + verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Unknown COM1%c mode setting (%d)\n", avr8_reg_name[reg], mode); break; } } @@ -544,13 +546,12 @@ static void avr8_update_timer1_input_edge_select(running_machine &machine) verboselog(machine, 0, "avr8_update_timer1_input_edge_select: TODO; Clocking edge is %s\n", "test"); } -static TIMER_CALLBACK( avr8_timer2_tick ) +TIMER_CALLBACK_MEMBER(craft_state::avr8_timer2_tick) { /* TODO: Handle comparison, setting OC2x pins, detection of BOTTOM and TOP - craft_state *state = machine.driver_data(); UINT16 count = AVR8_TCNT2; - count += state->m_timer1_increment; + count += m_timer1_increment; for(INT32 reg = AVR8_REG_A; reg <= AVR8_REG_B; reg++) { UINT8 mode = (reg == AVR8_REG_A) ? AVR8_TCCR2A_COM2A : AVR8_TCCR2A_COM2B; @@ -558,7 +559,7 @@ static TIMER_CALLBACK( avr8_timer2_tick ) if(!mode) { // Normal port operation, OC2n disconnected - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); return; } @@ -569,13 +570,13 @@ static TIMER_CALLBACK( avr8_timer2_tick ) switch(mode) { case 1: // Toggle OC2n on Compare Match - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on Compare Match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on Compare Match\n", avr8_reg_name[reg]); break; case 2: // Clear OC2n on Compare Match - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on Compare Match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on Compare Match\n", avr8_reg_name[reg]); break; case 3: // Set OC2n on Compare Match - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on Compare Match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on Compare Match\n", avr8_reg_name[reg]); break; } break; @@ -584,13 +585,13 @@ static TIMER_CALLBACK( avr8_timer2_tick ) switch(mode) { case 1: // Normal port operation, OC2n disconnected - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); break; case 2: // Clear OC2n on match when up-counting, set when down-counting - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); break; case 3: // Set OC2n on match when up-counting, clear when down-counting - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); break; } break; @@ -599,13 +600,13 @@ static TIMER_CALLBACK( avr8_timer2_tick ) switch(mode) { case 1: // Toggle OC2n on compare match - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); break; case 2: // Clear OC2n on match when up-counting, set when down-counting - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); break; case 3: // Set OC2n on match when up-counting, clear when down-counting - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); break; } break; @@ -615,13 +616,13 @@ static TIMER_CALLBACK( avr8_timer2_tick ) switch(mode) { case 1: // Normal port operation, OC2n disconnected - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); break; case 2: // Clear OC2n on match, set at BOTTOM - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); break; case 3: // Set OC2n on match, clear at BOTTOM - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); break; } break; @@ -630,13 +631,13 @@ static TIMER_CALLBACK( avr8_timer2_tick ) switch(mode) { case 1: // Toggle OC2n on compare match - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); break; case 2: // Clear OC2n on match, set at BOTTOM - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); break; case 3: // Set OC2n on match, clear at BOTTOM - //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); + //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); break; } break; diff --git a/src/mess/drivers/dectalk.c b/src/mess/drivers/dectalk.c index 7454083f8c6..826135d3278 100644 --- a/src/mess/drivers/dectalk.c +++ b/src/mess/drivers/dectalk.c @@ -194,6 +194,7 @@ public: DECLARE_READ16_MEMBER(spc_semaphore_r); DECLARE_DRIVER_INIT(dectalk); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(outfifo_read_cb); }; @@ -697,15 +698,15 @@ INPUT_PORTS_END /****************************************************************************** Machine Drivers ******************************************************************************/ -static TIMER_CALLBACK( outfifo_read_cb ) +TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb) { UINT16 data; - dac_device *speaker = machine.device("dac"); - data = dectalk_outfifo_r(machine); + dac_device *speaker = machine().device("dac"); + data = dectalk_outfifo_r(machine()); #ifdef VERBOSE if (data!= 0x8000) logerror("sample output: %04X\n", data); #endif - machine.scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb)); + machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this)); speaker->write_signed16(data); } @@ -714,7 +715,7 @@ DRIVER_INIT_MEMBER(dectalk_state,dectalk) { dectalk_clear_all_fifos(machine()); m_simulate_outfifo_error = 0; - machine().scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb)); + machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this)); } static WRITE8_DEVICE_HANDLER( dectalk_kbd_put ) diff --git a/src/mess/drivers/h19.c b/src/mess/drivers/h19.c index 8c1d5339218..d2b0dccbf65 100644 --- a/src/mess/drivers/h19.c +++ b/src/mess/drivers/h19.c @@ -66,13 +66,13 @@ public: UINT8 m_term_data; virtual void machine_reset(); virtual void video_start(); + TIMER_CALLBACK_MEMBER(h19_beepoff); }; -static TIMER_CALLBACK( h19_beepoff ) +TIMER_CALLBACK_MEMBER(h19_state::h19_beepoff) { - h19_state *state = machine.driver_data(); - beep_set_state(state->m_beep, 0); + beep_set_state(m_beep, 0); } READ8_MEMBER( h19_state::h19_80_r ) @@ -99,7 +99,7 @@ WRITE8_MEMBER( h19_state::h19_c0_w ) UINT8 length = (offset & 0x20) ? 200 : 4; beep_set_state(m_beep, 1); - machine().scheduler().timer_set(attotime::from_msec(length), FUNC(h19_beepoff)); + machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(h19_state::h19_beepoff),this)); } static ADDRESS_MAP_START(h19_mem, AS_PROGRAM, 8, h19_state) diff --git a/src/mess/drivers/ip20.c b/src/mess/drivers/ip20.c index 9038ef93898..cfdccdc7964 100644 --- a/src/mess/drivers/ip20.c +++ b/src/mess/drivers/ip20.c @@ -63,6 +63,7 @@ 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); }; @@ -495,15 +496,15 @@ DRIVER_INIT_MEMBER(ip20_state,ip204415) { } -static TIMER_CALLBACK(ip20_timer) +TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer) { - ip20_state *state = machine.driver_data(); + ip20_state *state = machine().driver_data(); // update RTC every 10 milliseconds - state->m_RTC.nTemp++; - if (state->m_RTC.nTemp >= 10) + m_RTC.nTemp++; + if (m_RTC.nTemp >= 10) { - state->m_RTC.nTemp = 0; + m_RTC.nTemp = 0; RTC_HUNDREDTH++; if( ( RTC_HUNDREDTH & 0x0f ) == 0x0a ) @@ -551,7 +552,7 @@ static TIMER_CALLBACK(ip20_timer) } } - machine.scheduler().timer_set(attotime::from_msec(1), FUNC(ip20_timer)); + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip20_state::ip20_timer),this)); } void ip20_state::machine_start() @@ -568,7 +569,7 @@ void ip20_state::machine_start() m_RTC.nTemp = 0; - machine().scheduler().timer_set(attotime::from_msec(1), FUNC(ip20_timer)); + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip20_state::ip20_timer),this)); } static INPUT_PORTS_START( ip204415 ) diff --git a/src/mess/drivers/ip22.c b/src/mess/drivers/ip22.c index 44b442dc1b5..39036edc5d7 100644 --- a/src/mess/drivers/ip22.c +++ b/src/mess/drivers/ip22.c @@ -132,6 +132,8 @@ public: virtual void machine_start(); virtual void machine_reset(); INTERRUPT_GEN_MEMBER(ip22_vbl); + TIMER_CALLBACK_MEMBER(ip22_dma); + TIMER_CALLBACK_MEMBER(ip22_timer); }; @@ -1073,37 +1075,36 @@ WRITE32_MEMBER(ip22_state::hal2_w) #define PBUS_DMADESC_BC 0x00003fff -static TIMER_CALLBACK(ip22_dma) +TIMER_CALLBACK_MEMBER(ip22_state::ip22_dma) { - //ip22_state *state = machine.driver_data(); - machine.scheduler().timer_set(attotime::never, FUNC(ip22_dma)); + machine().scheduler().timer_set(attotime::never, timer_expired_delegate(FUNC(ip22_state::ip22_dma),this)); #if 0 - if( state->m_PBUS_DMA.nActive ) + if( m_PBUS_DMA.nActive ) { - UINT16 temp16 = ( state->m_mainram[(state->m_PBUS_DMA.nCurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; + UINT16 temp16 = ( m_mainram[(m_PBUS_DMA.nCurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; INT16 stemp16 = (INT16)((temp16 >> 8) | (temp16 << 8)); - machine.device("dac")->write_signed16(stemp16 ^ 0x8000); + machine().device("dac")->write_signed16(stemp16 ^ 0x8000); - state->m_PBUS_DMA.nCurPtr += 4; + m_PBUS_DMA.nCurPtr += 4; - state->m_PBUS_DMA.nWordsLeft -= 4; - if( state->m_PBUS_DMA.nWordsLeft == 0 ) + m_PBUS_DMA.nWordsLeft -= 4; + if( m_PBUS_DMA.nWordsLeft == 0 ) { - if( state->m_PBUS_DMA.nNextPtr != 0 ) + if( m_PBUS_DMA.nNextPtr != 0 ) { - state->m_PBUS_DMA.nDescPtr = state->m_PBUS_DMA.nNextPtr; - state->m_PBUS_DMA.nCurPtr = state->m_mainram[(state->m_PBUS_DMA.nDescPtr - 0x08000000)/4]; - state->m_PBUS_DMA.nWordsLeft = state->m_mainram[(state->m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; - state->m_PBUS_DMA.nNextPtr = state->m_mainram[(state->m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; + m_PBUS_DMA.nDescPtr = m_PBUS_DMA.nNextPtr; + m_PBUS_DMA.nCurPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4]; + m_PBUS_DMA.nWordsLeft = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; + m_PBUS_DMA.nNextPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; } else { - state->m_PBUS_DMA.nActive = 0; + m_PBUS_DMA.nActive = 0; return; } } - machine.scheduler().timer_set(attotime::from_hz(44100), FUNC(ip22_dma)); + machine().scheduler().timer_set(attotime::from_hz(44100), timer_expired_delegate(FUNC(ip22_state::ip22_dma),this)); } #endif } @@ -1173,7 +1174,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), FUNC(ip22_dma)); + machine().scheduler().timer_set(attotime::from_hz(44100), timer_expired_delegate(FUNC(ip22_state::ip22_dma),this)); m_PBUS_DMA.nActive = 1; } return; @@ -1216,9 +1217,9 @@ static ADDRESS_MAP_START( ip225015_map, AS_PROGRAM, 32, ip22_state ) ADDRESS_MAP_END -static TIMER_CALLBACK(ip22_timer) +TIMER_CALLBACK_MEMBER(ip22_state::ip22_timer) { - machine.scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer)); + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip22_state::ip22_timer),this)); } void ip22_state::machine_reset() @@ -1230,7 +1231,7 @@ void ip22_state::machine_reset() RTC_REGISTERB = 0x08; RTC_REGISTERD = 0x80; - machine().scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer)); + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip22_state::ip22_timer),this)); // set up low RAM mirror membank("bank1")->set_base(m_mainram); diff --git a/src/mess/drivers/jr200.c b/src/mess/drivers/jr200.c index 80555b0ead8..de4f782c99f 100644 --- a/src/mess/drivers/jr200.c +++ b/src/mess/drivers/jr200.c @@ -53,6 +53,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(timer_d_callback); }; @@ -283,9 +284,9 @@ WRITE8_MEMBER(jr200_state::jr200_border_col_w) } -static TIMER_CALLBACK(timer_d_callback) +TIMER_CALLBACK_MEMBER(jr200_state::timer_d_callback) { - machine.firstcpu->set_input_line(0, HOLD_LINE); + machine().firstcpu->set_input_line(0, HOLD_LINE); } READ8_MEMBER(jr200_state::mn1271_io_r) @@ -484,7 +485,7 @@ void jr200_state::machine_start() { beep_set_frequency(machine().device(BEEPER_TAG),0); beep_set_state(machine().device(BEEPER_TAG),0); - m_timer_d = machine().scheduler().timer_alloc(FUNC(timer_d_callback)); + m_timer_d = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jr200_state::timer_d_callback),this)); } void jr200_state::machine_reset() diff --git a/src/mess/drivers/mekd2.c b/src/mess/drivers/mekd2.c index fe6e19fa23e..4bbb8c55dc4 100644 --- a/src/mess/drivers/mekd2.c +++ b/src/mess/drivers/mekd2.c @@ -65,6 +65,7 @@ public: UINT8 m_segment; UINT8 m_digit; UINT8 m_keydata; + TIMER_CALLBACK_MEMBER(mekd2_trace); }; @@ -159,9 +160,9 @@ INPUT_PORTS_END ************************************************************/ -static TIMER_CALLBACK( mekd2_trace ) +TIMER_CALLBACK_MEMBER(mekd2_state::mekd2_trace) { - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w ) @@ -169,7 +170,7 @@ WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w ) if (state) machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); else - machine().scheduler().timer_set(attotime::from_usec(18), FUNC(mekd2_trace)); + machine().scheduler().timer_set(attotime::from_usec(18), timer_expired_delegate(FUNC(mekd2_state::mekd2_trace),this)); } diff --git a/src/mess/drivers/ng_aes.c b/src/mess/drivers/ng_aes.c index a0934d40bd7..d56f234fbd5 100644 --- a/src/mess/drivers/ng_aes.c +++ b/src/mess/drivers/ng_aes.c @@ -93,6 +93,9 @@ public: DECLARE_MACHINE_RESET(neogeo); DECLARE_CUSTOM_INPUT_MEMBER(get_memcard_status); + TIMER_CALLBACK_MEMBER(display_position_interrupt_callback); + TIMER_CALLBACK_MEMBER(display_position_vblank_callback); + TIMER_CALLBACK_MEMBER(vblank_interrupt_callback); }; @@ -171,67 +174,64 @@ static void update_interrupts( running_machine &machine ) } -static TIMER_CALLBACK( display_position_interrupt_callback ) +TIMER_CALLBACK_MEMBER(ng_aes_state::display_position_interrupt_callback) { - neogeo_state *state = machine.driver_data(); - if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", machine.primary_screen->vpos(), machine.primary_screen->hpos()); + if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); - if (state->m_display_position_interrupt_control & IRQ2CTRL_ENABLE) + if (m_display_position_interrupt_control & IRQ2CTRL_ENABLE) { - if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", machine.primary_screen->vpos(), machine.primary_screen->hpos()); - state->m_display_position_interrupt_pending = 1; + if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); + m_display_position_interrupt_pending = 1; - update_interrupts(machine); + update_interrupts(machine()); } - if (state->m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT) + if (m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT) { if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_REPEAT "); - adjust_display_position_interrupt_timer(machine); + adjust_display_position_interrupt_timer(machine()); } } -static TIMER_CALLBACK( display_position_vblank_callback ) +TIMER_CALLBACK_MEMBER(ng_aes_state::display_position_vblank_callback) { - neogeo_state *state = machine.driver_data(); - if (state->m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_VBLANK) + if (m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_VBLANK) { if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_VBLANK "); - adjust_display_position_interrupt_timer(machine); + adjust_display_position_interrupt_timer(machine()); } /* set timer for next screen */ - state->m_display_position_vblank_timer->adjust(machine.primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS)); + m_display_position_vblank_timer->adjust(machine().primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS)); } -static TIMER_CALLBACK( vblank_interrupt_callback ) +TIMER_CALLBACK_MEMBER(ng_aes_state::vblank_interrupt_callback) { - neogeo_state *state = machine.driver_data(); - if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", machine.primary_screen->vpos(), machine.primary_screen->hpos()); + if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); /* add a timer tick to the pd4990a */ - upd4990a_addretrace(state->m_upd4990a); + upd4990a_addretrace(m_upd4990a); - state->m_vblank_interrupt_pending = 1; + m_vblank_interrupt_pending = 1; - update_interrupts(machine); + update_interrupts(machine()); /* set timer for next screen */ - state->m_vblank_interrupt_timer->adjust(machine.primary_screen->time_until_pos(NEOGEO_VBSTART, 0)); + m_vblank_interrupt_timer->adjust(machine().primary_screen->time_until_pos(NEOGEO_VBSTART, 0)); } static void create_interrupt_timers( running_machine &machine ) { - neogeo_state *state = machine.driver_data(); - state->m_display_position_interrupt_timer = machine.scheduler().timer_alloc(FUNC(display_position_interrupt_callback)); - state->m_display_position_vblank_timer = machine.scheduler().timer_alloc(FUNC(display_position_vblank_callback)); - state->m_vblank_interrupt_timer = machine.scheduler().timer_alloc(FUNC(vblank_interrupt_callback)); + ng_aes_state *state = machine.driver_data(); + state->m_display_position_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ng_aes_state::display_position_interrupt_callback),state)); + state->m_display_position_vblank_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ng_aes_state::display_position_vblank_callback),state)); + state->m_vblank_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ng_aes_state::vblank_interrupt_callback),state)); } diff --git a/src/mess/drivers/ngp.c b/src/mess/drivers/ngp.c index 798ddf4c8be..61539377b82 100644 --- a/src/mess/drivers/ngp.c +++ b/src/mess/drivers/ngp.c @@ -166,38 +166,38 @@ public: DECLARE_WRITE8_MEMBER( ngp_tlcs900_to3 ); UINT32 screen_update_ngp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_INPUT_CHANGED_MEMBER(power_callback); + TIMER_CALLBACK_MEMBER(ngp_seconds_callback); }; -static TIMER_CALLBACK( ngp_seconds_callback ) +TIMER_CALLBACK_MEMBER(ngp_state::ngp_seconds_callback) { - ngp_state *state = machine.driver_data(); - state->m_io_reg[0x16] += 1; - if ( ( state->m_io_reg[0x16] & 0x0f ) == 0x0a ) + m_io_reg[0x16] += 1; + if ( ( m_io_reg[0x16] & 0x0f ) == 0x0a ) { - state->m_io_reg[0x16] += 0x06; + m_io_reg[0x16] += 0x06; } - if ( state->m_io_reg[0x16] >= 0x60 ) + if ( m_io_reg[0x16] >= 0x60 ) { - state->m_io_reg[0x16] = 0; - state->m_io_reg[0x15] += 1; - if ( ( state->m_io_reg[0x15] & 0x0f ) == 0x0a ) { - state->m_io_reg[0x15] += 0x06; + m_io_reg[0x16] = 0; + m_io_reg[0x15] += 1; + if ( ( m_io_reg[0x15] & 0x0f ) == 0x0a ) { + m_io_reg[0x15] += 0x06; } - if ( state->m_io_reg[0x15] >= 0x60 ) + if ( m_io_reg[0x15] >= 0x60 ) { - state->m_io_reg[0x15] = 0; - state->m_io_reg[0x14] += 1; - if ( ( state->m_io_reg[0x14] & 0x0f ) == 0x0a ) { - state->m_io_reg[0x14] += 0x06; + m_io_reg[0x15] = 0; + m_io_reg[0x14] += 1; + if ( ( m_io_reg[0x14] & 0x0f ) == 0x0a ) { + m_io_reg[0x14] += 0x06; } - if ( state->m_io_reg[0x14] == 0x24 ) + if ( m_io_reg[0x14] == 0x24 ) { - state->m_io_reg[0x14] = 0; + m_io_reg[0x14] = 0; } } } @@ -603,7 +603,7 @@ WRITE8_MEMBER( ngp_state::ngp_tlcs900_to3 ) void ngp_state::machine_start() { - m_seconds_timer = machine().scheduler().timer_alloc(FUNC(ngp_seconds_callback)); + m_seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ngp_state::ngp_seconds_callback),this)); m_seconds_timer->adjust( attotime::from_seconds(1), 0, attotime::from_seconds(1) ); } diff --git a/src/mess/drivers/okean240.c b/src/mess/drivers/okean240.c index e6c204d9a9c..89f7030902e 100644 --- a/src/mess/drivers/okean240.c +++ b/src/mess/drivers/okean240.c @@ -80,6 +80,7 @@ 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); }; // okean240 requires bit 4 to change @@ -356,15 +357,14 @@ INPUT_PORTS_END /* after the first 6 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( okean240_boot ) +TIMER_CALLBACK_MEMBER(okean240_state::okean240_boot) { - okean240_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } void okean240_state::machine_reset() { - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(okean240_boot)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(okean240_state::okean240_boot),this)); membank("boot")->set_entry(1); m_term_data = 0; m_j = 0; diff --git a/src/mess/drivers/osbexec.c b/src/mess/drivers/osbexec.c index beea7d061c0..0390a576a42 100644 --- a/src/mess/drivers/osbexec.c +++ b/src/mess/drivers/osbexec.c @@ -110,6 +110,7 @@ public: DECLARE_DRIVER_INIT(osbexec); virtual void machine_reset(); virtual void palette_init(); + TIMER_CALLBACK_MEMBER(osbexec_video_callback); }; @@ -551,42 +552,41 @@ static const floppy_interface osbexec_floppy_interface = }; -static TIMER_CALLBACK( osbexec_video_callback ) +TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) { - osbexec_state *state = machine.driver_data(); - int y = machine.primary_screen->vpos(); + int y = machine().primary_screen->vpos(); /* Start of frame */ if ( y == 0 ) { /* Clear CB1 on PIA @ UD12 */ - state->m_pia_0->cb1_w(0); + m_pia_0->cb1_w(0); } else if ( y == 240 ) { /* Set CB1 on PIA @ UD12 */ - state->m_pia_0->cb1_w(1); - state->m_rtc++; + m_pia_0->cb1_w(1); + m_rtc++; } if ( y < 240 ) { UINT16 row_addr = ( y / 10 ) * 128; - UINT16 *p = &state->m_bitmap.pix16(y); + UINT16 *p = &m_bitmap.pix16(y); UINT8 char_line = y % 10; for ( int x = 0; x < 80; x++ ) { - UINT8 ch = state->m_vram[ row_addr + x ]; - UINT8 attr = state->m_vram[ 0x1000 + row_addr + x ]; + UINT8 ch = m_vram[ row_addr + x ]; + UINT8 attr = m_vram[ 0x1000 + row_addr + x ]; UINT8 fg_col = ( attr & 0x80 ) ? 1 : 2; - UINT8 font_bits = state->m_fontram[ ( ( attr & 0x10 ) ? 0x800 : 0 ) + ( ch & 0x7f ) * 16 + char_line ]; + UINT8 font_bits = m_fontram[ ( ( attr & 0x10 ) ? 0x800 : 0 ) + ( ch & 0x7f ) * 16 + char_line ]; /* Check for underline */ if ( ( attr & 0x40 ) && char_line == 9 ) font_bits = 0xFF; /* Check for blink */ - if ( ( attr & 0x20 ) && ( state->m_rtc & 0x10 ) ) + if ( ( attr & 0x20 ) && ( m_rtc & 0x10 ) ) font_bits = 0; /* Check for inverse video */ @@ -601,7 +601,7 @@ static TIMER_CALLBACK( osbexec_video_callback ) } } - state->m_video_timer->adjust( machine.primary_screen->time_until_pos( y + 1, 0 ) ); + m_video_timer->adjust( machine().primary_screen->time_until_pos( y + 1, 0 ) ); } @@ -617,7 +617,7 @@ DRIVER_INIT_MEMBER(osbexec_state,osbexec) memset( m_fontram, 0x00, 0x1000 ); memset( m_vram, 0x00, 0x2000 ); - m_video_timer = machine().scheduler().timer_alloc(FUNC(osbexec_video_callback)); + m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osbexec_state::osbexec_video_callback),this)); } diff --git a/src/mess/drivers/pb1000.c b/src/mess/drivers/pb1000.c index a5c490016f7..794a1992ac9 100644 --- a/src/mess/drivers/pb1000.c +++ b/src/mess/drivers/pb1000.c @@ -51,6 +51,7 @@ public: void kb_matrix_w(running_machine &machine, UINT8 matrix); UINT16 read_touchscreen(running_machine &machine, UINT8 line); virtual void palette_init(); + TIMER_CALLBACK_MEMBER(keyboard_timer); }; static ADDRESS_MAP_START(pb1000_mem, AS_PROGRAM, 16, pb1000_state) @@ -482,17 +483,17 @@ static const hd61700_config pb2000c_config = port_w //8 bit port write }; -static TIMER_CALLBACK( keyboard_timer ) +TIMER_CALLBACK_MEMBER(pb1000_state::keyboard_timer) { - machine.device("maincpu")->execute().set_input_line(HD61700_KEY_INT, ASSERT_LINE); - machine.device("maincpu")->execute().set_input_line(HD61700_KEY_INT, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(HD61700_KEY_INT, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(HD61700_KEY_INT, CLEAR_LINE); } void pb1000_state::machine_start() { membank("bank1")->set_base(machine().root_device().memregion("rom")->base()); - m_kb_timer = machine().scheduler().timer_alloc(FUNC(keyboard_timer)); + m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pb1000_state::keyboard_timer),this)); m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192)); } diff --git a/src/mess/drivers/pc6001.c b/src/mess/drivers/pc6001.c index e4de11fddba..5709692b905 100644 --- a/src/mess/drivers/pc6001.c +++ b/src/mess/drivers/pc6001.c @@ -235,6 +235,7 @@ public: UINT32 screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(pc6001_interrupt); INTERRUPT_GEN_MEMBER(pc6001sr_interrupt); + TIMER_CALLBACK_MEMBER(audio_callback); }; @@ -1357,14 +1358,13 @@ WRITE8_MEMBER(pc6001_state::pc6001m2_0xf3_w) m_timer_irq_mask2 = data & 4; } -static TIMER_CALLBACK(audio_callback) +TIMER_CALLBACK_MEMBER(pc6001_state::audio_callback) { - pc6001_state *state = machine.driver_data(); - if(state->m_cas_switch == 0 && ((state->m_timer_irq_mask == 0) || (state->m_timer_irq_mask2 == 0))) + if(m_cas_switch == 0 && ((m_timer_irq_mask == 0) || (m_timer_irq_mask2 == 0))) { - if(IRQ_LOG) printf("Timer IRQ called %02x\n",state->m_timer_irq_vector); - state->m_irq_vector = state->m_timer_irq_vector; - machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); + if(IRQ_LOG) printf("Timer IRQ called %02x\n",m_timer_irq_vector); + m_irq_vector = m_timer_irq_vector; + machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); } } @@ -2106,7 +2106,7 @@ void pc6001_state::machine_start() m_timer_hz_div = 3; { attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); - m_timer_irq_timer = machine().scheduler().timer_alloc(FUNC(audio_callback)); + m_timer_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc6001_state::audio_callback),this)); m_timer_irq_timer->adjust(period, 0, period); } } diff --git a/src/mess/drivers/pc8801.c b/src/mess/drivers/pc8801.c index cd45bcdabce..b5ac36983ee 100644 --- a/src/mess/drivers/pc8801.c +++ b/src/mess/drivers/pc8801.c @@ -452,6 +452,7 @@ public: DECLARE_MACHINE_RESET(pc8801_dic); DECLARE_MACHINE_RESET(pc8801_cdrom); INTERRUPT_GEN_MEMBER(pc8801_vrtc_irq); + TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); }; @@ -1877,12 +1878,11 @@ static ADDRESS_MAP_START( pc8801fdc_mem, AS_PROGRAM, 8, pc8801_state ) AM_RANGE(0x4000, 0x7fff) AM_RAM ADDRESS_MAP_END -static TIMER_CALLBACK( pc8801fd_upd765_tc_to_zero ) +TIMER_CALLBACK_MEMBER(pc8801_state::pc8801fd_upd765_tc_to_zero) { -// pc8801_state *state = machine.driver_data(); //printf("0\n"); - upd765_tc_w(machine.device("upd765"), 0); + upd765_tc_w(machine().device("upd765"), 0); } WRITE8_MEMBER(pc8801_state::upd765_mc_w) @@ -1899,7 +1899,7 @@ READ8_MEMBER(pc8801_state::upd765_tc_r) upd765_tc_w(machine().device("upd765"), 1); //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha. - machine().scheduler().timer_set(attotime::from_usec(750), FUNC(pc8801fd_upd765_tc_to_zero)); + machine().scheduler().timer_set(attotime::from_usec(750), timer_expired_delegate(FUNC(pc8801_state::pc8801fd_upd765_tc_to_zero),this)); return 0xff; // value is meaningless } diff --git a/src/mess/drivers/pc88va.c b/src/mess/drivers/pc88va.c index 2fc235369f2..8ccd9ce4e13 100644 --- a/src/mess/drivers/pc88va.c +++ b/src/mess/drivers/pc88va.c @@ -103,6 +103,8 @@ 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); }; @@ -944,18 +946,17 @@ WRITE8_MEMBER(pc88va_state::upd765_mc_w) floppy_drive_set_ready_state(floppy_get_device(machine(), 1), (data & 2), 0); } -static TIMER_CALLBACK( pc8801fd_upd765_tc_to_zero ) +TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero) { -// pc88va_state *state = machine.driver_data(); - upd765_tc_w(machine.device("upd765"), 0); + upd765_tc_w(machine().device("upd765"), 0); } READ8_MEMBER(pc88va_state::upd765_tc_r) { upd765_tc_w(machine().device("upd765"), 1); - machine().scheduler().timer_set(attotime::from_usec(500), FUNC(pc8801fd_upd765_tc_to_zero)); + machine().scheduler().timer_set(attotime::from_usec(500), timer_expired_delegate(FUNC(pc88va_state::pc8801fd_upd765_tc_to_zero),this)); return 0; } @@ -1038,13 +1039,12 @@ WRITE16_MEMBER(pc88va_state::screen_ctrl_w) m_screen_ctrl_reg = data; } -static TIMER_CALLBACK( t3_mouse_callback ) +TIMER_CALLBACK_MEMBER(pc88va_state::t3_mouse_callback) { - pc88va_state *state = machine.driver_data(); - if(state->m_timer3_io_reg & 0x80) + if(m_timer3_io_reg & 0x80) { - pic8259_ir5_w(machine.device("pic8259_slave"), 1); - state->m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (state->m_timer3_io_reg & 3))); + pic8259_ir5_w(machine().device("pic8259_slave"), 1); + m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); } } @@ -1533,7 +1533,7 @@ void pc88va_state::machine_start() { machine().device("maincpu")->execute().set_irq_acknowledge_callback(pc88va_irq_callback); - m_t3_mouse_timer = machine().scheduler().timer_alloc(FUNC(t3_mouse_callback)); + m_t3_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc88va_state::t3_mouse_callback),this)); m_t3_mouse_timer->adjust(attotime::never); } diff --git a/src/mess/drivers/pcfx.c b/src/mess/drivers/pcfx.c index 8dad94a509e..f4e79831ec5 100644 --- a/src/mess/drivers/pcfx.c +++ b/src/mess/drivers/pcfx.c @@ -60,6 +60,7 @@ public: DECLARE_WRITE_LINE_MEMBER( irq13_w ); DECLARE_WRITE_LINE_MEMBER( irq14_w ); DECLARE_WRITE_LINE_MEMBER( irq15_w ); + TIMER_CALLBACK_MEMBER(pad_func); }; @@ -117,16 +118,15 @@ READ16_MEMBER( pcfx_state::pad_r ) return res; } -static TIMER_CALLBACK(pad_func) +TIMER_CALLBACK_MEMBER(pcfx_state::pad_func) { - pcfx_state *state = machine.driver_data(); const char *const padnames[] = { "P1", "P2" }; - state->m_pad.latch[param] = machine.root_device().ioport(padnames[param])->read(); - state->m_pad.status[param] |= 8; - state->m_pad.ctrl[param] &= ~1; // ack TX line + m_pad.latch[param] = machine().root_device().ioport(padnames[param])->read(); + m_pad.status[param] |= 8; + m_pad.ctrl[param] &= ~1; // ack TX line // TODO: pad IRQ -// state->set_irq_line(11, 1); +// set_irq_line(11, 1); } WRITE16_MEMBER( pcfx_state::pad_w ) @@ -143,7 +143,7 @@ WRITE16_MEMBER( pcfx_state::pad_w ) */ if(data & 1 && (!(m_pad.ctrl[port_type] & 1))) { - machine().scheduler().timer_set(attotime::from_msec(1), FUNC(pad_func), port_type); // TODO: time + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(pcfx_state::pad_func),this), port_type); // TODO: time } m_pad.ctrl[port_type] = data & 7; diff --git a/src/mess/drivers/plan80.c b/src/mess/drivers/plan80.c index c06cbd83f89..6af526b59fd 100644 --- a/src/mess/drivers/plan80.c +++ b/src/mess/drivers/plan80.c @@ -44,6 +44,7 @@ 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); }; READ8_MEMBER( plan80_state::plan80_04_r ) @@ -140,16 +141,15 @@ INPUT_PORTS_END /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( plan80_boot ) +TIMER_CALLBACK_MEMBER(plan80_state::plan80_boot) { - plan80_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } void plan80_state::machine_reset() { membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(plan80_boot)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(plan80_state::plan80_boot),this)); } DRIVER_INIT_MEMBER(plan80_state,plan80) diff --git a/src/mess/drivers/pockstat.c b/src/mess/drivers/pockstat.c index d6893dadbac..bc21a6845de 100644 --- a/src/mess/drivers/pockstat.c +++ b/src/mess/drivers/pockstat.c @@ -124,6 +124,8 @@ public: virtual void machine_reset(); UINT32 screen_update_pockstat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_INPUT_CHANGED_MEMBER(input_update); + TIMER_CALLBACK_MEMBER(timer_tick); + TIMER_CALLBACK_MEMBER(rtc_tick); }; @@ -182,7 +184,7 @@ static void ps_intc_set_interrupt_line(running_machine &machine, UINT32 line, in // Timers -static TIMER_CALLBACK( timer_tick ); + static void ps_timer_start(running_machine &machine, int index); @@ -192,7 +194,7 @@ static void ps_timer_start(running_machine &machine, int index); // RTC -static TIMER_CALLBACK( rtc_tick ); + @@ -422,13 +424,12 @@ WRITE32_MEMBER(pockstat_state::ps_intc_w) } } -static TIMER_CALLBACK( timer_tick ) +TIMER_CALLBACK_MEMBER(pockstat_state::timer_tick) { - pockstat_state *state = machine.driver_data(); - ps_intc_set_interrupt_line(machine, param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1); + ps_intc_set_interrupt_line(machine(), param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1); //printf( "Timer %d is calling back\n", param ); - state->m_timer_regs.timer[param].count = state->m_timer_regs.timer[param].period; - ps_timer_start(machine, param); + m_timer_regs.timer[param].count = m_timer_regs.timer[param].period; + ps_timer_start(machine(), param); } static void ps_timer_start(running_machine &machine, int index) @@ -561,51 +562,50 @@ WRITE32_MEMBER(pockstat_state::ps_clock_w) } } -static TIMER_CALLBACK( rtc_tick ) +TIMER_CALLBACK_MEMBER(pockstat_state::rtc_tick) { - pockstat_state *state = machine.driver_data(); //printf( "RTC is calling back\n" ); - ps_intc_set_interrupt_line(machine, PS_INT_RTC, ps_intc_get_interrupt_line(machine, PS_INT_RTC) ? 0 : 1); - if(!(state->m_rtc_regs.mode & 1)) + ps_intc_set_interrupt_line(machine(), PS_INT_RTC, ps_intc_get_interrupt_line(machine(), PS_INT_RTC) ? 0 : 1); + if(!(m_rtc_regs.mode & 1)) { - state->m_rtc_regs.time++; - if((state->m_rtc_regs.time & 0x0000000f) == 0x0000000a) + m_rtc_regs.time++; + if((m_rtc_regs.time & 0x0000000f) == 0x0000000a) { - state->m_rtc_regs.time &= 0xfffffff0; - state->m_rtc_regs.time += 0x00000010; - if((state->m_rtc_regs.time & 0x000000ff) == 0x00000060) + m_rtc_regs.time &= 0xfffffff0; + m_rtc_regs.time += 0x00000010; + if((m_rtc_regs.time & 0x000000ff) == 0x00000060) { - state->m_rtc_regs.time &= 0xffffff00; - state->m_rtc_regs.time += 0x00000100; - if((state->m_rtc_regs.time & 0x00000f00) == 0x00000a00) + m_rtc_regs.time &= 0xffffff00; + m_rtc_regs.time += 0x00000100; + if((m_rtc_regs.time & 0x00000f00) == 0x00000a00) { - state->m_rtc_regs.time &= 0xfffff0ff; - state->m_rtc_regs.time += 0x00001000; - if((state->m_rtc_regs.time & 0x0000ff00) == 0x00006000) + m_rtc_regs.time &= 0xfffff0ff; + m_rtc_regs.time += 0x00001000; + if((m_rtc_regs.time & 0x0000ff00) == 0x00006000) { - state->m_rtc_regs.time &= 0xffff00ff; - state->m_rtc_regs.time += 0x00010000; - if((state->m_rtc_regs.time & 0x00ff0000) == 0x00240000) + m_rtc_regs.time &= 0xffff00ff; + m_rtc_regs.time += 0x00010000; + if((m_rtc_regs.time & 0x00ff0000) == 0x00240000) { - state->m_rtc_regs.time &= 0xff00ffff; - state->m_rtc_regs.time += 0x01000000; - if((state->m_rtc_regs.time & 0x0f000000) == 0x08000000) + m_rtc_regs.time &= 0xff00ffff; + m_rtc_regs.time += 0x01000000; + if((m_rtc_regs.time & 0x0f000000) == 0x08000000) { - state->m_rtc_regs.time &= 0xf0ffffff; - state->m_rtc_regs.time |= 0x01000000; + m_rtc_regs.time &= 0xf0ffffff; + m_rtc_regs.time |= 0x01000000; } } - else if((state->m_rtc_regs.time & 0x000f0000) == 0x000a0000) + else if((m_rtc_regs.time & 0x000f0000) == 0x000a0000) { - state->m_rtc_regs.time &= 0xfff0ffff; - state->m_rtc_regs.time += 0x00100000; + m_rtc_regs.time &= 0xfff0ffff; + m_rtc_regs.time += 0x00100000; } } } } } } - state->m_rtc_regs.timer->adjust(attotime::from_hz(1)); + m_rtc_regs.timer->adjust(attotime::from_hz(1)); } READ32_MEMBER(pockstat_state::ps_rtc_r) @@ -875,14 +875,14 @@ void pockstat_state::machine_start() int index = 0; for(index = 0; index < 3; index++) { - m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(FUNC(timer_tick)); + m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::timer_tick),this)); m_timer_regs.timer[index].timer->adjust(attotime::never, index); } m_rtc_regs.time = 0x01000000; m_rtc_regs.date = 0x19990101; - m_rtc_regs.timer = machine().scheduler().timer_alloc(FUNC(rtc_tick)); + m_rtc_regs.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::rtc_tick),this)); m_rtc_regs.timer->adjust(attotime::from_hz(1), index); save_item(NAME(m_ftlb_regs.control)); diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c index 4344a94a9f7..7ce253fd690 100644 --- a/src/mess/drivers/psx.c +++ b/src/mess/drivers/psx.c @@ -55,6 +55,7 @@ public: DECLARE_DIRECT_UPDATE_MEMBER(psx_setopbase); DECLARE_DRIVER_INIT(psx); DECLARE_MACHINE_RESET(psx); + TIMER_CALLBACK_MEMBER(psx_pad_ack); }; @@ -493,19 +494,18 @@ static QUICKLOAD_LOAD( psx_exe_load ) #define PAD_DATA_OK ( 0x5a ) /* Z */ #define PAD_DATA_IDLE ( 0xff ) -static TIMER_CALLBACK(psx_pad_ack) +TIMER_CALLBACK_MEMBER(psx1_state::psx_pad_ack) { - psx1_state *state = machine.driver_data(); int n_port = param; - pad_t *pad = &state->m_pad[ n_port ]; + pad_t *pad = &m_pad[ n_port ]; if( pad->n_state != PAD_STATE_IDLE ) { - psx_sio_input( machine, 0, PSX_SIO_IN_DSR, pad->b_ack * PSX_SIO_IN_DSR ); + psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, pad->b_ack * PSX_SIO_IN_DSR ); if( !pad->b_ack ) { pad->b_ack = 1; - machine.scheduler().timer_set(attotime::from_usec( 2 ), FUNC(psx_pad_ack) , n_port); + machine().scheduler().timer_set(attotime::from_usec( 2 ), timer_expired_delegate(FUNC(psx1_state::psx_pad_ack),this) , n_port); } } } @@ -650,7 +650,7 @@ static void psx_pad( running_machine &machine, int n_port, int n_data ) if( b_ack ) { pad->b_ack = 0; - machine.scheduler().timer_set(attotime::from_usec( 10 ), FUNC(psx_pad_ack), n_port); + machine.scheduler().timer_set(attotime::from_usec( 10 ), timer_expired_delegate(FUNC(psx1_state::psx_pad_ack),state), n_port); } } diff --git a/src/mess/drivers/ptcsol.c b/src/mess/drivers/ptcsol.c index 543c7ee5628..f8dd419b5f1 100644 --- a/src/mess/drivers/ptcsol.c +++ b/src/mess/drivers/ptcsol.c @@ -180,6 +180,8 @@ private: emu_timer *m_cassette_timer; public: DECLARE_DRIVER_INIT(sol20); + TIMER_CALLBACK_MEMBER(sol20_cassette_tc); + TIMER_CALLBACK_MEMBER(sol20_boot); }; @@ -197,89 +199,88 @@ static cassette_image_device *cassette_device_image(running_machine &machine) // identical to sorcerer -static TIMER_CALLBACK(sol20_cassette_tc) +TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc) { - sol20_state *state = machine.driver_data(); UINT8 cass_ws = 0; - switch (state->m_sol20_fa & 0x20) + switch (m_sol20_fa & 0x20) { case 0x20: /* Cassette 300 baud */ /* loading a tape - this is basically the same as the super80. We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ - state->m_cass_data.input.length++; + m_cass_data.input.length++; - cass_ws = ((cassette_device_image(machine))->input() > +0.02) ? 1 : 0; + cass_ws = ((cassette_device_image(machine()))->input() > +0.02) ? 1 : 0; - if (cass_ws != state->m_cass_data.input.level) + if (cass_ws != m_cass_data.input.level) { - state->m_cass_data.input.level = cass_ws; - state->m_cass_data.input.bit = ((state->m_cass_data.input.length < 0x6) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0; - state->m_cass_data.input.length = 0; - ay31015_set_input_pin( state->m_uart, AY31015_SI, state->m_cass_data.input.bit ); + m_cass_data.input.level = cass_ws; + m_cass_data.input.bit = ((m_cass_data.input.length < 0x6) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + m_cass_data.input.length = 0; + ay31015_set_input_pin( m_uart, AY31015_SI, m_cass_data.input.bit ); } /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. Synchronisation of the frequency pulses to the uart is extremely important. */ - state->m_cass_data.output.length++; - if (!(state->m_cass_data.output.length & 0x1f)) + m_cass_data.output.length++; + if (!(m_cass_data.output.length & 0x1f)) { - cass_ws = ay31015_get_output_pin( state->m_uart, AY31015_SO ); - if (cass_ws != state->m_cass_data.output.bit) + cass_ws = ay31015_get_output_pin( m_uart, AY31015_SO ); + if (cass_ws != m_cass_data.output.bit) { - state->m_cass_data.output.bit = cass_ws; - state->m_cass_data.output.length = 0; + m_cass_data.output.bit = cass_ws; + m_cass_data.output.length = 0; } } - if (!(state->m_cass_data.output.length & 3)) + if (!(m_cass_data.output.length & 3)) { - if (!((state->m_cass_data.output.bit == 0) && (state->m_cass_data.output.length & 4))) + if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4))) { - state->m_cass_data.output.level ^= 1; // toggle output state, except on 2nd half of low bit - cassette_device_image(machine)->output(state->m_cass_data.output.level ? -1.0 : +1.0); + m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit + cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0); } } return; case 0x00: /* Cassette 1200 baud */ /* loading a tape */ - state->m_cass_data.input.length++; + m_cass_data.input.length++; - cass_ws = ((cassette_device_image(machine))->input() > +0.02) ? 1 : 0; + cass_ws = ((cassette_device_image(machine()))->input() > +0.02) ? 1 : 0; - if (cass_ws != state->m_cass_data.input.level || state->m_cass_data.input.length == 10) + if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10) { - state->m_cass_data.input.bit = ((state->m_cass_data.input.length < 10) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0; - if ( cass_ws != state->m_cass_data.input.level ) + m_cass_data.input.bit = ((m_cass_data.input.length < 10) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + if ( cass_ws != m_cass_data.input.level ) { - state->m_cass_data.input.length = 0; - state->m_cass_data.input.level = cass_ws; + m_cass_data.input.length = 0; + m_cass_data.input.level = cass_ws; } - ay31015_set_input_pin( state->m_uart, AY31015_SI, state->m_cass_data.input.bit ); + ay31015_set_input_pin( m_uart, AY31015_SI, m_cass_data.input.bit ); } /* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */ - state->m_cass_data.output.length++; - if (!(state->m_cass_data.output.length & 7)) + m_cass_data.output.length++; + if (!(m_cass_data.output.length & 7)) { - cass_ws = ay31015_get_output_pin( state->m_uart, AY31015_SO ); - if (cass_ws != state->m_cass_data.output.bit) + cass_ws = ay31015_get_output_pin( m_uart, AY31015_SO ); + if (cass_ws != m_cass_data.output.bit) { - state->m_cass_data.output.bit = cass_ws; - state->m_cass_data.output.length = 0; + m_cass_data.output.bit = cass_ws; + m_cass_data.output.length = 0; } } - if (!(state->m_cass_data.output.length & 7)) + if (!(m_cass_data.output.length & 7)) { - if (!((state->m_cass_data.output.bit == 0) && (state->m_cass_data.output.length & 8))) + if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8))) { - state->m_cass_data.output.level ^= 1; // toggle output state, except on 2nd half of low bit - cassette_device_image(machine)->output(state->m_cass_data.output.level ? -1.0 : +1.0); + m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit + cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0); } } return; @@ -538,15 +539,14 @@ static const cassette_interface sol20_cassette_interface = }; /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( sol20_boot ) +TIMER_CALLBACK_MEMBER(sol20_state::sol20_boot) { - sol20_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } void sol20_state::machine_start() { - m_cassette_timer = machine().scheduler().timer_alloc(FUNC(sol20_cassette_tc)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sol20_state::sol20_cassette_tc),this)); } void sol20_state::machine_reset() @@ -598,7 +598,7 @@ void sol20_state::machine_reset() // boot-bank membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(9), FUNC(sol20_boot)); + machine().scheduler().timer_set(attotime::from_usec(9), timer_expired_delegate(FUNC(sol20_state::sol20_boot),this)); } DRIVER_INIT_MEMBER(sol20_state,sol20) diff --git a/src/mess/drivers/pv1000.c b/src/mess/drivers/pv1000.c index 54dd3e75e30..fff5b898f38 100644 --- a/src/mess/drivers/pv1000.c +++ b/src/mess/drivers/pv1000.c @@ -100,6 +100,8 @@ public: virtual void machine_reset(); virtual void palette_init(); UINT32 screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(d65010_irq_on_cb); + TIMER_CALLBACK_MEMBER(d65010_irq_off_cb); }; @@ -345,38 +347,36 @@ static DEVICE_START( pv1000_sound ) /* Interrupt is triggering 16 times during vblank. */ /* we have chosen to trigger on scanlines 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255 */ -static TIMER_CALLBACK( d65010_irq_on_cb ) +TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_on_cb) { - pv1000_state *state = machine.driver_data(); - int vpos = state->m_screen->vpos(); + int vpos = m_screen->vpos(); int next_vpos = vpos + 12; /* Set IRQ line and schedule release of IRQ line */ - state->m_maincpu->set_input_line(0, ASSERT_LINE ); - state->m_irq_off_timer->adjust( state->m_screen->time_until_pos(vpos, 380/2 ) ); + m_maincpu->set_input_line(0, ASSERT_LINE ); + m_irq_off_timer->adjust( m_screen->time_until_pos(vpos, 380/2 ) ); /* Schedule next IRQ trigger */ if ( vpos >= 255 ) { next_vpos = 195; } - state->m_irq_on_timer->adjust( state->m_screen->time_until_pos(next_vpos, 0 ) ); + m_irq_on_timer->adjust( m_screen->time_until_pos(next_vpos, 0 ) ); } -static TIMER_CALLBACK( d65010_irq_off_cb ) +TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_off_cb) { - pv1000_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(0, CLEAR_LINE ); + m_maincpu->set_input_line(0, CLEAR_LINE ); } void pv1000_state::machine_start() { - m_irq_on_timer = machine().scheduler().timer_alloc(FUNC(d65010_irq_on_cb)); - m_irq_off_timer = machine().scheduler().timer_alloc(FUNC(d65010_irq_off_cb)); + m_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_on_cb),this)); + m_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_off_cb),this)); } diff --git a/src/mess/drivers/px4.c b/src/mess/drivers/px4.c index c7019e48954..2534ade57ef 100644 --- a/src/mess/drivers/px4.c +++ b/src/mess/drivers/px4.c @@ -167,6 +167,9 @@ public: DECLARE_PALETTE_INIT(px4p); UINT32 screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_INPUT_CHANGED_MEMBER(key_callback); + TIMER_CALLBACK_MEMBER(ext_cassette_read); + TIMER_CALLBACK_MEMBER(transmit_data); + TIMER_CALLBACK_MEMBER(receive_data); }; @@ -303,42 +306,41 @@ static void gapnit_interrupt(running_machine &machine) } /* external cassette or barcode reader input */ -static TIMER_CALLBACK( ext_cassette_read ) +TIMER_CALLBACK_MEMBER(px4_state::ext_cassette_read) { - px4_state *px4 = machine.driver_data(); UINT8 result; int trigger = 0; /* sample input state */ - result = (px4->m_ext_cas->input() > 0) ? 1 : 0; + result = (m_ext_cas->input() > 0) ? 1 : 0; /* detect transition */ - switch ((px4->m_ctrl1 >> 1) & 0x03) + switch ((m_ctrl1 >> 1) & 0x03) { case 0: /* trigger inhibit */ trigger = 0; break; case 1: /* falling edge trigger */ - trigger = px4->m_ear_last_state == 1 && result == 0; + trigger = m_ear_last_state == 1 && result == 0; break; case 2: /* rising edge trigger */ - trigger = px4->m_ear_last_state == 0 && result == 1; + trigger = m_ear_last_state == 0 && result == 1; break; case 3: /* rising/falling edge trigger */ - trigger = px4->m_ear_last_state != result; + trigger = m_ear_last_state != result; break; } /* generate an interrupt if we need to trigger */ if (trigger) { - px4->m_icrb = px4->m_frc_value; - px4->m_isr |= INT2_ICF; - gapnit_interrupt(machine); + m_icrb = m_frc_value; + m_isr |= INT2_ICF; + gapnit_interrupt(machine()); } /* save last state */ - px4->m_ear_last_state = result; + m_ear_last_state = result; } /* free running counter */ @@ -747,19 +749,18 @@ WRITE8_MEMBER(px4_state::px4_spur_w) GAPNIO ***************************************************************************/ -static TIMER_CALLBACK( transmit_data ) +TIMER_CALLBACK_MEMBER(px4_state::transmit_data) { - px4_state *px4 = machine.driver_data(); - if (BIT(px4->m_artcr, 0))// ART_TX_ENABLED + if (BIT(m_artcr, 0))// ART_TX_ENABLED { } } -static TIMER_CALLBACK( receive_data ) +TIMER_CALLBACK_MEMBER(px4_state::receive_data) { - px4_state *px4 = machine.driver_data(); + px4_state *px4 = machine().driver_data(); if (ART_RX_ENABLED) { @@ -1087,14 +1088,14 @@ DRIVER_INIT_MEMBER(px4_state,px4) m_alarm_int_enabled = TRUE; /* art */ - m_receive_timer = machine().scheduler().timer_alloc(FUNC(receive_data)); - m_transmit_timer = machine().scheduler().timer_alloc(FUNC(transmit_data)); + m_receive_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(px4_state::receive_data),this)); + m_transmit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(px4_state::transmit_data),this)); /* printer */ m_centronics = machine().device("centronics"); /* external cassette or barcode reader */ - m_ext_cas_timer = machine().scheduler().timer_alloc(FUNC(ext_cassette_read)); + m_ext_cas_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(px4_state::ext_cassette_read),this)); m_ext_cas = machine().device("extcas"); m_ear_last_state = 0; diff --git a/src/mess/drivers/scv.c b/src/mess/drivers/scv.c index 05fc6b94cf2..efc22ee8d18 100644 --- a/src/mess/drivers/scv.c +++ b/src/mess/drivers/scv.c @@ -38,6 +38,7 @@ public: virtual void machine_reset(); virtual void palette_init(); UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(scv_vb_callback); }; @@ -407,22 +408,21 @@ void scv_state::palette_init() } -static TIMER_CALLBACK( scv_vb_callback ) +TIMER_CALLBACK_MEMBER(scv_state::scv_vb_callback) { - scv_state *state = machine.driver_data(); - int vpos = machine.primary_screen->vpos(); + int vpos = machine().primary_screen->vpos(); switch( vpos ) { case 240: - machine.device("maincpu")->execute().set_input_line(UPD7810_INTF2, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(UPD7810_INTF2, ASSERT_LINE); break; case 0: - machine.device("maincpu")->execute().set_input_line(UPD7810_INTF2, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(UPD7810_INTF2, CLEAR_LINE); break; } - state->m_vb_timer->adjust( machine.primary_screen->time_until_pos(( vpos + 1 ) % 262, 0 ) ); + m_vb_timer->adjust( machine().primary_screen->time_until_pos(( vpos + 1 ) % 262, 0 ) ); } @@ -751,7 +751,7 @@ WRITE_LINE_MEMBER( scv_state::scv_upd1771_ack_w ) void scv_state::machine_start() { - m_vb_timer = machine().scheduler().timer_alloc(FUNC(scv_vb_callback)); + m_vb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scv_state::scv_vb_callback),this)); } diff --git a/src/mess/drivers/socrates.c b/src/mess/drivers/socrates.c index 61b96e0e2c9..9be3944f26b 100644 --- a/src/mess/drivers/socrates.c +++ b/src/mess/drivers/socrates.c @@ -129,6 +129,8 @@ public: virtual void palette_init(); UINT32 screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(assert_irq); + TIMER_CALLBACK_MEMBER(clear_speech_cb); + TIMER_CALLBACK_MEMBER(clear_irq_cb); }; @@ -331,12 +333,11 @@ UINT8 *speechromext = memregion("speechext")->base(); logerror("read from i/o 0x4x of %x\n", temp); return temp; } -static TIMER_CALLBACK( clear_speech_cb ) +TIMER_CALLBACK_MEMBER(socrates_state::clear_speech_cb) { - socrates_state *state = machine.driver_data(); - state->m_speech_running = 0; - state->m_speech_load_address_count = 0; // should this be here or in the write functuon subpart which is speak command? - state->m_speech_load_settings_count = 0; + m_speech_running = 0; + m_speech_load_address_count = 0; // should this be here or in the write functuon subpart which is speak command? + m_speech_load_settings_count = 0; } WRITE8_MEMBER(socrates_state::speech_command)// write 0x4x, some sort of bitfield; speech chip is probably hitachi hd38880 related but not exact, w/4 bit interface @@ -399,7 +400,7 @@ end hd38880 info.*/ { /* write me: start talking */ m_speech_running = 1; - machine().scheduler().timer_set(attotime::from_seconds(4), FUNC(clear_speech_cb)); // hack + machine().scheduler().timer_set(attotime::from_seconds(4), timer_expired_delegate(FUNC(socrates_state::clear_speech_cb),this)); // hack } break; case 0x90: // unknown, one of these is probably read and branch @@ -423,7 +424,7 @@ end hd38880 info.*/ if ((data&0xF) == 0) // speak { m_speech_running = 1; - machine().scheduler().timer_set(attotime::from_seconds(4), FUNC(clear_speech_cb)); // hack + machine().scheduler().timer_set(attotime::from_seconds(4), timer_expired_delegate(FUNC(socrates_state::clear_speech_cb),this)); // hack } else if ((data&0xF) == 8) // reset { @@ -903,17 +904,16 @@ INPUT_PORTS_END /****************************************************************************** Machine Drivers ******************************************************************************/ -static TIMER_CALLBACK( clear_irq_cb ) +TIMER_CALLBACK_MEMBER(socrates_state::clear_irq_cb) { - socrates_state *state = machine.driver_data(); - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); - state->m_vblankstate = 0; + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + m_vblankstate = 0; } INTERRUPT_GEN_MEMBER(socrates_state::assert_irq) { device.execute().set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(downcast(&device)->cycles_to_attotime(44), FUNC(clear_irq_cb)); + machine().scheduler().timer_set(downcast(&device)->cycles_to_attotime(44), timer_expired_delegate(FUNC(socrates_state::clear_irq_cb),this)); // 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/supercon.c b/src/mess/drivers/supercon.c index 1692067d5d7..0f5bdfc8b7f 100644 --- a/src/mess/drivers/supercon.c +++ b/src/mess/drivers/supercon.c @@ -71,6 +71,8 @@ public: virtual void machine_reset(); DECLARE_DRIVER_INIT(supercon); virtual void machine_start(); + TIMER_CALLBACK_MEMBER(mouse_click); + TIMER_CALLBACK_MEMBER(update_irq); }; @@ -503,14 +505,13 @@ WRITE8_MEMBER( supercon_state::supercon_port4_w ) beep_set_state(m_beep ,0); } -static TIMER_CALLBACK( mouse_click ) +TIMER_CALLBACK_MEMBER(supercon_state::mouse_click) { - supercon_state *state = machine.driver_data(); - if (state->ioport("BUTTON_L")->read_safe(0) ) /* wait for mouse release */ - state->m_timer_mouse_click->adjust(state->m_wait_time, 0); + if (ioport("BUTTON_L")->read_safe(0) ) /* wait for mouse release */ + m_timer_mouse_click->adjust(m_wait_time, 0); else - state->m_selecting=FALSE; + m_selecting=FALSE; } static TIMER_DEVICE_CALLBACK( update_artwork ) @@ -518,10 +519,10 @@ static TIMER_DEVICE_CALLBACK( update_artwork ) mouse_update(timer.machine()); } -static TIMER_CALLBACK( update_irq ) +TIMER_CALLBACK_MEMBER(supercon_state::update_irq) { - machine.device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); - machine.device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } /* Save state call backs */ @@ -544,9 +545,9 @@ static void board_postload(supercon_state *state) void supercon_state::machine_start() { - m_timer_update_irq = machine().scheduler().timer_alloc(FUNC(update_irq)); + m_timer_update_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::update_irq),this)); m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(1000) ); - m_timer_mouse_click = machine().scheduler().timer_alloc(FUNC(mouse_click),NULL); + m_timer_mouse_click = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::mouse_click),this),NULL); save_item(NAME(m_save_board)); machine().save().register_postload(save_prepost_delegate(FUNC(board_postload),this)); machine().save().register_presave(save_prepost_delegate(FUNC(board_presave),this)); diff --git a/src/mess/drivers/supracan.c b/src/mess/drivers/supracan.c index c8a8a7ee332..810bdb5a1b7 100644 --- a/src/mess/drivers/supracan.c +++ b/src/mess/drivers/supracan.c @@ -203,6 +203,10 @@ public: UINT32 screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(supracan_irq); INTERRUPT_GEN_MEMBER(supracan_sound_irq); + TIMER_CALLBACK_MEMBER(supracan_hbl_callback); + TIMER_CALLBACK_MEMBER(supracan_line_on_callback); + TIMER_CALLBACK_MEMBER(supracan_line_off_callback); + TIMER_CALLBACK_MEMBER(supracan_video_callback); }; @@ -1488,71 +1492,67 @@ READ16_MEMBER( supracan_state::supracan_video_r ) return data; } -static TIMER_CALLBACK( supracan_hbl_callback ) +TIMER_CALLBACK_MEMBER(supracan_state::supracan_hbl_callback) { - supracan_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(3, HOLD_LINE); + m_maincpu->set_input_line(3, HOLD_LINE); - state->m_hbl_timer->adjust(attotime::never); + m_hbl_timer->adjust(attotime::never); } -static TIMER_CALLBACK( supracan_line_on_callback ) +TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_on_callback) { - supracan_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(5, HOLD_LINE); + m_maincpu->set_input_line(5, HOLD_LINE); - state->m_line_on_timer->adjust(attotime::never); + m_line_on_timer->adjust(attotime::never); } -static TIMER_CALLBACK( supracan_line_off_callback ) +TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_off_callback) { - supracan_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(5, CLEAR_LINE); + m_maincpu->set_input_line(5, CLEAR_LINE); - state->m_line_on_timer->adjust(attotime::never); + m_line_on_timer->adjust(attotime::never); } -static TIMER_CALLBACK( supracan_video_callback ) +TIMER_CALLBACK_MEMBER(supracan_state::supracan_video_callback) { - supracan_state *state = machine.driver_data(); - int vpos = machine.primary_screen->vpos(); + int vpos = machine().primary_screen->vpos(); - state->m_video_regs[0] &= ~0x0002; + m_video_regs[0] &= ~0x0002; switch( vpos ) { case 0: - state->m_video_regs[0] &= 0x7fff; + m_video_regs[0] &= 0x7fff; // we really need better management of this - mark_active_tilemap_all_dirty(machine, 0); - mark_active_tilemap_all_dirty(machine, 1); - mark_active_tilemap_all_dirty(machine, 2); - mark_active_tilemap_all_dirty(machine, 3); + mark_active_tilemap_all_dirty(machine(), 0); + mark_active_tilemap_all_dirty(machine(), 1); + mark_active_tilemap_all_dirty(machine(), 2); + mark_active_tilemap_all_dirty(machine(), 3); break; case 224://FIXME: Son of Evil is pretty picky about this one, a timing of 240 makes it to crash - state->m_video_regs[0] |= 0x8000; + m_video_regs[0] |= 0x8000; break; case 240: - if(state->m_irq_mask & 1) + if(m_irq_mask & 1) { - verboselog("maincpu", machine, 0, "Triggering VBL IRQ\n\n"); - state->m_maincpu->set_input_line(7, HOLD_LINE); + verboselog("maincpu", machine(), 0, "Triggering VBL IRQ\n\n"); + m_maincpu->set_input_line(7, HOLD_LINE); } break; } - state->m_video_regs[1] = machine.primary_screen->vpos()-16; // for son of evil, wants vblank active around 224 instead... + m_video_regs[1] = machine().primary_screen->vpos()-16; // for son of evil, wants vblank active around 224 instead... - state->m_hbl_timer->adjust( machine.primary_screen->time_until_pos( vpos, 320 ) ); - state->m_video_timer->adjust( machine.primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ) ); + m_hbl_timer->adjust( machine().primary_screen->time_until_pos( vpos, 320 ) ); + m_video_timer->adjust( machine().primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ) ); } WRITE16_MEMBER( supracan_state::supracan_video_w ) @@ -1774,10 +1774,10 @@ static DEVICE_IMAGE_LOAD( supracan_cart ) void supracan_state::machine_start() { - m_video_timer = machine().scheduler().timer_alloc(FUNC(supracan_video_callback)); - m_hbl_timer = machine().scheduler().timer_alloc(FUNC(supracan_hbl_callback)); - m_line_on_timer = machine().scheduler().timer_alloc(FUNC(supracan_line_on_callback)); - m_line_off_timer = machine().scheduler().timer_alloc(FUNC(supracan_line_off_callback)); + m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_video_callback),this)); + m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_hbl_callback),this)); + m_line_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_on_callback),this)); + m_line_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_off_callback),this)); } diff --git a/src/mess/drivers/sys2900.c b/src/mess/drivers/sys2900.c index 3ad86b67f75..1d302b4d2e7 100644 --- a/src/mess/drivers/sys2900.c +++ b/src/mess/drivers/sys2900.c @@ -47,6 +47,7 @@ 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); }; @@ -69,16 +70,15 @@ INPUT_PORTS_END /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( sys2900_boot ) +TIMER_CALLBACK_MEMBER(sys2900_state::sys2900_boot) { - sys2900_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } void sys2900_state::machine_reset() { membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(5), FUNC(sys2900_boot)); + machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(sys2900_state::sys2900_boot),this)); } DRIVER_INIT_MEMBER(sys2900_state,sys2900) diff --git a/src/mess/drivers/tec1.c b/src/mess/drivers/tec1.c index 26ea2b82a33..0b418202235 100644 --- a/src/mess/drivers/tec1.c +++ b/src/mess/drivers/tec1.c @@ -108,6 +108,7 @@ public: UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row ); virtual void machine_reset(); virtual void machine_start(); + TIMER_CALLBACK_MEMBER(tec1_kbd_callback); }; @@ -209,50 +210,49 @@ UINT8 tec1_state::tec1_convert_col_to_bin( UINT8 col, UINT8 row ) return data; } -static TIMER_CALLBACK( tec1_kbd_callback ) +TIMER_CALLBACK_MEMBER(tec1_state::tec1_kbd_callback) { static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3" }; - tec1_state *state = machine.driver_data(); UINT8 i; // Display the digits. Blank any digits that haven't been refreshed for a while. // This will fix the problem reported by a user. for (i = 0; i < 6; i++) { - if (BIT(state->m_digit, i)) + if (BIT(m_digit, i)) { - state->m_refresh[i] = 1; - output_set_digit_value(i, state->m_segment); + m_refresh[i] = 1; + output_set_digit_value(i, m_segment); } else - if (state->m_refresh[i] == 0x80) + if (m_refresh[i] == 0x80) { output_set_digit_value(i, 0); - state->m_refresh[i] = 0; + m_refresh[i] = 0; } else - if (state->m_refresh[i]) - state->m_refresh[i]++; + if (m_refresh[i]) + m_refresh[i]++; } // 74C923 4 by 5 key encoder. // if previous key is still held, bail out - if (machine.root_device().ioport(keynames[state->m_kbd_row])->read()) - if (state->tec1_convert_col_to_bin(machine.root_device().ioport(keynames[state->m_kbd_row])->read(), state->m_kbd_row) == state->m_kbd) + if (machine().root_device().ioport(keynames[m_kbd_row])->read()) + if (tec1_convert_col_to_bin(machine().root_device().ioport(keynames[m_kbd_row])->read(), m_kbd_row) == m_kbd) return; - state->m_kbd_row++; - state->m_kbd_row &= 3; + m_kbd_row++; + m_kbd_row &= 3; /* see if a key pressed */ - if (machine.root_device().ioport(keynames[state->m_kbd_row])->read()) + if (machine().root_device().ioport(keynames[m_kbd_row])->read()) { - state->m_kbd = state->tec1_convert_col_to_bin(machine.root_device().ioport(keynames[state->m_kbd_row])->read(), state->m_kbd_row); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, HOLD_LINE); - state->m_key_pressed = TRUE; + m_kbd = tec1_convert_col_to_bin(machine().root_device().ioport(keynames[m_kbd_row])->read(), m_kbd_row); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, HOLD_LINE); + m_key_pressed = TRUE; } else - state->m_key_pressed = FALSE; + m_key_pressed = FALSE; } @@ -264,7 +264,7 @@ static TIMER_CALLBACK( tec1_kbd_callback ) void tec1_state::machine_start() { - m_kbd_timer = machine().scheduler().timer_alloc(FUNC(tec1_kbd_callback)); + m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tec1_state::tec1_kbd_callback),this)); m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) ); } diff --git a/src/mess/drivers/tutor.c b/src/mess/drivers/tutor.c index b4239dafc27..da26bfa762e 100644 --- a/src/mess/drivers/tutor.c +++ b/src/mess/drivers/tutor.c @@ -206,13 +206,14 @@ public: DECLARE_DRIVER_INIT(pyuuta); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(tape_interrupt_handler); }; /* mapper state */ /* tape interface state */ -static TIMER_CALLBACK(tape_interrupt_handler); + /* parallel interface state */ @@ -226,7 +227,7 @@ enum DRIVER_INIT_MEMBER(tutor_state,tutor) { - m_tape_interrupt_timer = machine().scheduler().timer_alloc(FUNC(tape_interrupt_handler)); + m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this)); membank("bank1")->configure_entry(0, machine().root_device().memregion("maincpu")->base() + basic_base); membank("bank1")->configure_entry(1, memregion("maincpu")->base() + cartridge_base); @@ -400,11 +401,10 @@ WRITE8_MEMBER( tutor_state::tutor_mapper_w ) know their exact meaning. */ -static TIMER_CALLBACK(tape_interrupt_handler) +TIMER_CALLBACK_MEMBER(tutor_state::tape_interrupt_handler) { - tutor_state *state = machine.driver_data(); - //assert(state->m_tape_interrupt_enable); - machine.device("maincpu")->execute().set_input_line(1, (state->m_cass->input() > 0.0) ? ASSERT_LINE : CLEAR_LINE); + //assert(m_tape_interrupt_enable); + machine().device("maincpu")->execute().set_input_line(1, (m_cass->input() > 0.0) ? ASSERT_LINE : CLEAR_LINE); } /* CRU handler */ diff --git a/src/mess/drivers/vg5k.c b/src/mess/drivers/vg5k.c index 7b35d70bb9a..0b9c2e714e7 100644 --- a/src/mess/drivers/vg5k.c +++ b/src/mess/drivers/vg5k.c @@ -88,6 +88,7 @@ public: DECLARE_READ8_MEMBER ( cassette_r ); DECLARE_WRITE8_MEMBER ( cassette_w ); DECLARE_DRIVER_INIT(vg5k); + TIMER_CALLBACK_MEMBER(z80_irq_clear); }; @@ -274,17 +275,18 @@ static INPUT_PORTS_START( vg5k ) INPUT_PORTS_END -static TIMER_CALLBACK( z80_irq_clear ) +TIMER_CALLBACK_MEMBER(vg5k_state::z80_irq_clear) { - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } static TIMER_DEVICE_CALLBACK( z80_irq ) { + vg5k_state *state = timer.machine().driver_data(); timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); - timer.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(z80_irq_clear)); + timer.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),state)); } static TIMER_DEVICE_CALLBACK( vg5k_scanline ) diff --git a/src/mess/drivers/vii.c b/src/mess/drivers/vii.c index 6d6db609538..c867973ea69 100644 --- a/src/mess/drivers/vii.c +++ b/src/mess/drivers/vii.c @@ -141,6 +141,8 @@ public: virtual void video_start(); UINT32 screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vii_vblank); + TIMER_CALLBACK_MEMBER(tmb1_tick); + TIMER_CALLBACK_MEMBER(tmb2_tick); }; enum @@ -979,16 +981,14 @@ static DEVICE_IMAGE_LOAD( vsmile_cart ) return IMAGE_INIT_PASS; } -static TIMER_CALLBACK( tmb1_tick ) +TIMER_CALLBACK_MEMBER(vii_state::tmb1_tick) { - vii_state *state = machine.driver_data(); - state->m_io_regs[0x22] |= 1; + m_io_regs[0x22] |= 1; } -static TIMER_CALLBACK( tmb2_tick ) +TIMER_CALLBACK_MEMBER(vii_state::tmb2_tick) { - vii_state *state = machine.driver_data(); - state->m_io_regs[0x22] |= 2; + m_io_regs[0x22] |= 2; } void vii_state::machine_start() @@ -1012,8 +1012,8 @@ void vii_state::machine_start() m_video_regs[0x36] = 0xffff; m_video_regs[0x37] = 0xffff; - m_tmb1 = machine().scheduler().timer_alloc(FUNC(tmb1_tick)); - m_tmb2 = machine().scheduler().timer_alloc(FUNC(tmb2_tick)); + m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb1_tick),this)); + m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb2_tick),this)); m_tmb1->reset(); m_tmb2->reset(); } diff --git a/src/mess/drivers/vk100.c b/src/mess/drivers/vk100.c index 46ebcc3f320..2cf4858f462 100644 --- a/src/mess/drivers/vk100.c +++ b/src/mess/drivers/vk100.c @@ -192,6 +192,7 @@ public: DECLARE_DRIVER_INIT(vk100); virtual void machine_reset(); virtual void video_start(); + TIMER_CALLBACK_MEMBER(execute_vg); }; // vram access functions: @@ -250,35 +251,34 @@ static void vram_write(running_machine &machine, UINT8 data) state->m_vram[(EA<<1)] = (block&0xFF00)>>8; // '' } -static TIMER_CALLBACK( execute_vg ) +TIMER_CALLBACK_MEMBER(vk100_state::execute_vg) { - vk100_state *state = machine.driver_data(); - UINT8 thisNyb = vram_read(machine); // read in the nybble + UINT8 thisNyb = vram_read(machine()); // read in the nybble // pattern rom addressing is a complex mess. see the pattern rom def later in this file. - UINT8 newNyb = state->m_pattern[((state->m_vgPAT&state->m_vgPAT_Mask)?0x200:0)|((state->VG_WOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; // calculate new nybble based on pattern rom + UINT8 newNyb = m_pattern[((m_vgPAT&m_vgPAT_Mask)?0x200:0)|((VG_WOPS&7)<<6)|((m_vgX&3)<<4)|thisNyb]; // calculate new nybble based on pattern rom // finally write the block back to ram depending on the VG_MODE (sort of a hack until we get the vector and synd and dir roms all hooked up) - switch (state->m_VG_MODE) + switch (m_VG_MODE) { case 0: // move; adjusts the x and y but doesn't write anything. do nothing break; case 1: // dot: only write the LAST pixel in the chain? TODO: some fallthrough magic here? - if ((state->m_vgDownCount) == 0x00) + if ((m_vgDownCount) == 0x00) { - vram_write(machine, newNyb); // write out the modified nybble + vram_write(machine(), newNyb); // write out the modified nybble } break; case 2: // vec: draw the vector - vram_write(machine, newNyb); // write out the modified nybble + vram_write(machine(), newNyb); // write out the modified nybble break; case 3: // er: erase: special case here: wipe the entire screen (except for color/attrib?) and then set done. for (int i = 0; i < 0x8000; i++) { if (!(i&1)) // avoid stomping attribute - state->m_vram[i] = state->m_vram[i]&0xF0; + m_vram[i] = m_vram[i]&0xF0; else // (i&1) - state->m_vram[i] = 0; + m_vram[i] = 0; } - state->m_vgGO = 0; // done + m_vgGO = 0; // done break; } /* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135) @@ -305,48 +305,48 @@ static TIMER_CALLBACK( execute_vg ) * \--------- UNUSED, always 0 * The VT125 prom @ E41 is literally identical to this, the same exact part: 23-059B1 */ - //UINT8 direction_rom = state->m_dir[]; + //UINT8 direction_rom = m_dir[]; // HACK: we need the proper direction rom dump for this! - switch(state->VG_DIR&0x7) + switch(VG_DIR&0x7) { case 0: - state->m_vgX++; + m_vgX++; break; case 7: - state->m_vgX++; - state->m_vgY++; + m_vgX++; + m_vgY++; break; case 6: - state->m_vgY++; + m_vgY++; break; case 5: - state->m_vgX--; - state->m_vgY++; + m_vgX--; + m_vgY++; break; case 4: - state->m_vgX--; + m_vgX--; break; case 3: - state->m_vgX--; - state->m_vgY--; + m_vgX--; + m_vgY--; break; case 2: - state->m_vgY--; + m_vgY--; break; case 1: - state->m_vgX++; - state->m_vgY--; + m_vgX++; + m_vgY--; break; } - state->m_vgDownCount--; // decrement the down counter - if ((state->m_vgDownCount) == 0x00) state->m_vgGO = 0; // check if the down counter hit terminal count (0), if so we're done. - if (((++state->m_vgPMUL_Count)&0xF)==0) // if pattern multiplier counter overflowed + m_vgDownCount--; // decrement the down counter + if ((m_vgDownCount) == 0x00) m_vgGO = 0; // check if the down counter hit terminal count (0), if so we're done. + if (((++m_vgPMUL_Count)&0xF)==0) // if pattern multiplier counter overflowed { - state->m_vgPMUL_Count = state->m_vgPMUL; // reload counter - state->m_vgPAT_Mask >>= 1; // shift the mask - if (state->m_vgPAT_Mask == 0) state->m_vgPAT_Mask = 0x80; // reset mask if it hits 0 + m_vgPMUL_Count = m_vgPMUL; // reload counter + m_vgPAT_Mask >>= 1; // shift the mask + if (m_vgPAT_Mask == 0) m_vgPAT_Mask = 0x80; // reset mask if it hits 0 } - if (state->m_vgGO) machine.scheduler().timer_set(attotime::from_hz(XTAL_45_6192Mhz/3/12/2), FUNC(execute_vg)); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21 + 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 } /* ports 0x40 and 0x41: load low and high bytes of vector gen X register */ @@ -459,7 +459,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, FUNC(execute_vg)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(vk100_state::execute_vg),this)); } diff --git a/src/mess/drivers/zrt80.c b/src/mess/drivers/zrt80.c index 8fca3aa978e..54f2ab56371 100644 --- a/src/mess/drivers/zrt80.c +++ b/src/mess/drivers/zrt80.c @@ -46,6 +46,7 @@ public: const UINT8 *m_p_chargen; virtual void machine_reset(); virtual void video_start(); + TIMER_CALLBACK_MEMBER(zrt80_beepoff); }; READ8_MEMBER( zrt80_state::zrt80_10_r ) @@ -55,21 +56,20 @@ READ8_MEMBER( zrt80_state::zrt80_10_r ) return ret; } -static TIMER_CALLBACK( zrt80_beepoff ) +TIMER_CALLBACK_MEMBER(zrt80_state::zrt80_beepoff) { - zrt80_state *state = machine.driver_data(); - beep_set_state(state->m_beep, 0); + beep_set_state(m_beep, 0); } WRITE8_MEMBER(zrt80_state::zrt80_30_w) { - machine().scheduler().timer_set(attotime::from_msec(100), FUNC(zrt80_beepoff)); + machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(zrt80_state::zrt80_beepoff),this)); beep_set_state(m_beep, 1); } WRITE8_MEMBER(zrt80_state::zrt80_38_w) { - machine().scheduler().timer_set(attotime::from_msec(400), FUNC(zrt80_beepoff)); + machine().scheduler().timer_set(attotime::from_msec(400), timer_expired_delegate(FUNC(zrt80_state::zrt80_beepoff),this)); beep_set_state(m_beep, 1); }