diff options
author | 2012-09-25 13:39:59 +0000 | |
---|---|---|
committer | 2012-09-25 13:39:59 +0000 | |
commit | 6c40f0f2920a208ff456d8f34f3684367ef3fd8a (patch) | |
tree | 8f6a39a908e561191d898f9dafbcb9a74967d784 /src/mess/drivers | |
parent | b29b84dd779070e753d8e5eff6f2f548e616ef6a (diff) |
TIMER_CALLBACK_DEVICE_MEMBER modernization part 1 (no whatsnew)
Diffstat (limited to 'src/mess/drivers')
47 files changed, 318 insertions, 411 deletions
diff --git a/src/mess/drivers/a7800.c b/src/mess/drivers/a7800.c index bd37c089338..14cd34f1375 100644 --- a/src/mess/drivers/a7800.c +++ b/src/mess/drivers/a7800.c @@ -253,7 +253,7 @@ static MACHINE_CONFIG_START( a7800_ntsc, a7800_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6502, A7800_NTSC_Y1/8) /* 1.79 MHz (switches to 1.19 MHz on TIA or RIOT access) */ MCFG_CPU_PROGRAM_MAP(a7800_mem) - MCFG_TIMER_ADD_SCANLINE("scantimer", a7800_interrupt, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", a7800_state, a7800_interrupt, "screen", 0, 1) /* video hardware */ diff --git a/src/mess/drivers/ace.c b/src/mess/drivers/ace.c index f59570711a1..f751fc297ed 100644 --- a/src/mess/drivers/ace.c +++ b/src/mess/drivers/ace.c @@ -364,9 +364,9 @@ GFXDECODE_END // TIMER_DEVICE_CALLBACK( set_irq ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( set_irq ) +TIMER_DEVICE_CALLBACK_MEMBER(ace_state::set_irq) { - timer.machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); } @@ -374,9 +374,9 @@ static TIMER_DEVICE_CALLBACK( set_irq ) // TIMER_DEVICE_CALLBACK( clear_irq ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( clear_irq ) +TIMER_DEVICE_CALLBACK_MEMBER(ace_state::clear_irq) { - timer.machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); } @@ -630,8 +630,8 @@ static MACHINE_CONFIG_START( ace, ace_state ) MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) MCFG_SCREEN_UPDATE_DRIVER(ace_state, screen_update) MCFG_SCREEN_RAW_PARAMS(XTAL_6_5MHz, 416, 0, 336, 312, 0, 304) - MCFG_TIMER_ADD_SCANLINE("set_irq", set_irq, SCREEN_TAG, 31*8, 264) - MCFG_TIMER_ADD_SCANLINE("clear_irq", clear_irq, SCREEN_TAG, 32*8, 264) + MCFG_TIMER_DRIVER_ADD_SCANLINE("set_irq", ace_state, set_irq, SCREEN_TAG, 31*8, 264) + MCFG_TIMER_DRIVER_ADD_SCANLINE("clear_irq", ace_state, clear_irq, SCREEN_TAG, 32*8, 264) MCFG_PALETTE_LENGTH(2) MCFG_PALETTE_INIT(black_and_white) diff --git a/src/mess/drivers/adam.c b/src/mess/drivers/adam.c index 9ef8d2d3b47..7c1e65d498c 100644 --- a/src/mess/drivers/adam.c +++ b/src/mess/drivers/adam.c @@ -1165,13 +1165,11 @@ WRITE8_MEMBER( adam_state::fdc6801_p4_w ) // TIMER_DEVICE_CALLBACK( paddle_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( paddle_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(adam_state::paddle_tick) { - adam_state *state = timer.machine().driver_data<adam_state>(); - // TODO: improve irq behaviour (see drivers/coleco.c) - if (coleco_scan_paddles(timer.machine(), &state->m_joy_status0, &state->m_joy_status1)) - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); + if (coleco_scan_paddles(machine(), &m_joy_status0, &m_joy_status1)) + m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); } @@ -1732,7 +1730,7 @@ static MACHINE_CONFIG_START( adam, adam_state ) MCFG_SOUND_CONFIG(psg_intf) // devices - MCFG_TIMER_ADD_PERIODIC("paddles", paddle_tick, attotime::from_msec(20)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("paddles", adam_state, paddle_tick, attotime::from_msec(20)) MCFG_WD2793_ADD(WD2793_TAG, fdc_intf) MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, adam_floppy_interface) MCFG_CASSETTE_ADD(CASSETTE_TAG, adam_cassette_interface) diff --git a/src/mess/drivers/amstr_pc.c b/src/mess/drivers/amstr_pc.c index c3e424a065a..0c0399b535c 100644 --- a/src/mess/drivers/amstr_pc.c +++ b/src/mess/drivers/amstr_pc.c @@ -241,7 +241,7 @@ SLOT_INTERFACE_END MCFG_CPU_ADD("maincpu", type, clock) \ MCFG_CPU_PROGRAM_MAP(mem##_map) \ MCFG_CPU_IO_MAP(port##_io) \ - MCFG_TIMER_ADD_SCANLINE("scantimer", vblankfunc, "screen", 0, 1) \ + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", pc_state, vblankfunc, "screen", 0, 1) \ MCFG_CPU_CONFIG(i86_address_mask) @@ -334,7 +334,7 @@ static MACHINE_CONFIG_START( ppc512, pc_state ) MCFG_CPU_ADD("maincpu", V30, 8000000) MCFG_CPU_PROGRAM_MAP(ppc512_map) MCFG_CPU_IO_MAP(ppc512_io) - MCFG_TIMER_ADD_SCANLINE("scantimer", pc_frame_interrupt, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", pc_state, pc_frame_interrupt, "screen", 0, 1) MCFG_MACHINE_START_OVERRIDE(pc_state,pc) MCFG_MACHINE_RESET_OVERRIDE(pc_state,pc) diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index 755fffd4f8b..ff96f4ada4f 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -644,7 +644,7 @@ static MACHINE_CONFIG_START( apple2_common, apple2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M6502, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ MCFG_CPU_PROGRAM_MAP(apple2_map) - MCFG_TIMER_ADD_SCANLINE("scantimer", apple2_interrupt, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2_state, apple2_interrupt, "screen", 0, 1) MCFG_QUANTUM_TIME(attotime::from_hz(60)) MCFG_MACHINE_START_OVERRIDE(apple2_state, apple2 ) diff --git a/src/mess/drivers/apple2gs.c b/src/mess/drivers/apple2gs.c index d7fa59e186e..70fd6b3304d 100644 --- a/src/mess/drivers/apple2gs.c +++ b/src/mess/drivers/apple2gs.c @@ -235,7 +235,7 @@ static MACHINE_CONFIG_START( apple2gs, apple2gs_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", G65816, APPLE2GS_14M/5) MCFG_CPU_PROGRAM_MAP(apple2gs_map) - MCFG_TIMER_ADD_SCANLINE("scantimer", apple2_interrupt, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", apple2gs_state, apple2_interrupt, "screen", 0, 1) MCFG_QUANTUM_TIME(attotime::from_hz(60)) MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mess/drivers/atom.c b/src/mess/drivers/atom.c index 43887da9489..a96332e5233 100644 --- a/src/mess/drivers/atom.c +++ b/src/mess/drivers/atom.c @@ -592,15 +592,13 @@ static const floppy_interface atom_floppy_interface = cassette_interface atom_cassette_interface -------------------------------------------------*/ -static TIMER_DEVICE_CALLBACK( cassette_output_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(atom_state::cassette_output_tick) { - atom_state *state = timer.machine().driver_data<atom_state>(); + int level = !(!(!m_hz2400 && m_pc1) && m_pc0); - int level = !(!(!state->m_hz2400 && state->m_pc1) && state->m_pc0); + m_cassette->output(level ? -1.0 : +1.0); - state->m_cassette->output(level ? -1.0 : +1.0); - - state->m_hz2400 = !state->m_hz2400; + m_hz2400 = !m_hz2400; } static const cassette_interface atom_cassette_interface = @@ -784,7 +782,7 @@ static MACHINE_CONFIG_START( atom, atom_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* devices */ - MCFG_TIMER_ADD_PERIODIC("hz2400", cassette_output_tick, attotime::from_hz(4806)) // X2/4/416 + MCFG_TIMER_DRIVER_ADD_PERIODIC("hz2400", atom_state, cassette_output_tick, attotime::from_hz(4806)) MCFG_VIA6522_ADD(R6522_TAG, X2/4, via_intf) MCFG_I8255_ADD(INS8255_TAG, ppi_intf) MCFG_I8271_ADD(I8271_TAG, fdc_intf) diff --git a/src/mess/drivers/avigo.c b/src/mess/drivers/avigo.c index 14dd2e1f747..cb37c17757e 100644 --- a/src/mess/drivers/avigo.c +++ b/src/mess/drivers/avigo.c @@ -809,22 +809,18 @@ static GFXDECODE_START( avigo ) GFXDECODE_END -static TIMER_DEVICE_CALLBACK( avigo_scan_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_scan_timer) { - avigo_state *state = timer.machine().driver_data<avigo_state>(); + m_irq |= (1<<1); - state->m_irq |= (1<<1); - - state->refresh_ints(); + refresh_ints(); } -static TIMER_DEVICE_CALLBACK( avigo_1hz_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_1hz_timer) { - avigo_state *state = timer.machine().driver_data<avigo_state>(); + m_irq |= (1<<4); - state->m_irq |= (1<<4); - - state->refresh_ints(); + refresh_ints(); } static QUICKLOAD_LOAD(avigo) @@ -930,10 +926,10 @@ static MACHINE_CONFIG_START( avigo, avigo_state ) MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", avigo_state, nvram_init) // IRQ 1 is used for scan the pen and for cursor blinking - MCFG_TIMER_ADD_PERIODIC("scan_timer", avigo_scan_timer, attotime::from_hz(50)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("scan_timer", avigo_state, avigo_scan_timer, attotime::from_hz(50)) // IRQ 4 is generated every second, used for auto power off - MCFG_TIMER_ADD_PERIODIC("1hz_timer", avigo_1hz_timer, attotime::from_hz(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", avigo_state, avigo_1hz_timer, attotime::from_hz(1)) /* quickload */ MCFG_QUICKLOAD_ADD("quickload", avigo, "app", 0) diff --git a/src/mess/drivers/bullet.c b/src/mess/drivers/bullet.c index a6ea30c57c6..783eba784b9 100644 --- a/src/mess/drivers/bullet.c +++ b/src/mess/drivers/bullet.c @@ -671,18 +671,16 @@ INPUT_PORTS_END // Z80CTC_INTERFACE( ctc_intf ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( ctc_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(bullet_state::ctc_tick) { - bullet_state *state = timer.machine().driver_data<bullet_state>(); + m_ctc->trg0(1); + m_ctc->trg0(0); - state->m_ctc->trg0(1); - state->m_ctc->trg0(0); + m_ctc->trg1(1); + m_ctc->trg1(0); - state->m_ctc->trg1(1); - state->m_ctc->trg1(0); - - state->m_ctc->trg2(1); - state->m_ctc->trg2(0); + m_ctc->trg2(1); + m_ctc->trg2(0); } static WRITE_LINE_DEVICE_HANDLER( dart_rxtxca_w ) @@ -1164,7 +1162,7 @@ static MACHINE_CONFIG_START( bullet, bullet_state ) // devices MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_16MHz/4, ctc_intf) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_16MHz/4, dart_intf) MCFG_Z80DMA_ADD(Z80DMA_TAG, XTAL_16MHz/4, dma_intf) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_16MHz/4, pio_intf) @@ -1195,7 +1193,7 @@ static MACHINE_CONFIG_START( bulletf, bulletf_state ) // devices MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_16MHz/4, ctc_intf) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bullet_state, ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4)) MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_16MHz/4, dart_intf) MCFG_Z80DMA_ADD(Z80DMA_TAG, XTAL_16MHz/4, dma_intf) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_16MHz/4, bulletf_pio_intf) diff --git a/src/mess/drivers/busicom.c b/src/mess/drivers/busicom.c index 483c364ccf9..35d910c481a 100644 --- a/src/mess/drivers/busicom.c +++ b/src/mess/drivers/busicom.c @@ -178,13 +178,12 @@ static INPUT_PORTS_START( busicom ) INPUT_PORTS_END -static TIMER_DEVICE_CALLBACK(timer_callback) +TIMER_DEVICE_CALLBACK_MEMBER(busicom_state::timer_callback) { - busicom_state *state = timer.machine().driver_data<busicom_state>(); - state->m_timer ^=1; - if (state->m_timer==1) state->m_drum_index++; - if (state->m_drum_index==13) state->m_drum_index=0; - i4004_set_test(timer.machine().device("maincpu"),state->m_timer); + m_timer ^=1; + if (m_timer==1) m_drum_index++; + if (m_drum_index==13) m_drum_index=0; + i4004_set_test(machine().device("maincpu"),m_timer); } @@ -229,7 +228,7 @@ static MACHINE_CONFIG_START( busicom, busicom_state ) MCFG_PALETTE_LENGTH(16) - MCFG_TIMER_ADD_PERIODIC("busicom_timer", timer_callback, attotime::from_msec(28*2)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("busicom_timer", busicom_state, timer_callback, attotime::from_msec(28*2)) MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mess/drivers/bw12.c b/src/mess/drivers/bw12.c index 97c3af97a4d..e0193b8676d 100644 --- a/src/mess/drivers/bw12.c +++ b/src/mess/drivers/bw12.c @@ -91,11 +91,9 @@ void bw12_state::floppy_motor_off() m_motor_on = 0; } -static TIMER_DEVICE_CALLBACK( floppy_motor_off_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(bw12_state::floppy_motor_off_tick) { - bw12_state *state = timer.machine().driver_data<bw12_state>(); - - state->floppy_motor_off(); + floppy_motor_off(); } void bw12_state::set_floppy_motor_off_timer() @@ -789,7 +787,7 @@ static MACHINE_CONFIG_START( common, bw12_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_TIMER_ADD(FLOPPY_TIMER_TAG, floppy_motor_off_tick) + MCFG_TIMER_DRIVER_ADD(FLOPPY_TIMER_TAG, bw12_state, floppy_motor_off_tick) MCFG_UPD765A_ADD(UPD765_TAG, fdc_intf) MCFG_PIA6821_ADD(PIA6821_TAG, pia_intf) MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_16MHz/4, sio_intf) diff --git a/src/mess/drivers/coleco.c b/src/mess/drivers/coleco.c index 6a0259fab1d..6bb8c985c82 100644 --- a/src/mess/drivers/coleco.c +++ b/src/mess/drivers/coleco.c @@ -213,25 +213,23 @@ TIMER_CALLBACK_MEMBER(coleco_state::paddle_pulse_callback) } } -static TIMER_DEVICE_CALLBACK( paddle_update_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(coleco_state::paddle_update_callback) { // arbitrary timer for reading analog controls - coleco_state *state = timer.machine().driver_data<coleco_state>(); - - coleco_scan_paddles(timer.machine(), &state->m_joy_analog_reload[0], &state->m_joy_analog_reload[1]); + coleco_scan_paddles(machine(), &m_joy_analog_reload[0], &m_joy_analog_reload[1]); for (int port = 0; port < 2; port++) { - if (state->m_joy_analog_reload[port]) + if (m_joy_analog_reload[port]) { const int sensitivity = 500; - int ipt = state->m_joy_analog_reload[port]; + int ipt = m_joy_analog_reload[port]; if (ipt & 0x80) ipt = 0x100 - ipt; attotime freq = attotime::from_msec(sensitivity / ipt); // change pulse intervals relative to spinner/trackball speed - state->m_joy_pulse_reload[port] = freq; - state->m_joy_pulse_timer[port]->adjust(min(freq, state->m_joy_pulse_timer[port]->remaining()), port); + m_joy_pulse_reload[port] = freq; + m_joy_pulse_timer[port]->adjust(min(freq, m_joy_pulse_timer[port]->remaining()), port); } } } @@ -340,7 +338,7 @@ static MACHINE_CONFIG_START( coleco, coleco_state ) /* software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","coleco") - MCFG_TIMER_ADD_PERIODIC("paddle_timer", paddle_update_callback, attotime::from_msec(20)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("paddle_timer", coleco_state, paddle_update_callback, attotime::from_msec(20)) MACHINE_CONFIG_END static MACHINE_CONFIG_START( czz50, coleco_state ) @@ -370,7 +368,7 @@ static MACHINE_CONFIG_START( czz50, coleco_state ) /* software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","coleco") - MCFG_TIMER_ADD_PERIODIC("paddle_timer", paddle_update_callback, attotime::from_msec(20)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("paddle_timer", coleco_state, paddle_update_callback, attotime::from_msec(20)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( dina, czz50 ) diff --git a/src/mess/drivers/cosmicos.c b/src/mess/drivers/cosmicos.c index 5376c46ae39..6946156c7c5 100644 --- a/src/mess/drivers/cosmicos.c +++ b/src/mess/drivers/cosmicos.c @@ -341,20 +341,16 @@ INPUT_PORTS_END /* Video */ -static TIMER_DEVICE_CALLBACK( digit_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::digit_tick) { - cosmicos_state *state = timer.machine().driver_data<cosmicos_state>(); + m_digit = !m_digit; - state->m_digit = !state->m_digit; - - output_set_digit_value(state->m_digit, state->m_segment); + output_set_digit_value(m_digit, m_segment); } -static TIMER_DEVICE_CALLBACK( int_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(cosmicos_state::int_tick) { - cosmicos_state *state = timer.machine().driver_data<cosmicos_state>(); - - state->m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, ASSERT_LINE); + m_maincpu->set_input_line(COSMAC_INPUT_LINE_INT, ASSERT_LINE); } WRITE_LINE_MEMBER( cosmicos_state::dmaout_w ) @@ -569,8 +565,8 @@ static MACHINE_CONFIG_START( cosmicos, cosmicos_state ) /* video hardware */ MCFG_DEFAULT_LAYOUT( layout_cosmicos ) MCFG_DM9368_ADD(DM9368_TAG, led_intf) - MCFG_TIMER_ADD_PERIODIC("digit", digit_tick, attotime::from_hz(100)) - MCFG_TIMER_ADD_PERIODIC("interrupt", int_tick, attotime::from_hz(1000)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("digit", cosmicos_state, digit_tick, attotime::from_hz(100)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("interrupt", cosmicos_state, int_tick, attotime::from_hz(1000)) MCFG_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_1_75MHz) MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) diff --git a/src/mess/drivers/einstein.c b/src/mess/drivers/einstein.c index c7d11be9d21..7a4db3294b2 100644 --- a/src/mess/drivers/einstein.c +++ b/src/mess/drivers/einstein.c @@ -188,24 +188,22 @@ static void einstein_scan_keyboard(running_machine &machine) einstein->m_keyboard_data = data; } -static TIMER_DEVICE_CALLBACK( einstein_keyboard_timer_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_keyboard_timer_callback) { - einstein_state *einstein = timer.machine().driver_data<einstein_state>(); - /* re-scan keyboard */ - einstein_scan_keyboard(timer.machine()); + einstein_scan_keyboard(machine()); /* if /fire1 or /fire2 is 0, signal a fire interrupt */ - if ((timer.machine().root_device().ioport("BUTTONS")->read() & 0x03) != 0) + if ((machine().root_device().ioport("BUTTONS")->read() & 0x03) != 0) { - einstein->m_interrupt |= EINSTEIN_FIRE_INT; + m_interrupt |= EINSTEIN_FIRE_INT; } /* keyboard data changed? */ - if (einstein->m_keyboard_data != 0xff) + if (m_keyboard_data != 0xff) { /* generate interrupt */ - einstein->m_interrupt |= EINSTEIN_KEY_INT; + m_interrupt |= EINSTEIN_KEY_INT; } } @@ -271,15 +269,13 @@ static WRITE8_DEVICE_HANDLER( einstein_drsel_w ) ***************************************************************************/ /* channel 0 and 1 have a 2 MHz input clock for triggering */ -static TIMER_DEVICE_CALLBACK( einstein_ctc_trigger_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_ctc_trigger_callback) { - einstein_state *einstein = timer.machine().driver_data<einstein_state>(); - /* toggle line status */ - einstein->m_ctc_trigger ^= 1; + m_ctc_trigger ^= 1; - einstein->m_ctc->trg0(einstein->m_ctc_trigger); - einstein->m_ctc->trg1(einstein->m_ctc_trigger); + m_ctc->trg0(m_ctc_trigger); + m_ctc->trg1(m_ctc_trigger); } @@ -777,13 +773,13 @@ static MACHINE_CONFIG_START( einstein, einstein_state ) /* this is actually clocked at the system clock 4 MHz, but this would be too fast for our driver. So we update at 50Hz and hope this is good enough. */ - MCFG_TIMER_ADD_PERIODIC("keyboard", einstein_keyboard_timer_callback, attotime::from_hz(50)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", einstein_state, einstein_keyboard_timer_callback, attotime::from_hz(50)) MCFG_Z80PIO_ADD(IC_I063, XTAL_X002 / 2, einstein_pio_intf) MCFG_Z80CTC_ADD(IC_I058, XTAL_X002 / 2, einstein_ctc_intf) /* the input to channel 0 and 1 of the ctc is a 2 MHz clock */ - MCFG_TIMER_ADD_PERIODIC("ctc", einstein_ctc_trigger_callback, attotime::from_hz(XTAL_X002 /4)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", einstein_state, einstein_ctc_trigger_callback, attotime::from_hz(XTAL_X002 /4)) /* Einstein daisy chain support for non-Z80 devices */ MCFG_DEVICE_ADD("keyboard_daisy", EINSTEIN_KEYBOARD_DAISY, 0) diff --git a/src/mess/drivers/fidelz80.c b/src/mess/drivers/fidelz80.c index 8095c6d8ab3..170583b7d88 100644 --- a/src/mess/drivers/fidelz80.c +++ b/src/mess/drivers/fidelz80.c @@ -1008,9 +1008,9 @@ void fidelz80_state::machine_reset() memset(m_digit_line_status, 0, sizeof(m_digit_line_status)); } -static TIMER_DEVICE_CALLBACK( nmi_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(fidelz80_state::nmi_timer) { - timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } /****************************************************************************** @@ -1335,7 +1335,7 @@ static MACHINE_CONFIG_START( vsc, fidelz80_state ) MCFG_I8255_ADD("ppi8255", vsc_ppi8255_intf) MCFG_Z80PIO_ADD("z80pio", XTAL_4MHz, vsc_z80pio_intf) - MCFG_TIMER_ADD_PERIODIC("nmi_timer", nmi_timer, attotime::from_hz(600)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", fidelz80_state, nmi_timer, attotime::from_hz(600)) MCFG_TIMER_START_DELAY(attotime::from_hz(600)) /* sound hardware */ diff --git a/src/mess/drivers/huebler.c b/src/mess/drivers/huebler.c index 25e83481911..076c2e9a57d 100644 --- a/src/mess/drivers/huebler.c +++ b/src/mess/drivers/huebler.c @@ -47,11 +47,9 @@ void amu880_state::scan_keyboard() } } -static TIMER_DEVICE_CALLBACK( keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(amu880_state::keyboard_tick) { - amu880_state *state = timer.machine().driver_data<amu880_state>(); - - state->scan_keyboard(); + scan_keyboard(); } /* Read/Write Handlers */ @@ -388,7 +386,7 @@ static MACHINE_CONFIG_START( amu880, amu880_state ) MCFG_CPU_IO_MAP(amu880_io) MCFG_CPU_CONFIG(amu880_daisy_chain) - MCFG_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, attotime::from_hz(1500)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", amu880_state, keyboard_tick, attotime::from_hz(1500)) /* video hardware */ MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) diff --git a/src/mess/drivers/kc.c b/src/mess/drivers/kc.c index 1a45facc9d0..279d3b84e25 100644 --- a/src/mess/drivers/kc.c +++ b/src/mess/drivers/kc.c @@ -140,7 +140,7 @@ static MACHINE_CONFIG_START( kc85_3, kc_state ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_28_37516MHz/2, 908, 0, 320, 312, 0, 256) MCFG_SCREEN_UPDATE_DRIVER(kc_state, screen_update) - MCFG_TIMER_ADD_SCANLINE("scantimer", kc_scanline, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc_state, kc_scanline, "screen", 0, 1) MCFG_PALETTE_LENGTH(KC85_PALETTE_SIZE) MCFG_PALETTE_INIT_OVERRIDE(kc_state, kc85 ) @@ -192,7 +192,7 @@ static MACHINE_CONFIG_START( kc85_4, kc85_4_state ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_28_37516MHz/2, 908, 0, 320, 312, 0, 256) MCFG_SCREEN_UPDATE_DRIVER(kc85_4_state, screen_update) - MCFG_TIMER_ADD_SCANLINE("scantimer", kc_scanline, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc85_4_state, kc_scanline, "screen", 0, 1) MCFG_PALETTE_LENGTH(KC85_PALETTE_SIZE) MCFG_PALETTE_INIT_OVERRIDE(kc85_4_state, kc85 ) diff --git a/src/mess/drivers/kyocera.c b/src/mess/drivers/kyocera.c index 0b7c048e7a9..371f5d9d4bd 100644 --- a/src/mess/drivers/kyocera.c +++ b/src/mess/drivers/kyocera.c @@ -1287,13 +1287,11 @@ static I8085_CONFIG( kc85_i8085_config ) DEVCB_DEVICE_LINE(CASSETTE_TAG, kc85_sod_w) /* SOD changed callback (I8085A only) */ }; -static TIMER_DEVICE_CALLBACK( tandy200_tp_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(tandy200_state::tandy200_tp_tick) { - tandy200_state *state = timer.machine().driver_data<tandy200_state>(); + m_maincpu->set_input_line(I8085_RST75_LINE, m_tp); - state->m_maincpu->set_input_line(I8085_RST75_LINE, state->m_tp); - - state->m_tp = !state->m_tp; + m_tp = !m_tp; } static MACHINE_CONFIG_START( kc85, kc85_state ) @@ -1431,7 +1429,7 @@ static MACHINE_CONFIG_START( tandy200, tandy200_state ) MCFG_FRAGMENT_ADD(tandy200_video) /* TP timer */ - MCFG_TIMER_ADD_PERIODIC("tp", tandy200_tp_tick, attotime::from_hz(XTAL_4_9152MHz/2/8192)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("tp", tandy200_state, tandy200_tp_tick, attotime::from_hz(XTAL_4_9152MHz/2/8192)) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/mc1000.c b/src/mess/drivers/mc1000.c index 8fdf0cc7424..2a206b6e811 100644 --- a/src/mess/drivers/mc1000.c +++ b/src/mess/drivers/mc1000.c @@ -409,14 +409,12 @@ void mc1000_state::machine_reset() #define MC1000_NE555_FREQ (368) /* Hz */ #define MC1000_NE555_DUTY_CYCLE (99.745) /* % */ -static TIMER_DEVICE_CALLBACK( ne555_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(mc1000_state::ne555_tick) { - mc1000_state *state = timer.machine().driver_data<mc1000_state>(); - // (m_ne555_int not needed anymore and can be done with?) - state->m_ne555_int = param; + m_ne555_int = param; - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, param); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, param); } static const cassette_interface mc1000_cassette_interface = @@ -444,10 +442,10 @@ static MACHINE_CONFIG_START( mc1000, mc1000_state ) MCFG_CPU_IO_MAP(mc1000_io) /* timers */ - MCFG_TIMER_ADD_PERIODIC("ne555clear", ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ne555clear", mc1000_state, ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) MCFG_TIMER_PARAM(CLEAR_LINE) - MCFG_TIMER_ADD_PERIODIC("ne555assert", ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ne555assert", mc1000_state, ne555_tick, attotime::from_hz(MC1000_NE555_FREQ)) MCFG_TIMER_START_DELAY(attotime::from_hz(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE)) MCFG_TIMER_PARAM(ASSERT_LINE) diff --git a/src/mess/drivers/mc80.c b/src/mess/drivers/mc80.c index 063864ef27f..63da64bc3c9 100644 --- a/src/mess/drivers/mc80.c +++ b/src/mess/drivers/mc80.c @@ -134,16 +134,16 @@ static INPUT_PORTS_START( mc8030 ) INPUT_PORTS_END -static TIMER_DEVICE_CALLBACK( mc8020_kbd ) +TIMER_DEVICE_CALLBACK_MEMBER(mc80_state::mc8020_kbd) { - device_t *cpu = timer.machine().device( "maincpu" ); + device_t *cpu = machine().device( "maincpu" ); address_space &mem = cpu->memory().space(AS_PROGRAM); char kbdrow[6]; UINT8 i; for (i = 1; i < 8; i++) { sprintf(kbdrow,"X%X", i); - mem.write_word(0xd20+i, timer.machine().root_device().ioport(kbdrow)->read()); + mem.write_word(0xd20+i, machine().root_device().ioport(kbdrow)->read()); } } @@ -180,7 +180,7 @@ static MACHINE_CONFIG_START( mc8020, mc80_state ) /* Devices */ MCFG_Z80PIO_ADD( "z80pio", XTAL_2_4576MHz, mc8020_z80pio_intf ) MCFG_Z80CTC_ADD( "z80ctc", XTAL_2_4576MHz / 100, mc8020_ctc_intf ) - MCFG_TIMER_ADD_PERIODIC("mc8020_kbd", mc8020_kbd, attotime::from_hz(50)) // keyscanner + MCFG_TIMER_DRIVER_ADD_PERIODIC("mc8020_kbd", mc80_state, mc8020_kbd, attotime::from_hz(50)) MACHINE_CONFIG_END static MACHINE_CONFIG_START( mc8030, mc80_state ) diff --git a/src/mess/drivers/mikromik.c b/src/mess/drivers/mikromik.c index 3801e46ed2a..ec479735e1b 100644 --- a/src/mess/drivers/mikromik.c +++ b/src/mess/drivers/mikromik.c @@ -319,11 +319,9 @@ void mm1_state::scan_keyboard() // TIMER_DEVICE_CALLBACK( kbclk_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( kbclk_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(mm1_state::kbclk_tick) { - mm1_state *state = timer.machine().driver_data<mm1_state>(); - - state->scan_keyboard(); + scan_keyboard(); } @@ -787,7 +785,7 @@ static MACHINE_CONFIG_START( mm1, mm1_state ) MCFG_CPU_PROGRAM_MAP(mm1_map) MCFG_CPU_CONFIG(i8085_intf) - MCFG_TIMER_ADD_PERIODIC("kbclk", kbclk_tick, attotime::from_hz(2500)) //attotime::from_hz(XTAL_6_144MHz/2/8)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("kbclk", mm1_state, kbclk_tick, attotime::from_hz(2500)) // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/mpf1.c b/src/mess/drivers/mpf1.c index 34f380c583b..f666e37b906 100644 --- a/src/mess/drivers/mpf1.c +++ b/src/mess/drivers/mpf1.c @@ -333,14 +333,12 @@ static const tms5220_interface mpf1_tms5220_intf = /* Machine Initialization */ -static TIMER_DEVICE_CALLBACK( check_halt_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(mpf1_state::check_halt_callback) { - mpf1_state *state = timer.machine().driver_data<mpf1_state>(); - // halt-LED; the red one, is turned on when the processor is halted // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix - INT64 led_halt = state->m_maincpu->state_int(Z80_HALT); - set_led_status(timer.machine(), 1, led_halt); + INT64 led_halt = m_maincpu->state_int(Z80_HALT); + set_led_status(machine(), 1, led_halt); } void mpf1_state::machine_start() @@ -382,7 +380,7 @@ static MACHINE_CONFIG_START( mpf1, mpf1_state ) MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_TIMER_ADD_PERIODIC("halt_timer", check_halt_callback, attotime::from_hz(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) MACHINE_CONFIG_END static MACHINE_CONFIG_START( mpf1b, mpf1_state ) @@ -410,7 +408,7 @@ static MACHINE_CONFIG_START( mpf1b, mpf1_state ) MCFG_SOUND_CONFIG(mpf1_tms5220_intf) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - MCFG_TIMER_ADD_PERIODIC("halt_timer", check_halt_callback, attotime::from_hz(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) MACHINE_CONFIG_END static MACHINE_CONFIG_START( mpf1p, mpf1_state ) @@ -434,7 +432,7 @@ static MACHINE_CONFIG_START( mpf1p, mpf1_state ) MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_TIMER_ADD_PERIODIC("halt_timer", check_halt_callback, attotime::from_hz(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("halt_timer", mpf1_state, check_halt_callback, attotime::from_hz(1)) MACHINE_CONFIG_END /* ROMs */ diff --git a/src/mess/drivers/msx.c b/src/mess/drivers/msx.c index d7a71473d66..68aafd7c914 100644 --- a/src/mess/drivers/msx.c +++ b/src/mess/drivers/msx.c @@ -1148,7 +1148,7 @@ static MACHINE_CONFIG_START( msx2, msx_state ) MCFG_CPU_ADD("maincpu", Z80, XTAL_21_4772MHz/6) /* 3.579545 MHz */ MCFG_CPU_PROGRAM_MAP(msx_memory_map) MCFG_CPU_IO_MAP(msx2_io_map) - MCFG_TIMER_ADD_SCANLINE("scantimer", msx2_interrupt, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", msx_state, msx2_interrupt, "screen", 0, 1) MCFG_QUANTUM_TIME(attotime::from_hz(60)) MCFG_MACHINE_START_OVERRIDE(msx_state, msx2 ) diff --git a/src/mess/drivers/mtx.c b/src/mess/drivers/mtx.c index 79c2349ef28..3f5b2c46ba3 100644 --- a/src/mess/drivers/mtx.c +++ b/src/mess/drivers/mtx.c @@ -210,14 +210,12 @@ INPUT_PORTS_END Z80CTC_INTERFACE( ctc_intf ) -------------------------------------------------*/ -static TIMER_DEVICE_CALLBACK( ctc_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(mtx_state::ctc_tick) { - mtx_state *state = timer.machine().driver_data<mtx_state>(); - - state->m_z80ctc->trg1(1); - state->m_z80ctc->trg1(0); - state->m_z80ctc->trg2(1); - state->m_z80ctc->trg2(0); + m_z80ctc->trg1(1); + m_z80ctc->trg1(0); + m_z80ctc->trg2(1); + m_z80ctc->trg2(0); } static WRITE_LINE_DEVICE_HANDLER( ctc_trg1_w ) @@ -302,12 +300,11 @@ static const z80_daisy_config rs128_daisy_chain[] = cassette_interface mtx_cassette_interface -------------------------------------------------*/ -static TIMER_DEVICE_CALLBACK( cassette_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(mtx_state::cassette_tick) { - mtx_state *state = timer.machine().driver_data<mtx_state>(); - int data = ((state->m_cassette)->input() > +0.0) ? 0 : 1; + int data = ((m_cassette)->input() > +0.0) ? 0 : 1; - state->m_z80ctc->trg3(data); + m_z80ctc->trg3(data); } static const cassette_interface mtx_cassette_interface = @@ -368,11 +365,11 @@ static MACHINE_CONFIG_START( mtx512, mtx_state ) /* devices */ MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_4MHz, ctc_intf ) - MCFG_TIMER_ADD_PERIODIC("z80ctc_timer", ctc_tick, attotime::from_hz(XTAL_4MHz/13)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_timer", mtx_state, ctc_tick, attotime::from_hz(XTAL_4MHz/13)) MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, standard_centronics) MCFG_SNAPSHOT_ADD("snapshot", mtx, "mtb", 0.5) MCFG_CASSETTE_ADD(CASSETTE_TAG, mtx_cassette_interface) - MCFG_TIMER_ADD_PERIODIC("cassette_timer", cassette_tick, attotime::from_hz(44100)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", mtx_state, cassette_tick, attotime::from_hz(44100)) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mess/drivers/mz700.c b/src/mess/drivers/mz700.c index 7295cba74d3..703f2eda03d 100644 --- a/src/mess/drivers/mz700.c +++ b/src/mess/drivers/mz700.c @@ -83,16 +83,14 @@ TIMER DEVICE CALLBACKS ***************************************************************************/ -static TIMER_DEVICE_CALLBACK( ne556_cursor_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(mz_state::ne556_cursor_callback) { - mz_state *mz = timer.machine().driver_data<mz_state>(); - mz->m_cursor_timer ^= 1; + m_cursor_timer ^= 1; } -static TIMER_DEVICE_CALLBACK( ne556_other_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(mz_state::ne556_other_callback) { - mz_state *mz = timer.machine().driver_data<mz_state>(); - mz->m_other_timer ^= 1; + m_other_timer ^= 1; } @@ -370,8 +368,8 @@ static MACHINE_CONFIG_START( mz700, mz_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* ne556 timers */ - MCFG_TIMER_ADD_PERIODIC("cursor", ne556_cursor_callback, attotime::from_hz(1.5)) - MCFG_TIMER_ADD_PERIODIC("other", ne556_other_callback, attotime::from_hz(34.5)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cursor", mz_state, ne556_cursor_callback, attotime::from_hz(1.5)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("other", mz_state, ne556_other_callback, attotime::from_hz(34.5)) /* devices */ MCFG_PIT8253_ADD("pit8253", mz700_pit8253_config) diff --git a/src/mess/drivers/mz80.c b/src/mess/drivers/mz80.c index dafbb2277a5..9e2df894041 100644 --- a/src/mess/drivers/mz80.c +++ b/src/mess/drivers/mz80.c @@ -269,10 +269,9 @@ static const cassette_interface mz80k_cassette_interface = NULL }; -static TIMER_DEVICE_CALLBACK( ne555_tempo_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(mz80_state::ne555_tempo_callback) { - mz80_state *state = timer.machine().driver_data<mz80_state>(); - state->m_mz80k_tempo_strobe ^= 1; + m_mz80k_tempo_strobe ^= 1; } static MACHINE_CONFIG_START( mz80k, mz80_state ) @@ -304,7 +303,7 @@ static MACHINE_CONFIG_START( mz80k, mz80_state ) /* Devices */ MCFG_I8255_ADD( "ppi8255", mz80k_8255_int ) MCFG_PIT8253_ADD( "pit8253", mz80k_pit8253_config ) - MCFG_TIMER_ADD_PERIODIC("tempo", ne555_tempo_callback, attotime::from_hz(34)) // 33.5Hz - 34.3Hz + MCFG_TIMER_DRIVER_ADD_PERIODIC("tempo", mz80_state, ne555_tempo_callback, attotime::from_hz(34)) MCFG_CASSETTE_ADD( CASSETTE_TAG, mz80k_cassette_interface ) MACHINE_CONFIG_END diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c index 917cc466d53..2bcdfb25aca 100644 --- a/src/mess/drivers/nc.c +++ b/src/mess/drivers/nc.c @@ -492,15 +492,14 @@ static void nc_common_close_stream(running_machine &machine) -static TIMER_DEVICE_CALLBACK(dummy_timer_callback) +TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) { - nc_state *state = timer.machine().driver_data<nc_state>(); int inputport_10_state; int changed_bits; - inputport_10_state = timer.machine().root_device().ioport("EXTRA")->read(); + inputport_10_state = machine().root_device().ioport("EXTRA")->read(); - changed_bits = inputport_10_state^state->m_previous_inputport_10_state; + changed_bits = inputport_10_state^m_previous_inputport_10_state; /* on/off button changed state? */ if (changed_bits & 0x01) @@ -509,19 +508,19 @@ static TIMER_DEVICE_CALLBACK(dummy_timer_callback) { /* on NC100 on/off button causes a nmi, on nc200 on/off button causes an int */ - switch (state->m_type) + switch (m_type) { case NC_TYPE_1xx: { LOG(("nmi triggered\n")); - timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } break; case NC_TYPE_200: { - state->m_irq_status |= (1 << 4); - nc_update_interrupts(timer.machine()); + m_irq_status |= (1 << 4); + nc_update_interrupts(machine()); } break; } @@ -532,10 +531,10 @@ static TIMER_DEVICE_CALLBACK(dummy_timer_callback) if (changed_bits & 0x02) { /* yes refresh memory config */ - nc_refresh_memory_config(timer.machine()); + nc_refresh_memory_config(machine()); } - state->m_previous_inputport_10_state = inputport_10_state; + m_previous_inputport_10_state = inputport_10_state; } @@ -1640,7 +1639,7 @@ static MACHINE_CONFIG_START( nc100, nc_state ) MCFG_RAM_DEFAULT_SIZE("64K") /* dummy timer */ - MCFG_TIMER_ADD_PERIODIC("dummy_timer", dummy_timer_callback, attotime::from_hz(50)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("dummy_timer", nc_state, dummy_timer_callback, attotime::from_hz(50)) MACHINE_CONFIG_END static const floppy_interface nc200_floppy_interface = diff --git a/src/mess/drivers/newbrain.c b/src/mess/drivers/newbrain.c index 8dac24e0c8b..423b973f484 100644 --- a/src/mess/drivers/newbrain.c +++ b/src/mess/drivers/newbrain.c @@ -730,15 +730,13 @@ WRITE8_MEMBER( newbrain_state::cop_w ) } } -static TIMER_DEVICE_CALLBACK( cop_regint_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(newbrain_state::cop_regint_tick) { - newbrain_state *state = timer.machine().driver_data<newbrain_state>(); - - if (state->m_copregint) + if (m_copregint) { logerror("COP REGINT\n"); - state->m_copint = 0; - state->check_interrupt(); + m_copint = 0; + check_interrupt(); } } @@ -1226,12 +1224,10 @@ static Z80CTC_INTERFACE( newbrain_ctc_intf ) DEVCB_DRIVER_LINE_MEMBER(newbrain_eim_state, ctc_z2_w) /* ZC/TO2 callback */ }; -static TIMER_DEVICE_CALLBACK( ctc_c2_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(newbrain_eim_state::ctc_c2_tick) { - newbrain_eim_state *state = timer.machine().driver_data<newbrain_eim_state>(); - - state->m_ctc->trg2(1); - state->m_ctc->trg2(0); + m_ctc->trg2(1); + m_ctc->trg2(0); } inline int newbrain_state::get_reset_t() @@ -1388,7 +1384,7 @@ static MACHINE_CONFIG_START( newbrain_a, newbrain_state ) MCFG_GFXDECODE(newbrain) - MCFG_TIMER_ADD_PERIODIC("cop_regint", cop_regint_tick, attotime::from_usec(12500)) // HACK + MCFG_TIMER_DRIVER_ADD_PERIODIC("cop_regint", newbrain_state, cop_regint_tick, attotime::from_usec(12500)) // video hardware MCFG_FRAGMENT_ADD(newbrain_video) @@ -1430,7 +1426,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( newbrain_eim, newbrain_a, newbrain_eim_stat // devices MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_16MHz/8, newbrain_ctc_intf) - MCFG_TIMER_ADD_PERIODIC("z80ctc_c2", ctc_c2_tick, attotime::from_hz(XTAL_16MHz/4/13)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("z80ctc_c2", newbrain_eim_state, ctc_c2_tick, attotime::from_hz(XTAL_16MHz/4/13)) MCFG_ADC0808_ADD(ADC0809_TAG, 500000, adc_intf) MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf) MCFG_UPD765A_ADD(UPD765_TAG, fdc_intf) diff --git a/src/mess/drivers/pc.c b/src/mess/drivers/pc.c index 8f6d77e9442..640d03f9b11 100644 --- a/src/mess/drivers/pc.c +++ b/src/mess/drivers/pc.c @@ -878,7 +878,7 @@ SLOT_INTERFACE_END MCFG_CPU_ADD("maincpu", type, clock) \ MCFG_CPU_PROGRAM_MAP(mem##_map) \ MCFG_CPU_IO_MAP(port##_io) \ - MCFG_TIMER_ADD_SCANLINE("scantimer", vblankfunc, "screen", 0, 1) \ + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", pc_state, vblankfunc, "screen", 0, 1) \ MCFG_CPU_CONFIG(i86_address_mask) diff --git a/src/mess/drivers/pc8401a.c b/src/mess/drivers/pc8401a.c index 787c49a9e7e..c5f9569df64 100644 --- a/src/mess/drivers/pc8401a.c +++ b/src/mess/drivers/pc8401a.c @@ -61,11 +61,9 @@ void pc8401a_state::scan_keyboard() if (strobe) m_key_strobe = strobe; } -static TIMER_DEVICE_CALLBACK( pc8401a_keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(pc8401a_state::pc8401a_keyboard_tick) { - pc8401a_state *state = timer.machine().driver_data<pc8401a_state>(); - - state->scan_keyboard(); + scan_keyboard(); } /* Read/Write Handlers */ @@ -602,7 +600,7 @@ static MACHINE_CONFIG_START( pc8401a, pc8401a_state ) MCFG_CPU_IO_MAP(pc8401a_io) /* fake keyboard */ - MCFG_TIMER_ADD_PERIODIC("keyboard", pc8401a_keyboard_tick, attotime::from_hz(64)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", pc8401a_state, pc8401a_keyboard_tick, attotime::from_hz(64)) /* devices */ MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, rtc_intf) @@ -635,7 +633,7 @@ static MACHINE_CONFIG_START( pc8500, pc8500_state ) MCFG_CPU_IO_MAP(pc8500_io) /* fake keyboard */ - MCFG_TIMER_ADD_PERIODIC("keyboard", pc8401a_keyboard_tick, attotime::from_hz(64)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", pc8401a_state, pc8401a_keyboard_tick, attotime::from_hz(64)) /* devices */ MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, rtc_intf) diff --git a/src/mess/drivers/pcw.c b/src/mess/drivers/pcw.c index 9e87a8e38ea..eda727056c9 100644 --- a/src/mess/drivers/pcw.c +++ b/src/mess/drivers/pcw.c @@ -169,14 +169,13 @@ TIMER_CALLBACK_MEMBER(pcw_state::pcw_timer_pulse) } /* callback for 1/300ths of a second interrupt */ -static TIMER_DEVICE_CALLBACK(pcw_timer_interrupt) +TIMER_DEVICE_CALLBACK_MEMBER(pcw_state::pcw_timer_interrupt) { - pcw_state *state = timer.machine().driver_data<pcw_state>(); - pcw_update_interrupt_counter(state); + pcw_update_interrupt_counter(this); - state->m_timer_irq_flag = 1; - pcw_update_irqs(timer.machine()); - timer.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse),state)); + m_timer_irq_flag = 1; + pcw_update_irqs(machine()); + machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse),this)); } /* fdc interrupt callback. set/clear fdc int */ @@ -1347,7 +1346,7 @@ static MACHINE_CONFIG_START( pcw, pcw_state ) MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("256K") - MCFG_TIMER_ADD_PERIODIC("pcw_timer", pcw_timer_interrupt, attotime::from_hz(300)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("pcw_timer", pcw_state, pcw_timer_interrupt, attotime::from_hz(300)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pcw8256, pcw ) diff --git a/src/mess/drivers/pcw16.c b/src/mess/drivers/pcw16.c index 3f0e0dac3f8..4e9688cdc3c 100644 --- a/src/mess/drivers/pcw16.c +++ b/src/mess/drivers/pcw16.c @@ -134,20 +134,19 @@ void pcw16_state::pcw16_refresh_ints() } -static TIMER_DEVICE_CALLBACK(pcw16_timer_callback) +TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::pcw16_timer_callback) { - pcw16_state *state = timer.machine().driver_data<pcw16_state>(); /* do not increment past 15 */ - if (state->m_interrupt_counter!=15) + if (m_interrupt_counter!=15) { - state->m_interrupt_counter++; + m_interrupt_counter++; /* display int */ - state->m_system_status |= (1<<0); + m_system_status |= (1<<0); } - if (state->m_interrupt_counter!=0) + if (m_interrupt_counter!=0) { - state->pcw16_refresh_ints(); + pcw16_refresh_ints(); } } @@ -878,11 +877,10 @@ WRITE8_MEMBER(pcw16_state::pcw16_keyboard_control_w) } -static TIMER_DEVICE_CALLBACK(pcw16_keyboard_timer_callback) +TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::pcw16_keyboard_timer_callback) { - pcw16_state *state = timer.machine().driver_data<pcw16_state>(); at_keyboard_polling(); - if (state->pcw16_keyboard_can_transmit()) + if (pcw16_keyboard_can_transmit()) { int data; @@ -895,11 +893,11 @@ static TIMER_DEVICE_CALLBACK(pcw16_keyboard_timer_callback) // pcw16_dump_cpu_ram(); // } - state->pcw16_keyboard_signal_byte_received(data); + pcw16_keyboard_signal_byte_received(data); } } // TODO: fix - state->subdevice<ns16550_device>("ns16550_2")->ri_w((timer.machine().root_device().ioport("EXTRA")->read() & 0x040) ? 0 : 1); + subdevice<ns16550_device>("ns16550_2")->ri_w((machine().root_device().ioport("EXTRA")->read() & 0x040) ? 0 : 1); } @@ -938,58 +936,57 @@ void pcw16_state::rtc_setup_max_days() } } -static TIMER_DEVICE_CALLBACK(rtc_timer_callback) +TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::rtc_timer_callback) { - pcw16_state *state = timer.machine().driver_data<pcw16_state>(); int fraction_of_second; /* halt counter? */ - if ((state->m_rtc_control & 0x01)!=0) + if ((m_rtc_control & 0x01)!=0) { /* no */ /* increment 256th's of a second register */ - fraction_of_second = state->m_rtc_256ths_seconds+1; + fraction_of_second = m_rtc_256ths_seconds+1; /* add bit 8 = overflow */ - state->m_rtc_seconds+=(fraction_of_second>>8); + m_rtc_seconds+=(fraction_of_second>>8); /* ensure counter is in range 0-255 */ - state->m_rtc_256ths_seconds = fraction_of_second & 0x0ff; + m_rtc_256ths_seconds = fraction_of_second & 0x0ff; } - if (state->m_rtc_seconds>59) + if (m_rtc_seconds>59) { - state->m_rtc_seconds = 0; + m_rtc_seconds = 0; - state->m_rtc_minutes++; + m_rtc_minutes++; - if (state->m_rtc_minutes>59) + if (m_rtc_minutes>59) { - state->m_rtc_minutes = 0; + m_rtc_minutes = 0; - state->m_rtc_hours++; + m_rtc_hours++; - if (state->m_rtc_hours>23) + if (m_rtc_hours>23) { - state->m_rtc_hours = 0; + m_rtc_hours = 0; - state->m_rtc_days++; + m_rtc_days++; - if (state->m_rtc_days > state->m_rtc_days_max) + if (m_rtc_days > m_rtc_days_max) { - state->m_rtc_days = 1; + m_rtc_days = 1; - state->m_rtc_months++; + m_rtc_months++; - if (state->m_rtc_months>12) + if (m_rtc_months>12) { - state->m_rtc_months = 1; + m_rtc_months = 1; /* 7 bit year counter */ - state->m_rtc_years = (state->m_rtc_years + 1) & 0x07f; + m_rtc_years = (m_rtc_years + 1) & 0x07f; } - state->rtc_setup_max_days(); + rtc_setup_max_days(); } } @@ -1512,11 +1509,11 @@ static MACHINE_CONFIG_START( pcw16, pcw16_state ) MCFG_INTEL_E28F008SA_ADD("flash1") /* video ints */ - MCFG_TIMER_ADD_PERIODIC("video_timer", pcw16_timer_callback, attotime::from_usec(5830)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("video_timer", pcw16_state, pcw16_timer_callback, attotime::from_usec(5830)) /* rtc timer */ - MCFG_TIMER_ADD_PERIODIC("rtc_timer", rtc_timer_callback, attotime::from_hz(256)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", pcw16_state, rtc_timer_callback, attotime::from_hz(256)) /* keyboard timer */ - MCFG_TIMER_ADD_PERIODIC("keyboard_timer", pcw16_keyboard_timer_callback, attotime::from_hz(50)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", pcw16_state, pcw16_keyboard_timer_callback, attotime::from_hz(50)) MACHINE_CONFIG_END /*************************************************************************** diff --git a/src/mess/drivers/portfoli.c b/src/mess/drivers/portfoli.c index cc174efa0ab..35b771ea841 100644 --- a/src/mess/drivers/portfoli.c +++ b/src/mess/drivers/portfoli.c @@ -247,11 +247,9 @@ void portfolio_state::scan_keyboard() // TIMER_DEVICE_CALLBACK( keyboard_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::keyboard_tick) { - portfolio_state *state = timer.machine().driver_data<portfolio_state>(); - - state->scan_keyboard(); + scan_keyboard(); } //------------------------------------------------- @@ -370,22 +368,18 @@ WRITE8_MEMBER( portfolio_state::unknown_w ) // TIMER_DEVICE_CALLBACK( system_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( system_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::system_tick) { - portfolio_state *state = timer.machine().driver_data<portfolio_state>(); - - state->trigger_interrupt(INT_TICK); + trigger_interrupt(INT_TICK); } //------------------------------------------------- // TIMER_DEVICE_CALLBACK( counter_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( counter_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(portfolio_state::counter_tick) { - portfolio_state *state = timer.machine().driver_data<portfolio_state>(); - - state->m_counter++; + m_counter++; } //------------------------------------------------- @@ -859,11 +853,11 @@ static MACHINE_CONFIG_START( portfolio, portfolio_state ) MCFG_I8255A_ADD(M82C55A_TAG, ppi_intf) MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf) MCFG_INS8250_ADD(M82C50A_TAG, i8250_intf, XTAL_1_8432MHz) // should be MCFG_INS8250A_ADD - MCFG_TIMER_ADD_PERIODIC("counter", counter_tick, attotime::from_hz(XTAL_32_768kHz/16384)) - MCFG_TIMER_ADD_PERIODIC(TIMER_TICK_TAG, system_tick, attotime::from_hz(XTAL_32_768kHz/32768)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("counter", portfolio_state, counter_tick, attotime::from_hz(XTAL_32_768kHz/16384)) + MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_TICK_TAG, portfolio_state, system_tick, attotime::from_hz(XTAL_32_768kHz/32768)) /* fake keyboard */ - MCFG_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, attotime::from_usec(2500)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", portfolio_state, keyboard_tick, attotime::from_usec(2500)) /* cartridge */ MCFG_CARTSLOT_ADD("cart") diff --git a/src/mess/drivers/psion.c b/src/mess/drivers/psion.c index ffa18a93200..571e8027fc7 100644 --- a/src/mess/drivers/psion.c +++ b/src/mess/drivers/psion.c @@ -22,12 +22,10 @@ #include "includes/psion.h" #include "rendlay.h" -static TIMER_DEVICE_CALLBACK( nmi_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(psion_state::nmi_timer) { - psion_state *state = timer.machine().driver_data<psion_state>(); - - if (state->m_enable_nmi) - timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (m_enable_nmi) + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } UINT8 psion_state::kb_read(running_machine &machine) @@ -492,7 +490,7 @@ static MACHINE_CONFIG_START( psion_2lines, psion_state ) MCFG_NVRAM_HANDLER(psion) - MCFG_TIMER_ADD_PERIODIC("nmi_timer", nmi_timer, attotime::from_seconds(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", psion_state, nmi_timer, attotime::from_seconds(1)) /* Datapack */ MCFG_PSION_DATAPACK_ADD("pack1") diff --git a/src/mess/drivers/super6.c b/src/mess/drivers/super6.c index 17134bcef80..b23c591590c 100644 --- a/src/mess/drivers/super6.c +++ b/src/mess/drivers/super6.c @@ -349,12 +349,10 @@ INPUT_PORTS_END // Z80CTC_INTERFACE( ctc_intf ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( ctc_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(super6_state::ctc_tick) { - super6_state *state = timer.machine().driver_data<super6_state>(); - - state->m_ctc->trg0(1); - state->m_ctc->trg0(0); + m_ctc->trg0(1); + m_ctc->trg0(0); } static Z80CTC_INTERFACE( ctc_intf ) @@ -570,7 +568,7 @@ static MACHINE_CONFIG_START( super6, super6_state ) // devices MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_24MHz/4, ctc_intf) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_24MHz/16)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", super6_state, ctc_tick, attotime::from_hz(XTAL_24MHz/16)) MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_24MHz/4, dart_intf) MCFG_Z80DMA_ADD(Z80DMA_TAG, XTAL_24MHz/6, dma_intf) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_24MHz/4, pio_intf) diff --git a/src/mess/drivers/svision.c b/src/mess/drivers/svision.c index b6060605ec6..51cfffbe875 100644 --- a/src/mess/drivers/svision.c +++ b/src/mess/drivers/svision.c @@ -50,10 +50,9 @@ TIMER_CALLBACK_MEMBER(svision_state::svision_pet_timer) } } -static TIMER_DEVICE_CALLBACK(svision_pet_timer_dev) +TIMER_DEVICE_CALLBACK_MEMBER(svision_state::svision_pet_timer_dev) { - svision_state *state = timer.machine().driver_data<svision_state>(); - state->svision_pet_timer(ptr,param); + svision_pet_timer(ptr,param); } void svision_irq(running_machine &machine) @@ -544,7 +543,7 @@ static MACHINE_CONFIG_START( svision, svision_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( svisions, svision ) - MCFG_TIMER_ADD_PERIODIC("pet_timer", svision_pet_timer_dev, attotime::from_seconds(8) * 256/4000000) + MCFG_TIMER_DRIVER_ADD_PERIODIC("pet_timer", svision_state, svision_pet_timer_dev, attotime::from_seconds(8)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( svisionp, svision ) diff --git a/src/mess/drivers/tek405x.c b/src/mess/drivers/tek405x.c index b7936225b87..856053645a0 100644 --- a/src/mess/drivers/tek405x.c +++ b/src/mess/drivers/tek405x.c @@ -98,11 +98,9 @@ void tek4051_state::scan_keyboard() // TIMER_DEVICE_CALLBACK( keyboard_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(tek4051_state::keyboard_tick) { - tek4051_state *state = timer.machine().driver_data<tek4051_state>(); - - state->scan_keyboard(); + scan_keyboard(); } @@ -1230,7 +1228,7 @@ static MACHINE_CONFIG_START( tek4051, tek4051_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) // devices - MCFG_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, attotime::from_hz(XTAL_12_5MHz/15/4)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", tek4051_state, keyboard_tick, attotime::from_hz(XTAL_12_5MHz/15/4)) MCFG_PIA6821_ADD(MC6820_X_TAG, x_pia_intf) MCFG_PIA6821_ADD(MC6820_Y_TAG, y_pia_intf) MCFG_PIA6821_ADD(MC6820_KB_TAG, kb_pia_intf) diff --git a/src/mess/drivers/ti89.c b/src/mess/drivers/ti89.c index c0a9ae2cc33..858328dce76 100644 --- a/src/mess/drivers/ti89.c +++ b/src/mess/drivers/ti89.c @@ -152,37 +152,35 @@ READ16_MEMBER ( ti68k_state::flash_r ) } -static TIMER_DEVICE_CALLBACK( ti68k_timer_callback ) +TIMER_DEVICE_CALLBACK_MEMBER(ti68k_state::ti68k_timer_callback) { - ti68k_state *state = timer.machine().driver_data<ti68k_state>(); + m_timer++; - state->m_timer++; - - if (state->m_timer_on) + if (m_timer_on) { - if (!(state->m_timer & state->m_timer_mask) && BIT(state->m_io_hw1[0x0a], 3)) + if (!(m_timer & m_timer_mask) && BIT(m_io_hw1[0x0a], 3)) { - if (state->m_timer_val) - state->m_timer_val++; + if (m_timer_val) + m_timer_val++; else - state->m_timer_val = (state->m_io_hw1[0x0b]) & 0xff; + m_timer_val = (m_io_hw1[0x0b]) & 0xff; } - if (!BIT(state->m_io_hw1[0x0a], 7) && ((state->m_hw_version == state->m_HW1) || (!BIT(state->m_io_hw1[0x0f], 2) && !BIT(state->m_io_hw1[0x0f], 1)))) + if (!BIT(m_io_hw1[0x0a], 7) && ((m_hw_version == m_HW1) || (!BIT(m_io_hw1[0x0f], 2) && !BIT(m_io_hw1[0x0f], 1)))) { - if (!(state->m_timer & 0x003f)) - state->m_maincpu->set_input_line(M68K_IRQ_1, HOLD_LINE); + if (!(m_timer & 0x003f)) + m_maincpu->set_input_line(M68K_IRQ_1, HOLD_LINE); - if (!(state->m_timer & 0x3fff) && !BIT(state->m_io_hw1[0x0a], 3)) - state->m_maincpu->set_input_line(M68K_IRQ_3, HOLD_LINE); + if (!(m_timer & 0x3fff) && !BIT(m_io_hw1[0x0a], 3)) + m_maincpu->set_input_line(M68K_IRQ_3, HOLD_LINE); - if (!(state->m_timer & state->m_timer_mask) && BIT(state->m_io_hw1[0x0a], 3) && state->m_timer_val == 0) - state->m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE); + if (!(m_timer & m_timer_mask) && BIT(m_io_hw1[0x0a], 3) && m_timer_val == 0) + m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE); } } - if (state->keypad_r(timer.machine()) != 0xff) - state->m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); + if (keypad_r(machine()) != 0xff) + m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); } @@ -526,7 +524,7 @@ static MACHINE_CONFIG_START( ti89, ti68k_state ) MCFG_SHARP_UNK128MBIT_ADD("flash") //should be LH28F320 for ti89t and v200 and LH28F160S3T for other models - MCFG_TIMER_ADD_PERIODIC("ti68k_timer", ti68k_timer_callback, attotime::from_hz(1<<14)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ti68k_timer", ti68k_state, ti68k_timer_callback, attotime::from_hz(1<<14)) MACHINE_CONFIG_END diff --git a/src/mess/drivers/tiki100.c b/src/mess/drivers/tiki100.c index a1a4e1fdbbe..732411c2b61 100644 --- a/src/mess/drivers/tiki100.c +++ b/src/mess/drivers/tiki100.c @@ -483,15 +483,13 @@ static Z80PIO_INTERFACE( pio_intf ) /* Z80-CTC Interface */ -static TIMER_DEVICE_CALLBACK( ctc_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(tiki100_state::ctc_tick) { - tiki100_state *state = timer.machine().driver_data<tiki100_state>(); + m_ctc->trg0(1); + m_ctc->trg0(0); - state->m_ctc->trg0(1); - state->m_ctc->trg0(0); - - state->m_ctc->trg1(1); - state->m_ctc->trg1(0); + m_ctc->trg1(1); + m_ctc->trg1(0); } WRITE_LINE_MEMBER( tiki100_state::ctc_z1_w ) @@ -639,7 +637,7 @@ static MACHINE_CONFIG_START( tiki100, tiki100_state ) MCFG_Z80DART_ADD(Z80DART_TAG, XTAL_8MHz/4, dart_intf) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_8MHz/4, pio_intf) MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/4, ctc_intf) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_8MHz/4)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", tiki100_state, ctc_tick, attotime::from_hz(XTAL_8MHz/4)) MCFG_FD1797_ADD(FD1797_TAG, fdc_intf) // FD1767PL-02 or FD1797-PL MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(tiki100_floppy_interface) diff --git a/src/mess/drivers/trs80m2.c b/src/mess/drivers/trs80m2.c index 390d1470554..de616bdd34b 100644 --- a/src/mess/drivers/trs80m2.c +++ b/src/mess/drivers/trs80m2.c @@ -109,11 +109,9 @@ void trs80m2_state::scan_keyboard() } } -static TIMER_DEVICE_CALLBACK( trs80m2_keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(trs80m2_state::trs80m2_keyboard_tick) { - trs80m2_state *state = timer.machine().driver_data<trs80m2_state>(); - - state->scan_keyboard(); + scan_keyboard(); } @@ -833,18 +831,16 @@ static Z80DART_INTERFACE( sio_intf ) // Z80CTC_INTERFACE( ctc_intf ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( ctc_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(trs80m2_state::ctc_tick) { - trs80m2_state *state = timer.machine().driver_data<trs80m2_state>(); - - state->m_ctc->trg0(1); - state->m_ctc->trg0(0); + m_ctc->trg0(1); + m_ctc->trg0(0); - state->m_ctc->trg1(1); - state->m_ctc->trg1(0); + m_ctc->trg1(1); + m_ctc->trg1(0); - state->m_ctc->trg2(1); - state->m_ctc->trg2(0); + m_ctc->trg2(1); + m_ctc->trg2(0); } static Z80CTC_INTERFACE( ctc_intf ) @@ -1016,7 +1012,7 @@ static MACHINE_CONFIG_START( trs80m2, trs80m2_state ) // devices MCFG_FD1791_ADD(FD1791_TAG, fdc_intf) MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/2, ctc_intf) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) MCFG_Z80DMA_ADD(Z80DMA_TAG, XTAL_8MHz/2, dma_intf) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_8MHz/2, pio_intf) MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_8MHz/2, sio_intf) @@ -1024,7 +1020,7 @@ static MACHINE_CONFIG_START( trs80m2, trs80m2_state ) MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, trs80m2_floppy_interface) MCFG_TRS80M2_KEYBOARD_ADD(kb_intf) - MCFG_TIMER_ADD_PERIODIC("keyboard", trs80m2_keyboard_tick,attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", trs80m2_state, trs80m2_keyboard_tick, attotime::from_hz(60)) // internal RAM MCFG_RAM_ADD(RAM_TAG) @@ -1067,7 +1063,7 @@ static MACHINE_CONFIG_START( trs80m16, trs80m16_state ) // devices MCFG_FD1791_ADD(FD1791_TAG, fdc_intf) MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/2, ctc_intf) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", trs80m2_state, ctc_tick, attotime::from_hz(XTAL_8MHz/2/2)) MCFG_Z80DMA_ADD(Z80DMA_TAG, XTAL_8MHz/2, dma_intf) MCFG_Z80PIO_ADD(Z80PIO_TAG, XTAL_8MHz/2, pio_intf) MCFG_Z80SIO0_ADD(Z80SIO_TAG, XTAL_8MHz/2, sio_intf) @@ -1076,7 +1072,7 @@ static MACHINE_CONFIG_START( trs80m16, trs80m16_state ) MCFG_PIC8259_ADD(AM9519A_TAG, pic_intf) MCFG_TRS80M2_KEYBOARD_ADD(kb_intf) - MCFG_TIMER_ADD_PERIODIC("keyboard", trs80m2_keyboard_tick,attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", trs80m2_state, trs80m2_keyboard_tick, attotime::from_hz(60)) // internal RAM MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mess/drivers/v1050.c b/src/mess/drivers/v1050.c index e053eb2fcbb..c9e3f10019b 100644 --- a/src/mess/drivers/v1050.c +++ b/src/mess/drivers/v1050.c @@ -272,11 +272,9 @@ void v1050_state::scan_keyboard() m_keydata = keydata; } -static TIMER_DEVICE_CALLBACK( v1050_keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::v1050_keyboard_tick) { - v1050_state *state = timer.machine().driver_data<v1050_state>(); - - state->scan_keyboard(); + scan_keyboard(); } READ8_MEMBER( v1050_state::kb_data_r ) @@ -374,18 +372,14 @@ READ8_MEMBER( v1050_state::sasi_status_r ) return data; } -static TIMER_DEVICE_CALLBACK( sasi_ack_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_ack_tick) { - v1050_state *state = timer.machine().driver_data<v1050_state>(); - - state->m_sasibus->scsi_ack_w(1); + m_sasibus->scsi_ack_w(1); } -static TIMER_DEVICE_CALLBACK( sasi_rst_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sasi_rst_tick) { - v1050_state *state = timer.machine().driver_data<v1050_state>(); - - state->m_sasibus->scsi_rst_w(1); + m_sasibus->scsi_rst_w(1); } WRITE8_MEMBER( v1050_state::sasi_ctrl_w ) @@ -867,12 +861,10 @@ static I8255A_INTERFACE( rtc_ppi_intf ) // Keyboard 8251A Interface -static TIMER_DEVICE_CALLBACK( kb_8251_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::kb_8251_tick) { - v1050_state *state = timer.machine().driver_data<v1050_state>(); - - state->m_uart_kb->transmit_clock(); - state->m_uart_kb->receive_clock(); + m_uart_kb->transmit_clock(); + m_uart_kb->receive_clock(); } WRITE_LINE_MEMBER( v1050_state::kb_rxrdy_w ) @@ -895,12 +887,10 @@ static const i8251_interface kb_8251_intf = // Serial 8251A Interface -static TIMER_DEVICE_CALLBACK( sio_8251_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sio_8251_tick) { - v1050_state *state = timer.machine().driver_data<v1050_state>(); - - state->m_uart_sio->transmit_clock(); - state->m_uart_sio->receive_clock(); + m_uart_sio->transmit_clock(); + m_uart_sio->receive_clock(); } WRITE_LINE_MEMBER( v1050_state::sio_rxrdy_w ) @@ -1090,7 +1080,7 @@ static MACHINE_CONFIG_START( v1050, v1050_state ) MCFG_QUANTUM_PERFECT_CPU(M6502_TAG) // keyboard HACK - MCFG_TIMER_ADD_PERIODIC("keyboard", v1050_keyboard_tick, attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", v1050_state, v1050_keyboard_tick, attotime::from_hz(60)) // video hardware MCFG_FRAGMENT_ADD(v1050_video) @@ -1106,16 +1096,16 @@ static MACHINE_CONFIG_START( v1050, v1050_state ) MCFG_I8251_ADD(I8251A_SIO_TAG, /*XTAL_16MHz/8,*/ sio_8251_intf) MCFG_MB8877_ADD(MB8877_TAG, /*XTAL_16MHz/16,*/ fdc_intf ) MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(v1050_floppy_interface) - MCFG_TIMER_ADD_PERIODIC(TIMER_KB_TAG, kb_8251_tick, attotime::from_hz((double)XTAL_16MHz/4/13/8)) - MCFG_TIMER_ADD(TIMER_SIO_TAG, sio_8251_tick) + MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_KB_TAG, v1050_state, kb_8251_tick, attotime::from_hz((double)XTAL_16MHz/4/13/8)) + MCFG_TIMER_DRIVER_ADD(TIMER_SIO_TAG, v1050_state, sio_8251_tick) // SASI bus MCFG_SCSIBUS_ADD(SASIBUS_TAG) MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", S1410, SCSI_ID_0) MCFG_SCSICB_ADD(SASIBUS_TAG ":host", sasi_intf) - MCFG_TIMER_ADD(TIMER_ACK_TAG, sasi_ack_tick) - MCFG_TIMER_ADD(TIMER_RST_TAG, sasi_rst_tick) + MCFG_TIMER_DRIVER_ADD(TIMER_ACK_TAG, v1050_state, sasi_ack_tick) + MCFG_TIMER_DRIVER_ADD(TIMER_RST_TAG, v1050_state, sasi_rst_tick) // keyboard MCFG_V1050_KEYBOARD_ADD() diff --git a/src/mess/drivers/vcs80.c b/src/mess/drivers/vcs80.c index 916c6fb5165..4ccdc656ec3 100644 --- a/src/mess/drivers/vcs80.c +++ b/src/mess/drivers/vcs80.c @@ -108,19 +108,17 @@ INPUT_PORTS_END /* Z80-PIO Interface */ -static TIMER_DEVICE_CALLBACK( vcs80_keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(vcs80_state::vcs80_keyboard_tick) { - vcs80_state *state = timer.machine().driver_data<vcs80_state>(); - - if (state->m_keyclk) + if (m_keyclk) { - state->m_keylatch++; - state->m_keylatch &= 7; + m_keylatch++; + m_keylatch &= 7; } - state->m_pio->port_a_write(state->m_keyclk << 7); + m_pio->port_a_write(m_keyclk << 7); - state->m_keyclk = !state->m_keyclk; + m_keyclk = !m_keyclk; } READ8_MEMBER( vcs80_state::pio_pa_r ) @@ -223,7 +221,7 @@ static MACHINE_CONFIG_START( vcs80, vcs80_state ) MCFG_CPU_CONFIG(vcs80_daisy_chain) /* keyboard timer */ - MCFG_TIMER_ADD_PERIODIC("keyboard", vcs80_keyboard_tick, attotime::from_hz(1000)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", vcs80_state, vcs80_keyboard_tick, attotime::from_hz(1000)) /* video hardware */ MCFG_DEFAULT_LAYOUT( layout_vcs80 ) diff --git a/src/mess/drivers/vixen.c b/src/mess/drivers/vixen.c index a32207b59e0..6254e7f39c3 100644 --- a/src/mess/drivers/vixen.c +++ b/src/mess/drivers/vixen.c @@ -393,14 +393,12 @@ INPUT_PORTS_END // TIMER_DEVICE_CALLBACK( vsync_tick ) //------------------------------------------------- -static TIMER_DEVICE_CALLBACK( vsync_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(vixen_state::vsync_tick) { - vixen_state *state = timer.machine().driver_data<vixen_state>(); - - if (state->m_cmd_d0) + if (m_cmd_d0) { - state->m_vsync = 1; - state->update_interrupt(); + m_vsync = 1; + update_interrupt(); } } @@ -846,7 +844,7 @@ static MACHINE_CONFIG_START( vixen, vixen_state ) MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) MCFG_SCREEN_UPDATE_DRIVER(vixen_state, screen_update) MCFG_SCREEN_RAW_PARAMS(XTAL_23_9616MHz/2, 96*8, 0*8, 81*8, 27*10, 0*10, 26*10) - MCFG_TIMER_ADD_SCANLINE("vsync", vsync_tick, SCREEN_TAG, 26*10, 27*10) + MCFG_TIMER_DRIVER_ADD_SCANLINE("vsync", vixen_state, vsync_tick, SCREEN_TAG, 26*10, 27*10) MCFG_PALETTE_LENGTH(2) MCFG_PALETTE_INIT(monochrome_amber) diff --git a/src/mess/drivers/x07.c b/src/mess/drivers/x07.c index 701cde1bf84..8b652666803 100644 --- a/src/mess/drivers/x07.c +++ b/src/mess/drivers/x07.c @@ -1358,11 +1358,9 @@ static NVRAM_HANDLER( x07 ) } } -static TIMER_DEVICE_CALLBACK( blink_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(x07_state::blink_timer) { - x07_state *state = timer.machine().driver_data<x07_state>(); - - state->m_blink = !state->m_blink; + m_blink = !m_blink; } TIMER_CALLBACK_MEMBER(x07_state::rsta_clear) @@ -1524,7 +1522,7 @@ static MACHINE_CONFIG_START( x07, x07_state ) /* printer */ MCFG_PRINTER_ADD("printer") - MCFG_TIMER_ADD_PERIODIC("blink_timer", blink_timer, attotime::from_msec(300)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("blink_timer", x07_state, blink_timer, attotime::from_msec(300)) MCFG_NVRAM_HANDLER( x07 ) diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index 854ae7385c3..b77f9e39cad 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -807,26 +807,24 @@ static void cmt_command( running_machine &machine, UINT8 cmd ) logerror("CMT: Command 0xe9-0x%02x received.\n",cmd); } -TIMER_DEVICE_CALLBACK( x1_cmt_wind_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_cmt_wind_timer) { - x1_state *state = timer.machine().driver_data<x1_state>(); - - if(state->m_cass->get_image() == NULL) //avoid a crash if a disk game tries to access this + if(m_cass->get_image() == NULL) //avoid a crash if a disk game tries to access this return; - switch(state->m_cmt_current_cmd) + switch(m_cmt_current_cmd) { case 0x03: case 0x05: // Fast Forwarding tape - state->m_cass->seek(1,SEEK_CUR); - if(state->m_cass->get_position() >= state->m_cass->get_length()) // at end? - cmt_command(timer.machine(),0x01); // Stop tape + m_cass->seek(1,SEEK_CUR); + if(m_cass->get_position() >= m_cass->get_length()) // at end? + cmt_command(machine(),0x01); // Stop tape break; case 0x04: case 0x06: // Rewinding tape - state->m_cass->seek(-1,SEEK_CUR); - if(state->m_cass->get_position() <= 0) // at beginning? - cmt_command(timer.machine(),0x01); // Stop tape + m_cass->seek(-1,SEEK_CUR); + if(m_cass->get_position() <= 0) // at beginning? + cmt_command(machine(),0x01); // Stop tape break; } } @@ -2401,33 +2399,32 @@ static IRQ_CALLBACK(x1_irq_callback) } #endif -TIMER_DEVICE_CALLBACK(x1_keyboard_callback) +TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_keyboard_callback) { - x1_state *state = timer.machine().driver_data<x1_state>(); - address_space &space = timer.machine().device("x1_cpu")->memory().space(AS_PROGRAM); - UINT32 key1 = timer.machine().root_device().ioport("key1")->read(); - UINT32 key2 = timer.machine().root_device().ioport("key2")->read(); - UINT32 key3 = timer.machine().root_device().ioport("key3")->read(); - UINT32 key4 = timer.machine().root_device().ioport("tenkey")->read(); - UINT32 f_key = timer.machine().root_device().ioport("f_keys")->read(); + address_space &space = machine().device("x1_cpu")->memory().space(AS_PROGRAM); + UINT32 key1 = machine().root_device().ioport("key1")->read(); + UINT32 key2 = machine().root_device().ioport("key2")->read(); + UINT32 key3 = machine().root_device().ioport("key3")->read(); + UINT32 key4 = machine().root_device().ioport("tenkey")->read(); + UINT32 f_key = machine().root_device().ioport("f_keys")->read(); - if(state->m_key_irq_vector) + if(m_key_irq_vector) { //if(key1 == 0 && key2 == 0 && key3 == 0 && key4 == 0 && f_key == 0) // return; - if((key1 != state->m_old_key1) || (key2 != state->m_old_key2) || (key3 != state->m_old_key3) || (key4 != state->m_old_key4) || (f_key != state->m_old_fkey)) + if((key1 != m_old_key1) || (key2 != m_old_key2) || (key3 != m_old_key3) || (key4 != m_old_key4) || (f_key != m_old_fkey)) { // generate keyboard IRQ - state->x1_sub_io_w(space,0,0xe6); - state->m_irq_vector = state->m_key_irq_vector; - state->m_key_irq_flag = 1; - timer.machine().device("x1_cpu")->execute().set_input_line(0,ASSERT_LINE); - state->m_old_key1 = key1; - state->m_old_key2 = key2; - state->m_old_key3 = key3; - state->m_old_key4 = key4; - state->m_old_fkey = f_key; + x1_sub_io_w(space,0,0xe6); + m_irq_vector = m_key_irq_vector; + m_key_irq_flag = 1; + machine().device("x1_cpu")->execute().set_input_line(0,ASSERT_LINE); + m_old_key1 = key1; + m_old_key2 = key2; + m_old_key3 = key3; + m_old_key4 = key4; + m_old_fkey = f_key; } } } @@ -2620,8 +2617,8 @@ static MACHINE_CONFIG_START( x1, x1_state ) MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface) MCFG_SOFTWARE_LIST_ADD("flop_list","x1_flop") - MCFG_TIMER_ADD_PERIODIC("keyboard_timer", x1_keyboard_callback, attotime::from_hz(250)) - MCFG_TIMER_ADD_PERIODIC("cmt_wind_timer", x1_cmt_wind_timer, attotime::from_hz(16)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1_state, x1_keyboard_callback, attotime::from_hz(250)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1_state, x1_cmt_wind_timer, attotime::from_hz(16)) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( x1turbo, x1 ) diff --git a/src/mess/drivers/x1twin.c b/src/mess/drivers/x1twin.c index 0be88977a9b..8790f02cc19 100644 --- a/src/mess/drivers/x1twin.c +++ b/src/mess/drivers/x1twin.c @@ -601,8 +601,8 @@ static MACHINE_CONFIG_START( x1twin, x1twin_state ) MCFG_SOUND_ROUTE(1, "pce_r", 0.5) #endif - MCFG_TIMER_ADD_PERIODIC("keyboard_timer", x1_keyboard_callback, attotime::from_hz(250)) - MCFG_TIMER_ADD_PERIODIC("cmt_wind_timer", x1_cmt_wind_timer, attotime::from_hz(16)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", x1twin_state, x1_keyboard_callback, attotime::from_hz(250)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("cmt_wind_timer", x1twin_state, x1_cmt_wind_timer, attotime::from_hz(16)) MACHINE_CONFIG_END ROM_START( x1twin ) diff --git a/src/mess/drivers/xerox820.c b/src/mess/drivers/xerox820.c index ffc5ac09a6b..fc6adda008b 100644 --- a/src/mess/drivers/xerox820.c +++ b/src/mess/drivers/xerox820.c @@ -133,10 +133,9 @@ void xerox820_state::scan_keyboard() m_keydata = keydata; } -static TIMER_DEVICE_CALLBACK( xerox820_keyboard_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(xerox820_state::xerox820_keyboard_tick) { - xerox820_state *state = timer.machine().driver_data<xerox820_state>(); - state->scan_keyboard(); + scan_keyboard(); } /* Read/Write Handlers */ @@ -552,12 +551,10 @@ static Z80DART_INTERFACE( sio_intf ) /* Z80 CTC */ -static TIMER_DEVICE_CALLBACK( ctc_tick ) +TIMER_DEVICE_CALLBACK_MEMBER(xerox820_state::ctc_tick) { - xerox820_state *state = timer.machine().driver_data<xerox820_state>(); - - state->m_ctc->trg0(1); - state->m_ctc->trg0(0); + m_ctc->trg0(1); + m_ctc->trg0(0); } static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w ) @@ -848,8 +845,8 @@ static MACHINE_CONFIG_START( xerox820, xerox820_state ) MCFG_PALETTE_INIT(black_and_white) /* keyboard */ - MCFG_TIMER_ADD_PERIODIC("keyboard", xerox820_keyboard_tick,attotime::from_hz(60)) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_20MHz/8)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", xerox820_state, xerox820_keyboard_tick, attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_20MHz/8)) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -886,8 +883,8 @@ static MACHINE_CONFIG_START( xerox820ii, xerox820ii_state ) MCFG_PALETTE_INIT(black_and_white) /* keyboard */ - MCFG_TIMER_ADD_PERIODIC("keyboard", xerox820_keyboard_tick, attotime::from_hz(60)) - MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_16MHz/4)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", xerox820_state, xerox820_keyboard_tick, attotime::from_hz(60)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", xerox820_state, ctc_tick, attotime::from_hz(XTAL_16MHz/4)) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") |