diff --git a/src/mess/drivers/atarist.c b/src/mess/drivers/atarist.c index 2648baf52b5..8831425f588 100644 --- a/src/mess/drivers/atarist.c +++ b/src/mess/drivers/atarist.c @@ -479,11 +479,10 @@ void st_state::mouse_tick() // TIMER_CALLBACK( st_mouse_tick ) //------------------------------------------------- -static TIMER_CALLBACK( st_mouse_tick ) +TIMER_CALLBACK_MEMBER(st_state::st_mouse_tick) { - st_state *state = machine.driver_data(); - state->mouse_tick(); + mouse_tick(); } @@ -776,11 +775,10 @@ void ste_state::dmasound_tick() // TIMER_CALLBACK( atariste_dmasound_tick ) //------------------------------------------------- -static TIMER_CALLBACK( atariste_dmasound_tick ) +TIMER_CALLBACK_MEMBER(ste_state::atariste_dmasound_tick) { - ste_state *state = machine.driver_data(); - state->dmasound_tick(); + dmasound_tick(); } @@ -1027,11 +1025,10 @@ void ste_state::microwire_tick() // TIMER_CALLBACK( atariste_microwire_tick ) //------------------------------------------------- -static TIMER_CALLBACK( atariste_microwire_tick ) +TIMER_CALLBACK_MEMBER(ste_state::atariste_microwire_tick) { - ste_state *state = machine.driver_data(); - state->microwire_tick(); + microwire_tick(); } @@ -2208,7 +2205,7 @@ void st_state::machine_start() m_maincpu->set_irq_acknowledge_callback(atarist_int_ack); // allocate timers - m_mouse_timer = machine().scheduler().timer_alloc(FUNC(st_mouse_tick)); + m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_state::st_mouse_tick),this)); m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(500)); // register for state saving @@ -2265,8 +2262,8 @@ void ste_state::machine_start() m_maincpu->set_irq_acknowledge_callback(atarist_int_ack); /* allocate timers */ - m_dmasound_timer = machine().scheduler().timer_alloc(FUNC(atariste_dmasound_tick)); - m_microwire_timer = machine().scheduler().timer_alloc(FUNC(atariste_microwire_tick)); + m_dmasound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ste_state::atariste_dmasound_tick),this)); + m_microwire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ste_state::atariste_microwire_tick),this)); /* register for state saving */ state_save(); diff --git a/src/mess/drivers/beta.c b/src/mess/drivers/beta.c index 764d14509c4..bb1cd243190 100644 --- a/src/mess/drivers/beta.c +++ b/src/mess/drivers/beta.c @@ -84,13 +84,12 @@ INPUT_PORTS_END /* M6532 Interface */ -static TIMER_CALLBACK( led_refresh ) +TIMER_CALLBACK_MEMBER(beta_state::led_refresh) { - beta_state *state = machine.driver_data(); - if (state->m_ls145_p < 6) + if (m_ls145_p < 6) { - output_set_digit_value(state->m_ls145_p, state->m_segment); + output_set_digit_value(m_ls145_p, m_segment); } } @@ -237,7 +236,7 @@ static DEVICE_IMAGE_UNLOAD( beta_eprom ) void beta_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(beta_state::led_refresh),this)); /* register for state saving */ save_item(NAME(m_eprom_oe)); diff --git a/src/mess/drivers/coleco.c b/src/mess/drivers/coleco.c index e6062f74cac..6a0259fab1d 100644 --- a/src/mess/drivers/coleco.c +++ b/src/mess/drivers/coleco.c @@ -176,43 +176,40 @@ static WRITE_LINE_DEVICE_HANDLER(coleco_vdp_interrupt) drvstate->m_last_nmi_state = state; } -static TIMER_CALLBACK( paddle_d7reset_callback ) +TIMER_CALLBACK_MEMBER(coleco_state::paddle_d7reset_callback) { - coleco_state *state = machine.driver_data(); - state->m_joy_d7_state[param] = 0; - state->m_joy_analog_state[param] = 0; + m_joy_d7_state[param] = 0; + m_joy_analog_state[param] = 0; } -static TIMER_CALLBACK( paddle_irqreset_callback ) +TIMER_CALLBACK_MEMBER(coleco_state::paddle_irqreset_callback) { - coleco_state *state = machine.driver_data(); - state->m_joy_irq_state[param] = 0; + m_joy_irq_state[param] = 0; - if (!state->m_joy_irq_state[param ^ 1]) - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + if (!m_joy_irq_state[param ^ 1]) + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); } -static TIMER_CALLBACK( paddle_pulse_callback ) +TIMER_CALLBACK_MEMBER(coleco_state::paddle_pulse_callback) { - coleco_state *state = machine.driver_data(); - if (state->m_joy_analog_reload[param]) + if (m_joy_analog_reload[param]) { - state->m_joy_analog_state[param] = state->m_joy_analog_reload[param]; + m_joy_analog_state[param] = m_joy_analog_reload[param]; // on movement, controller port d7 is set for a short period and an irq is fired on d7 rising edge - state->m_joy_d7_state[param] = 0x80; - state->m_joy_d7_timer[param]->adjust(attotime::from_usec(500), param); // TODO: measure duration + m_joy_d7_state[param] = 0x80; + m_joy_d7_timer[param]->adjust(attotime::from_usec(500), param); // TODO: measure duration // irq on rising edge, PULSE_LINE is not supported in this case, so clear it manually - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); - state->m_joy_irq_timer[param]->adjust(attotime::from_usec(11), param); // TODO: measure duration - state->m_joy_irq_state[param] = 1; + m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); + m_joy_irq_timer[param]->adjust(attotime::from_usec(11), param); // TODO: measure duration + m_joy_irq_state[param] = 1; // reload timer - state->m_joy_pulse_timer[param]->adjust(state->m_joy_pulse_reload[param], param); + m_joy_pulse_timer[param]->adjust(m_joy_pulse_reload[param], param); } } @@ -264,9 +261,9 @@ void coleco_state::machine_start() // init paddles for (int port = 0; port < 2; port++) { - m_joy_pulse_timer[port] = machine().scheduler().timer_alloc(FUNC(paddle_pulse_callback)); - m_joy_d7_timer[port] = machine().scheduler().timer_alloc(FUNC(paddle_d7reset_callback)); - m_joy_irq_timer[port] = machine().scheduler().timer_alloc(FUNC(paddle_irqreset_callback)); + m_joy_pulse_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_pulse_callback),this)); + m_joy_d7_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_d7reset_callback),this)); + m_joy_irq_timer[port] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(coleco_state::paddle_irqreset_callback),this)); m_joy_irq_state[port] = 0; m_joy_d7_state[port] = 0; diff --git a/src/mess/drivers/cxhumax.c b/src/mess/drivers/cxhumax.c index 229ba779920..2ed2bed5d63 100644 --- a/src/mess/drivers/cxhumax.c +++ b/src/mess/drivers/cxhumax.c @@ -301,32 +301,31 @@ WRITE32_MEMBER( cxhumax_state::cx_extdesc_w ) COMBINE_DATA(&m_extdesc_regs[offset]); } -static TIMER_CALLBACK( timer_tick ) +TIMER_CALLBACK_MEMBER(cxhumax_state::timer_tick) { - cxhumax_state *state = machine.driver_data(); - state->m_timer_regs.timer[param].value++; - if(state->m_timer_regs.timer[param].value==state->m_timer_regs.timer[param].limit) { + m_timer_regs.timer[param].value++; + if(m_timer_regs.timer[param].value==m_timer_regs.timer[param].limit) { /* Reset counter when reaching limit and RESET_CNTR bit is cleared */ - if(!(state->m_timer_regs.timer[param].mode & 2)) - state->m_timer_regs.timer[param].value=0; + if(!(m_timer_regs.timer[param].mode & 2)) + m_timer_regs.timer[param].value=0; /* Indicate interrupt request if EN_INT bit is set */ - if (state->m_timer_regs.timer[param].mode & 8) { + if (m_timer_regs.timer[param].mode & 8) { //printf( "IRQ on Timer %d\n", param ); - verboselog( machine, 9, "(TIMER%d) Interrupt\n", param); - state->m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] |= INT_TIMER_BIT; /* Timer interrupt */ - state->m_intctrl_regs[INTREG(INTGROUP2, INTSTATCLR)] |= INT_TIMER_BIT; /* Timer interrupt */ - state->m_intctrl_regs[INTREG(INTGROUP2, INTSTATSET)] |= INT_TIMER_BIT; /* Timer interrupt */ + verboselog( machine(), 9, "(TIMER%d) Interrupt\n", param); + m_intctrl_regs[INTREG(INTGROUP2, INTIRQ)] |= INT_TIMER_BIT; /* Timer interrupt */ + m_intctrl_regs[INTREG(INTGROUP2, INTSTATCLR)] |= INT_TIMER_BIT; /* Timer interrupt */ + m_intctrl_regs[INTREG(INTGROUP2, INTSTATSET)] |= INT_TIMER_BIT; /* Timer interrupt */ - state->m_timer_regs.timer_irq |= 1<m_intctrl_regs[INTREG(INTGROUP2, INTENABLE)] & INT_TIMER_BIT) - machine.device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); + if (m_intctrl_regs[INTREG(INTGROUP2, INTENABLE)] & INT_TIMER_BIT) + machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, ASSERT_LINE); } } - attotime period = attotime::from_hz(XTAL_54MHz)*state->m_timer_regs.timer[param].timebase; - state->m_timer_regs.timer[param].timer->adjust(period,param); + attotime period = attotime::from_hz(XTAL_54MHz)*m_timer_regs.timer[param].timebase; + m_timer_regs.timer[param].timer->adjust(period,param); } READ32_MEMBER( cxhumax_state::cx_timers_r ) @@ -983,7 +982,7 @@ void cxhumax_state::machine_start() int index = 0; for(index = 0; index < MAX_CX_TIMERS; 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(cxhumax_state::timer_tick),this)); m_timer_regs.timer[index].timer->adjust(attotime::never, index); } } diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c index 974b75e1680..05772974e19 100644 --- a/src/mess/drivers/fm7.c +++ b/src/mess/drivers/fm7.c @@ -234,9 +234,9 @@ READ8_MEMBER(fm7_state::fm7_irq_cause_r) return ret; } -static TIMER_CALLBACK( fm7_beeper_off ) +TIMER_CALLBACK_MEMBER(fm7_state::fm7_beeper_off) { - beep_set_state(machine.device(BEEPER_TAG),0); + beep_set_state(machine().device(BEEPER_TAG),0); logerror("timed beeper off\n"); } @@ -264,7 +264,7 @@ WRITE8_MEMBER(fm7_state::fm7_beeper_w) { beep_set_state(machine().device(BEEPER_TAG),1); logerror("timed beeper on\n"); - machine().scheduler().timer_set(attotime::from_msec(205), FUNC(fm7_beeper_off)); + machine().scheduler().timer_set(attotime::from_msec(205), timer_expired_delegate(FUNC(fm7_state::fm7_beeper_off),this)); } } logerror("beeper state: %02x\n",data); @@ -281,7 +281,7 @@ READ8_MEMBER(fm7_state::fm7_sub_beeper_r) { beep_set_state(machine().device(BEEPER_TAG),1); logerror("timed beeper on\n"); - machine().scheduler().timer_set(attotime::from_msec(205), FUNC(fm7_beeper_off)); + machine().scheduler().timer_set(attotime::from_msec(205), timer_expired_delegate(FUNC(fm7_state::fm7_beeper_off),this)); } return 0xff; } @@ -628,10 +628,9 @@ void fm7_state::fm77av_encoder_setup_command() } } -static TIMER_CALLBACK( fm77av_encoder_ack ) +TIMER_CALLBACK_MEMBER(fm7_state::fm77av_encoder_ack) { - fm7_state *state = machine.driver_data(); - state->m_encoder.ack = 1; + m_encoder.ack = 1; } void fm7_state::fm77av_encoder_handle_command() @@ -716,7 +715,7 @@ WRITE8_MEMBER(fm7_state::fm77av_key_encoder_w) fm77av_encoder_handle_command(); // wait 5us to set ACK flag - machine().scheduler().timer_set(attotime::from_usec(5), FUNC(fm77av_encoder_ack)); + machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(fm7_state::fm77av_encoder_ack),this)); //logerror("ENC: write 0x%02x to data register, moved to pos %i\n",data,m_encoder.position); } @@ -1204,20 +1203,18 @@ WRITE8_MEMBER(fm7_state::fm7_kanji_w) } } -static TIMER_CALLBACK( fm7_timer_irq ) +TIMER_CALLBACK_MEMBER(fm7_state::fm7_timer_irq) { - fm7_state *state = machine.driver_data(); - if(state->m_irq_mask & IRQ_FLAG_TIMER) + if(m_irq_mask & IRQ_FLAG_TIMER) { - main_irq_set_flag(machine,IRQ_FLAG_TIMER); + main_irq_set_flag(machine(),IRQ_FLAG_TIMER); } } -static TIMER_CALLBACK( fm7_subtimer_irq ) +TIMER_CALLBACK_MEMBER(fm7_state::fm7_subtimer_irq) { - fm7_state *state = machine.driver_data(); - if(state->m_video.nmi_mask == 0 && state->m_video.sub_halt == 0) - machine.device("sub")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE); + if(m_video.nmi_mask == 0 && m_video.sub_halt == 0) + machine().device("sub")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE); } // When a key is pressed or released (in scan mode only), an IRQ is generated on the main CPU, @@ -1288,28 +1285,27 @@ static void fm7_keyboard_poll_scan(running_machine &machine) state->m_mod_data = modifiers; } -static TIMER_CALLBACK( fm7_keyboard_poll ) +TIMER_CALLBACK_MEMBER(fm7_state::fm7_keyboard_poll) { - fm7_state *state = machine.driver_data(); static const char *const portnames[3] = { "key1","key2","key3" }; int x,y; int bit = 0; int mod = 0; UINT32 keys; - UINT32 modifiers = machine.root_device().ioport("key_modifiers")->read(); + UINT32 modifiers = machine().root_device().ioport("key_modifiers")->read(); - if(machine.root_device().ioport("key3")->read() & 0x40000) + if(machine().root_device().ioport("key3")->read() & 0x40000) { - state->m_break_flag = 1; - machine.device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); + m_break_flag = 1; + machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); } else - state->m_break_flag = 0; + m_break_flag = 0; - if(state->m_key_scan_mode == KEY_MODE_SCAN) + if(m_key_scan_mode == KEY_MODE_SCAN) { // handle scancode mode - fm7_keyboard_poll_scan(machine); + fm7_keyboard_poll_scan(machine()); return; } @@ -1327,18 +1323,18 @@ static TIMER_CALLBACK( fm7_keyboard_poll ) for(x=0;x<3;x++) { - keys = machine.root_device().ioport(portnames[x])->read(); + keys = machine().root_device().ioport(portnames[x])->read(); for(y=0;y<32;y++) // loop through each bit in the port { - if((keys & (1<m_key_data[x] & (1<m_key_data[x] = keys; + m_key_data[x] = keys; } } @@ -1834,10 +1830,10 @@ DRIVER_INIT_MEMBER(fm7_state,fm7) { // m_shared_ram = auto_alloc_array(machine(),UINT8,0x80); m_video_ram = auto_alloc_array(machine(),UINT8,0x18000); // 2 pages on some systems - m_timer = machine().scheduler().timer_alloc(FUNC(fm7_timer_irq)); - m_subtimer = machine().scheduler().timer_alloc(FUNC(fm7_subtimer_irq)); - m_keyboard_timer = machine().scheduler().timer_alloc(FUNC(fm7_keyboard_poll)); - m_fm77av_vsync_timer = machine().scheduler().timer_alloc(FUNC(fm77av_vsync)); + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm7_timer_irq),this)); + m_subtimer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm7_subtimer_irq),this)); + m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm7_keyboard_poll),this)); + m_fm77av_vsync_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(fm7_state::fm77av_vsync),this)); machine().device("maincpu")->execute().set_irq_acknowledge_callback(fm7_irq_ack); machine().device("sub")->execute().set_irq_acknowledge_callback(fm7_sub_irq_ack); } diff --git a/src/mess/drivers/fmtowns.c b/src/mess/drivers/fmtowns.c index 069bece6227..8e68e9458f9 100644 --- a/src/mess/drivers/fmtowns.c +++ b/src/mess/drivers/fmtowns.c @@ -1305,13 +1305,12 @@ static void towns_cdrom_set_irq(running_machine &machine,int line,int state) } } -static TIMER_CALLBACK( towns_cd_status_ready ) +TIMER_CALLBACK_MEMBER(towns_state::towns_cd_status_ready) { - towns_state* state = machine.driver_data(); - state->m_towns_cd.status |= 0x02; // status read request - state->m_towns_cd.status |= 0x01; // ready - state->m_towns_cd.cmd_status_ptr = 0; - towns_cdrom_set_irq((running_machine&)machine,TOWNS_CD_IRQ_MPU,1); + m_towns_cd.status |= 0x02; // status read request + m_towns_cd.status |= 0x01; // ready + m_towns_cd.cmd_status_ptr = 0; + towns_cdrom_set_irq((running_machine&)machine(),TOWNS_CD_IRQ_MPU,1); } static void towns_cd_set_status(running_machine &machine, UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3) @@ -1322,7 +1321,7 @@ static void towns_cd_set_status(running_machine &machine, UINT8 st0, UINT8 st1, state->m_towns_cd.cmd_status[2] = st2; state->m_towns_cd.cmd_status[3] = st3; // wait a bit - machine.scheduler().timer_set(attotime::from_msec(1), FUNC(towns_cd_status_ready), 0, &machine); + machine.scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(towns_state::towns_cd_status_ready),state), 0, &machine); } static UINT8 towns_cd_get_track(running_machine &machine) @@ -1341,52 +1340,51 @@ static UINT8 towns_cd_get_track(running_machine &machine) return track; } -static TIMER_CALLBACK( towns_cdrom_read_byte ) +TIMER_CALLBACK_MEMBER(towns_state::towns_cdrom_read_byte) { device_t* device = (device_t* )ptr; - towns_state* state = machine.driver_data(); int masked; // TODO: support software transfers, for now DMA is assumed. - if(state->m_towns_cd.buffer_ptr < 0) // transfer has ended + if(m_towns_cd.buffer_ptr < 0) // transfer has ended return; masked = upd71071_dmarq(device,param,3); // CD-ROM controller uses DMA1 channel 3 -// logerror("DMARQ: param=%i ret=%i bufferptr=%i\n",param,masked,state->m_towns_cd.buffer_ptr); +// logerror("DMARQ: param=%i ret=%i bufferptr=%i\n",param,masked,m_towns_cd.buffer_ptr); if(param != 0) { - state->m_towns_cd.read_timer->adjust(attotime::from_hz(300000)); + m_towns_cd.read_timer->adjust(attotime::from_hz(300000)); } else { if(masked != 0) // check if the DMA channel is masked { - state->m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); return; } - if(state->m_towns_cd.buffer_ptr < 2048) - state->m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + if(m_towns_cd.buffer_ptr < 2048) + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); else { // end of transfer - state->m_towns_cd.status &= ~0x10; // no longer transferring by DMA - state->m_towns_cd.status &= ~0x20; // no longer transferring by software - logerror("DMA1: end of transfer (LBA=%08x)\n",state->m_towns_cd.lba_current); - if(state->m_towns_cd.lba_current >= state->m_towns_cd.lba_last) + m_towns_cd.status &= ~0x10; // no longer transferring by DMA + m_towns_cd.status &= ~0x20; // no longer transferring by software + logerror("DMA1: end of transfer (LBA=%08x)\n",m_towns_cd.lba_current); + if(m_towns_cd.lba_current >= m_towns_cd.lba_last) { - state->m_towns_cd.extra_status = 0; + m_towns_cd.extra_status = 0; towns_cd_set_status(device->machine(),0x06,0x00,0x00,0x00); towns_cdrom_set_irq(device->machine(),TOWNS_CD_IRQ_DMA,1); - state->m_towns_cd.buffer_ptr = -1; - state->m_towns_cd.status |= 0x01; // ready + m_towns_cd.buffer_ptr = -1; + m_towns_cd.status |= 0x01; // ready } else { - state->m_towns_cd.extra_status = 0; + m_towns_cd.extra_status = 0; towns_cd_set_status(device->machine(),0x22,0x00,0x00,0x00); towns_cdrom_set_irq(device->machine(),TOWNS_CD_IRQ_DMA,1); - cdrom_read_data(state->m_cdrom->get_cdrom_file(),++state->m_towns_cd.lba_current,state->m_towns_cd.buffer,CD_TRACK_MODE1); - state->m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); - state->m_towns_cd.buffer_ptr = -1; + cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); + m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); + m_towns_cd.buffer_ptr = -1; } } } @@ -1482,7 +1480,7 @@ static void towns_cdrom_play_cdda(cdrom_image_device* device) } } -static TIMER_CALLBACK(towns_delay_cdda) +TIMER_CALLBACK_MEMBER(towns_state::towns_delay_cdda) { towns_cdrom_play_cdda((cdrom_image_device*)ptr); } @@ -1526,7 +1524,7 @@ static void towns_cdrom_execute_command(cdrom_image_device* device) break; case 0x04: // Play Audio Track logerror("CD: Command 0x04: PLAY CD-DA\n"); - device->machine().scheduler().timer_set(attotime::from_msec(1), FUNC(towns_delay_cdda), 0, device); + device->machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(towns_state::towns_delay_cdda),state), 0, device); break; case 0x05: // Read TOC logerror("CD: Command 0x05: READ TOC\n"); @@ -2456,7 +2454,7 @@ void towns_state::driver_start() m_towns_intervaltimer2 = timer_alloc(TIMER_INTERVAL2); // CD-ROM init - m_towns_cd.read_timer = machine().scheduler().timer_alloc(FUNC(towns_cdrom_read_byte), (void*)machine().device("dma_1")); + m_towns_cd.read_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_cdrom_read_byte),this), (void*)machine().device("dma_1")); machine().device("maincpu")->execute().set_irq_acknowledge_callback(towns_irq_callback); machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x100000,machine().device(RAM_TAG)->size()-1,0xffffffff,0,NULL); diff --git a/src/mess/drivers/gba.c b/src/mess/drivers/gba.c index 5027e5dd26f..cea9bdd8e0d 100644 --- a/src/mess/drivers/gba.c +++ b/src/mess/drivers/gba.c @@ -104,25 +104,24 @@ static void gba_request_irq(running_machine &machine, UINT32 int_type) } } -static TIMER_CALLBACK( dma_complete ) +TIMER_CALLBACK_MEMBER(gba_state::dma_complete) { int ctrl; FPTR ch; static const UINT32 ch_int[4] = { INT_DMA0, INT_DMA1, INT_DMA2, INT_DMA3 }; - gba_state *state = machine.driver_data(); ch = param; // printf("dma complete: ch %d\n", ch); - state->m_dma_timer[ch]->adjust(attotime::never); + m_dma_timer[ch]->adjust(attotime::never); - ctrl = state->m_dma_regs[(ch*3)+2] >> 16; + ctrl = m_dma_regs[(ch*3)+2] >> 16; // IRQ if (ctrl & 0x4000) { - gba_request_irq(machine, ch_int[ch]); + gba_request_irq(machine(), ch_int[ch]); } // if we're supposed to repeat, don't clear "active" and then the next vbl/hbl will retrigger us @@ -130,19 +129,19 @@ static TIMER_CALLBACK( dma_complete ) if (!((ctrl>>9) & 1) || ((ctrl & 0x3000) == 0)) { // printf("clear active for ch %d\n", ch); - state->m_dma_regs[(ch*3)+2] &= ~0x80000000; // clear "active" bit + m_dma_regs[(ch*3)+2] &= ~0x80000000; // clear "active" bit } else { // if repeat, reload the count if ((ctrl>>9) & 1) { - state->m_dma_cnt[ch] = state->m_dma_regs[(ch*3)+2]&0xffff; + m_dma_cnt[ch] = m_dma_regs[(ch*3)+2]&0xffff; // if increment & reload mode, reload the destination if (((ctrl>>5)&3) == 3) { - state->m_dma_dst[ch] = state->m_dma_regs[(ch*3)+1]; + m_dma_dst[ch] = m_dma_regs[(ch*3)+1]; } } } @@ -278,7 +277,7 @@ static void dma_exec(running_machine &machine, FPTR ch) // printf("settng DMA timer %d for %d cycs (tmr %x)\n", ch, cnt, (UINT32)state->m_dma_timer[ch]); // state->m_dma_timer[ch]->adjust(ATTOTIME_IN_CYCLES(0, cnt), ch); - dma_complete(machine, NULL, ch); + state->dma_complete(NULL, ch); } static void audio_tick(running_machine &machine, int ref) @@ -371,55 +370,54 @@ static void audio_tick(running_machine &machine, int ref) } } -static TIMER_CALLBACK(timer_expire) +TIMER_CALLBACK_MEMBER(gba_state::timer_expire) { static const UINT32 tmr_ints[4] = { INT_TM0_OVERFLOW, INT_TM1_OVERFLOW, INT_TM2_OVERFLOW, INT_TM3_OVERFLOW }; FPTR tmr = (FPTR) param; - gba_state *state = machine.driver_data(); -// printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, state->m_SOUNDCNT_H); +// printf("Timer %d expired, SOUNDCNT_H %04x\n", tmr, m_SOUNDCNT_H); // "The reload value is copied into the counter only upon following two situations: Automatically upon timer overflows," // "or when the timer start bit becomes changed from 0 to 1." - if (state->m_timer_recalc[tmr] != 0) + if (m_timer_recalc[tmr] != 0) { double rate, clocksel, final; attotime time; - state->m_timer_recalc[tmr] = 0; - state->m_timer_regs[tmr] = (state->m_timer_regs[tmr] & 0xFFFF0000) | (state->m_timer_reload[tmr] & 0x0000FFFF); - rate = 0x10000 - (state->m_timer_regs[tmr] & 0xffff); - clocksel = timer_clks[(state->m_timer_regs[tmr] >> 16) & 3]; + m_timer_recalc[tmr] = 0; + m_timer_regs[tmr] = (m_timer_regs[tmr] & 0xFFFF0000) | (m_timer_reload[tmr] & 0x0000FFFF); + rate = 0x10000 - (m_timer_regs[tmr] & 0xffff); + clocksel = timer_clks[(m_timer_regs[tmr] >> 16) & 3]; final = clocksel / rate; - state->m_timer_hz[tmr] = final; + m_timer_hz[tmr] = final; time = attotime::from_hz(final); GBA_ATTOTIME_NORMALIZE(time); - state->m_tmr_timer[tmr]->adjust(time, tmr, time); + m_tmr_timer[tmr]->adjust(time, tmr, time); } // check if timers 0 or 1 are feeding directsound if (tmr == 0) { - if ((state->m_SOUNDCNT_H & 0x400) == 0) + if ((m_SOUNDCNT_H & 0x400) == 0) { - audio_tick(machine, 0); + audio_tick(machine(), 0); } - if ((state->m_SOUNDCNT_H & 0x4000) == 0) + if ((m_SOUNDCNT_H & 0x4000) == 0) { - audio_tick(machine, 1); + audio_tick(machine(), 1); } } if (tmr == 1) { - if ((state->m_SOUNDCNT_H & 0x400) == 0x400) + if ((m_SOUNDCNT_H & 0x400) == 0x400) { - audio_tick(machine, 0); + audio_tick(machine(), 0); } - if ((state->m_SOUNDCNT_H & 0x4000) == 0x4000) + if ((m_SOUNDCNT_H & 0x4000) == 0x4000) { - audio_tick(machine, 1); + audio_tick(machine(), 1); } } @@ -427,35 +425,35 @@ static TIMER_CALLBACK(timer_expire) switch (tmr) { case 0: - if (state->m_timer_regs[1] & 0x40000) + if (m_timer_regs[1] & 0x40000) { - state->m_timer_regs[1] = (( ( state->m_timer_regs[1] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (state->m_timer_regs[1] & 0xffff0000); - if( ( state->m_timer_regs[1] & 0x0000ffff ) == 0 ) + m_timer_regs[1] = (( ( m_timer_regs[1] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[1] & 0xffff0000); + if( ( m_timer_regs[1] & 0x0000ffff ) == 0 ) { - state->m_timer_regs[1] |= state->m_timer_reload[1]; - if( ( state->m_timer_regs[1] & 0x400000 ) && ( state->m_IME != 0 ) ) + m_timer_regs[1] |= m_timer_reload[1]; + if( ( m_timer_regs[1] & 0x400000 ) && ( m_IME != 0 ) ) { - gba_request_irq( machine, tmr_ints[1] ); + gba_request_irq( machine(), tmr_ints[1] ); } - if( ( state->m_timer_regs[2] & 0x40000 ) ) + if( ( m_timer_regs[2] & 0x40000 ) ) { - state->m_timer_regs[2] = (( ( state->m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (state->m_timer_regs[2] & 0xffff0000); - if( ( state->m_timer_regs[2] & 0x0000ffff ) == 0 ) + m_timer_regs[2] = (( ( m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[2] & 0xffff0000); + if( ( m_timer_regs[2] & 0x0000ffff ) == 0 ) { - state->m_timer_regs[2] |= state->m_timer_reload[2]; - if( ( state->m_timer_regs[2] & 0x400000 ) && ( state->m_IME != 0 ) ) + m_timer_regs[2] |= m_timer_reload[2]; + if( ( m_timer_regs[2] & 0x400000 ) && ( m_IME != 0 ) ) { - gba_request_irq( machine, tmr_ints[2] ); + gba_request_irq( machine(), tmr_ints[2] ); } - if( ( state->m_timer_regs[3] & 0x40000 ) ) + if( ( m_timer_regs[3] & 0x40000 ) ) { - state->m_timer_regs[3] = (( ( state->m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (state->m_timer_regs[3] & 0xffff0000); - if( ( state->m_timer_regs[3] & 0x0000ffff ) == 0 ) + m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); + if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) { - state->m_timer_regs[3] |= state->m_timer_reload[3]; - if( ( state->m_timer_regs[3] & 0x400000 ) && ( state->m_IME != 0 ) ) + m_timer_regs[3] |= m_timer_reload[3]; + if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) { - gba_request_irq( machine, tmr_ints[3] ); + gba_request_irq( machine(), tmr_ints[3] ); } } } @@ -465,25 +463,25 @@ static TIMER_CALLBACK(timer_expire) } break; case 1: - if (state->m_timer_regs[2] & 0x40000) + if (m_timer_regs[2] & 0x40000) { - state->m_timer_regs[2] = (( ( state->m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (state->m_timer_regs[2] & 0xffff0000); - if( ( state->m_timer_regs[2] & 0x0000ffff ) == 0 ) + m_timer_regs[2] = (( ( m_timer_regs[2] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[2] & 0xffff0000); + if( ( m_timer_regs[2] & 0x0000ffff ) == 0 ) { - state->m_timer_regs[2] |= state->m_timer_reload[2]; - if( ( state->m_timer_regs[2] & 0x400000 ) && ( state->m_IME != 0 ) ) + m_timer_regs[2] |= m_timer_reload[2]; + if( ( m_timer_regs[2] & 0x400000 ) && ( m_IME != 0 ) ) { - gba_request_irq( machine, tmr_ints[2] ); + gba_request_irq( machine(), tmr_ints[2] ); } - if( ( state->m_timer_regs[3] & 0x40000 ) ) + if( ( m_timer_regs[3] & 0x40000 ) ) { - state->m_timer_regs[3] = (( ( state->m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (state->m_timer_regs[3] & 0xffff0000); - if( ( state->m_timer_regs[3] & 0x0000ffff ) == 0 ) + m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); + if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) { - state->m_timer_regs[3] |= state->m_timer_reload[3]; - if( ( state->m_timer_regs[3] & 0x400000 ) && ( state->m_IME != 0 ) ) + m_timer_regs[3] |= m_timer_reload[3]; + if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) { - gba_request_irq( machine, tmr_ints[3] ); + gba_request_irq( machine(), tmr_ints[3] ); } } } @@ -491,15 +489,15 @@ static TIMER_CALLBACK(timer_expire) } break; case 2: - if (state->m_timer_regs[3] & 0x40000) + if (m_timer_regs[3] & 0x40000) { - state->m_timer_regs[3] = (( ( state->m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (state->m_timer_regs[3] & 0xffff0000); - if( ( state->m_timer_regs[3] & 0x0000ffff ) == 0 ) + m_timer_regs[3] = (( ( m_timer_regs[3] & 0x0000ffff ) + 1 ) & 0x0000ffff) | (m_timer_regs[3] & 0xffff0000); + if( ( m_timer_regs[3] & 0x0000ffff ) == 0 ) { - state->m_timer_regs[3] |= state->m_timer_reload[3]; - if( ( state->m_timer_regs[3] & 0x400000 ) && ( state->m_IME != 0 ) ) + m_timer_regs[3] |= m_timer_reload[3]; + if( ( m_timer_regs[3] & 0x400000 ) && ( m_IME != 0 ) ) { - gba_request_irq( machine, tmr_ints[3] ); + gba_request_irq( machine(), tmr_ints[3] ); } } } @@ -507,19 +505,18 @@ static TIMER_CALLBACK(timer_expire) } // are we supposed to IRQ? - if ((state->m_timer_regs[tmr] & 0x400000) && (state->m_IME != 0)) + if ((m_timer_regs[tmr] & 0x400000) && (m_IME != 0)) { - gba_request_irq(machine, tmr_ints[tmr]); + gba_request_irq(machine(), tmr_ints[tmr]); } } -static TIMER_CALLBACK(handle_irq) +TIMER_CALLBACK_MEMBER(gba_state::handle_irq) { - gba_state *state = machine.driver_data(); - gba_request_irq(machine, state->m_IF); + gba_request_irq(machine(), m_IF); - state->m_irq_timer->adjust(attotime::never); + m_irq_timer->adjust(attotime::never); } READ32_MEMBER(gba_state::gba_io_r) @@ -2004,64 +2001,62 @@ static INPUT_PORTS_START( gbadv ) PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") PORT_PLAYER(1) // A INPUT_PORTS_END -static TIMER_CALLBACK( perform_hbl ) +TIMER_CALLBACK_MEMBER(gba_state::perform_hbl) { int ch, ctrl; - gba_state *state = machine.driver_data(); - int scanline = machine.primary_screen->vpos(); + int scanline = machine().primary_screen->vpos(); // draw only visible scanlines if (scanline < 160) { - gba_draw_scanline(machine, scanline); + gba_draw_scanline(machine(), scanline); } - state->m_DISPSTAT |= DISPSTAT_HBL; - if ((state->m_DISPSTAT & DISPSTAT_HBL_IRQ_EN ) != 0) + m_DISPSTAT |= DISPSTAT_HBL; + if ((m_DISPSTAT & DISPSTAT_HBL_IRQ_EN ) != 0) { - gba_request_irq(machine, INT_HBL); + gba_request_irq(machine(), INT_HBL); } for (ch = 0; ch < 4; ch++) { - ctrl = state->m_dma_regs[(ch*3)+2]>>16; + ctrl = m_dma_regs[(ch*3)+2]>>16; // HBL-triggered DMA? if ((ctrl & 0x8000) && ((ctrl & 0x3000) == 0x2000)) { - dma_exec(machine, ch); + dma_exec(machine(), ch); } } - state->m_hbl_timer->adjust(attotime::never); + m_hbl_timer->adjust(attotime::never); } -static TIMER_CALLBACK( perform_scan ) +TIMER_CALLBACK_MEMBER(gba_state::perform_scan) { int scanline; - gba_state *state = machine.driver_data(); // clear hblank and raster IRQ flags - state->m_DISPSTAT &= ~(DISPSTAT_HBL|DISPSTAT_VCNT); + m_DISPSTAT &= ~(DISPSTAT_HBL|DISPSTAT_VCNT); - scanline = machine.primary_screen->vpos(); + scanline = machine().primary_screen->vpos(); // VBL is set for scanlines 160 through 226 (but not 227, which is the last line) if (scanline >= 160 && scanline < 227) { - state->m_DISPSTAT |= DISPSTAT_VBL; + m_DISPSTAT |= DISPSTAT_VBL; } else { - state->m_DISPSTAT &= ~DISPSTAT_VBL; + m_DISPSTAT &= ~DISPSTAT_VBL; } // handle VCNT match interrupt/flag - if (scanline == ((state->m_DISPSTAT >> 8) & 0xff)) + if (scanline == ((m_DISPSTAT >> 8) & 0xff)) { - state->m_DISPSTAT |= DISPSTAT_VCNT; - if (state->m_DISPSTAT & DISPSTAT_VCNT_IRQ_EN) + m_DISPSTAT |= DISPSTAT_VCNT; + if (m_DISPSTAT & DISPSTAT_VCNT_IRQ_EN) { - gba_request_irq(machine, INT_VCNT); + gba_request_irq(machine(), INT_VCNT); } } @@ -2092,25 +2087,25 @@ static TIMER_CALLBACK( perform_scan ) // More work on IRQs is definitely necessary! int ch, ctrl; - if (state->m_DISPSTAT & DISPSTAT_VBL_IRQ_EN) + if (m_DISPSTAT & DISPSTAT_VBL_IRQ_EN) { - gba_request_irq(machine, INT_VBL); + gba_request_irq(machine(), INT_VBL); } for (ch = 0; ch < 4; ch++) { - ctrl = state->m_dma_regs[(ch*3)+2]>>16; + ctrl = m_dma_regs[(ch*3)+2]>>16; // VBL-triggered DMA? if ((ctrl & 0x8000) && ((ctrl & 0x3000) == 0x1000)) { - dma_exec(machine, ch); + dma_exec(machine(), ch); } } } - state->m_hbl_timer->adjust(machine.primary_screen->time_until_pos(scanline, 240)); - state->m_scan_timer->adjust(machine.primary_screen->time_until_pos(( scanline + 1 ) % 228, 0)); + m_hbl_timer->adjust(machine().primary_screen->time_until_pos(scanline, 240)); + m_scan_timer->adjust(machine().primary_screen->time_until_pos(( scanline + 1 ) % 228, 0)); } void gba_state::machine_reset() @@ -2179,32 +2174,32 @@ void gba_state::machine_start() machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_machine_stop),&machine())); /* create a timer to fire scanline functions */ - m_scan_timer = machine().scheduler().timer_alloc(FUNC(perform_scan)); - m_hbl_timer = machine().scheduler().timer_alloc(FUNC(perform_hbl)); + m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_scan),this)); + m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_hbl),this)); m_scan_timer->adjust(machine().primary_screen->time_until_pos(0, 0)); /* and one for each DMA channel */ - m_dma_timer[0] = machine().scheduler().timer_alloc(FUNC(dma_complete)); - m_dma_timer[1] = machine().scheduler().timer_alloc(FUNC(dma_complete)); - m_dma_timer[2] = machine().scheduler().timer_alloc(FUNC(dma_complete)); - m_dma_timer[3] = machine().scheduler().timer_alloc(FUNC(dma_complete)); + m_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); + m_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::dma_complete),this)); m_dma_timer[0]->adjust(attotime::never); m_dma_timer[1]->adjust(attotime::never, 1); m_dma_timer[2]->adjust(attotime::never, 2); m_dma_timer[3]->adjust(attotime::never, 3); /* also one for each timer (heh) */ - m_tmr_timer[0] = machine().scheduler().timer_alloc(FUNC(timer_expire)); - m_tmr_timer[1] = machine().scheduler().timer_alloc(FUNC(timer_expire)); - m_tmr_timer[2] = machine().scheduler().timer_alloc(FUNC(timer_expire)); - m_tmr_timer[3] = machine().scheduler().timer_alloc(FUNC(timer_expire)); + m_tmr_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); + m_tmr_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::timer_expire),this)); m_tmr_timer[0]->adjust(attotime::never); m_tmr_timer[1]->adjust(attotime::never, 1); m_tmr_timer[2]->adjust(attotime::never, 2); m_tmr_timer[3]->adjust(attotime::never, 3); /* and an IRQ handling timer */ - m_irq_timer = machine().scheduler().timer_alloc(FUNC(handle_irq)); + m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::handle_irq),this)); m_irq_timer->adjust(attotime::never); } diff --git a/src/mess/drivers/gp32.c b/src/mess/drivers/gp32.c index 57922070341..a8d22d4f06b 100644 --- a/src/mess/drivers/gp32.c +++ b/src/mess/drivers/gp32.c @@ -257,33 +257,32 @@ static void s3c240x_lcd_render_16( running_machine &machine) } } -static TIMER_CALLBACK( s3c240x_lcd_timer_exp ) +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_lcd_timer_exp) { - gp32_state *state = machine.driver_data(); - screen_device *screen = machine.primary_screen; - verboselog( machine, 2, "LCD timer callback\n"); - state->m_s3c240x_lcd.vpos = screen->vpos(); - state->m_s3c240x_lcd.hpos = screen->hpos(); - verboselog( machine, 3, "LCD - vpos %d hpos %d\n", state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); - if (state->m_s3c240x_lcd.vramaddr_cur >= state->m_s3c240x_lcd.vramaddr_max) + screen_device *screen = machine().primary_screen; + verboselog( machine(), 2, "LCD timer callback\n"); + m_s3c240x_lcd.vpos = screen->vpos(); + m_s3c240x_lcd.hpos = screen->hpos(); + verboselog( machine(), 3, "LCD - vpos %d hpos %d\n", m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + if (m_s3c240x_lcd.vramaddr_cur >= m_s3c240x_lcd.vramaddr_max) { - s3c240x_lcd_dma_reload( machine); + s3c240x_lcd_dma_reload( machine()); } - verboselog( machine, 3, "LCD - vramaddr %08X\n", state->m_s3c240x_lcd.vramaddr_cur); - while (state->m_s3c240x_lcd.vramaddr_cur < state->m_s3c240x_lcd.vramaddr_max) + verboselog( machine(), 3, "LCD - vramaddr %08X\n", m_s3c240x_lcd.vramaddr_cur); + while (m_s3c240x_lcd.vramaddr_cur < m_s3c240x_lcd.vramaddr_max) { - switch (state->m_s3c240x_lcd.bppmode) + switch (m_s3c240x_lcd.bppmode) { - case BPPMODE_TFT_01 : s3c240x_lcd_render_01( machine); break; - case BPPMODE_TFT_02 : s3c240x_lcd_render_02( machine); break; - case BPPMODE_TFT_04 : s3c240x_lcd_render_04( machine); break; - case BPPMODE_TFT_08 : s3c240x_lcd_render_08( machine); break; - case BPPMODE_TFT_16 : s3c240x_lcd_render_16( machine); break; - default : verboselog( machine, 0, "s3c240x_lcd_timer_exp: bppmode %d not supported\n", state->m_s3c240x_lcd.bppmode); break; + case BPPMODE_TFT_01 : s3c240x_lcd_render_01( machine()); break; + case BPPMODE_TFT_02 : s3c240x_lcd_render_02( machine()); break; + case BPPMODE_TFT_04 : s3c240x_lcd_render_04( machine()); break; + case BPPMODE_TFT_08 : s3c240x_lcd_render_08( machine()); break; + case BPPMODE_TFT_16 : s3c240x_lcd_render_16( machine()); break; + default : verboselog( machine(), 0, "s3c240x_lcd_timer_exp: bppmode %d not supported\n", m_s3c240x_lcd.bppmode); break; } - if ((state->m_s3c240x_lcd.vpos == 0) && (state->m_s3c240x_lcd.hpos == 0)) break; + if ((m_s3c240x_lcd.vpos == 0) && (m_s3c240x_lcd.hpos == 0)) break; } - state->m_s3c240x_lcd_timer->adjust( screen->time_until_pos(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos)); + m_s3c240x_lcd_timer->adjust( screen->time_until_pos(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos)); } void gp32_state::video_start() @@ -673,19 +672,18 @@ WRITE32_MEMBER(gp32_state::s3c240x_pwm_w) } } -static TIMER_CALLBACK( s3c240x_pwm_timer_exp ) +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_pwm_timer_exp) { - gp32_state *state = machine.driver_data(); int ch = param; static const int ch_int[] = { INT_TIMER0, INT_TIMER1, INT_TIMER2, INT_TIMER3, INT_TIMER4 }; - verboselog( machine, 2, "PWM %d timer callback\n", ch); - if (BITS( state->m_s3c240x_pwm_regs[1], 23, 20) == (ch + 1)) + verboselog( machine(), 2, "PWM %d timer callback\n", ch); + if (BITS( m_s3c240x_pwm_regs[1], 23, 20) == (ch + 1)) { - s3c240x_dma_request_pwm( machine); + s3c240x_dma_request_pwm( machine()); } else { - s3c240x_request_irq( machine, ch_int[ch]); + s3c240x_request_irq( machine(), ch_int[ch]); } } @@ -911,10 +909,10 @@ WRITE32_MEMBER(gp32_state::s3c240x_dma_w) } } -static TIMER_CALLBACK( s3c240x_dma_timer_exp ) +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_dma_timer_exp) { int ch = param; - verboselog( machine, 2, "DMA %d timer callback\n", ch); + verboselog( machine(), 2, "DMA %d timer callback\n", ch); } // SMARTMEDIA @@ -1439,52 +1437,51 @@ WRITE32_MEMBER(gp32_state::s3c240x_iic_w) } } -static TIMER_CALLBACK( s3c240x_iic_timer_exp ) +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_iic_timer_exp) { - gp32_state *state = machine.driver_data(); int enable_interrupt, mode_selection; - verboselog( machine, 2, "IIC timer callback\n"); - mode_selection = BITS( state->m_s3c240x_iic_regs[1], 7, 6); + verboselog( machine(), 2, "IIC timer callback\n"); + mode_selection = BITS( m_s3c240x_iic_regs[1], 7, 6); switch (mode_selection) { // master receive mode case 2 : { - if (state->m_s3c240x_iic.data_index == 0) + if (m_s3c240x_iic.data_index == 0) { - UINT8 data_shift = state->m_s3c240x_iic_regs[3] & 0xFF; - verboselog( machine, 5, "IIC write %02X\n", data_shift); + UINT8 data_shift = m_s3c240x_iic_regs[3] & 0xFF; + verboselog( machine(), 5, "IIC write %02X\n", data_shift); } else { - UINT8 data_shift = eeprom_read( machine, state->m_s3c240x_iic.address); - verboselog( machine, 5, "IIC read %02X\n", data_shift); - state->m_s3c240x_iic_regs[3] = (state->m_s3c240x_iic_regs[3] & ~0xFF) | data_shift; + UINT8 data_shift = eeprom_read( machine(), m_s3c240x_iic.address); + verboselog( machine(), 5, "IIC read %02X\n", data_shift); + m_s3c240x_iic_regs[3] = (m_s3c240x_iic_regs[3] & ~0xFF) | data_shift; } - state->m_s3c240x_iic.data_index++; + m_s3c240x_iic.data_index++; } break; // master transmit mode case 3 : { - UINT8 data_shift = state->m_s3c240x_iic_regs[3] & 0xFF; - verboselog( machine, 5, "IIC write %02X\n", data_shift); - state->m_s3c240x_iic.data[state->m_s3c240x_iic.data_index++] = data_shift; - if (state->m_s3c240x_iic.data_index == 3) + UINT8 data_shift = m_s3c240x_iic_regs[3] & 0xFF; + verboselog( machine(), 5, "IIC write %02X\n", data_shift); + m_s3c240x_iic.data[m_s3c240x_iic.data_index++] = data_shift; + if (m_s3c240x_iic.data_index == 3) { - state->m_s3c240x_iic.address = (state->m_s3c240x_iic.data[1] << 8) | state->m_s3c240x_iic.data[2]; + m_s3c240x_iic.address = (m_s3c240x_iic.data[1] << 8) | m_s3c240x_iic.data[2]; } - if ((state->m_s3c240x_iic.data_index == 4) && (state->m_s3c240x_iic.data[0] == 0xA0)) + if ((m_s3c240x_iic.data_index == 4) && (m_s3c240x_iic.data[0] == 0xA0)) { - eeprom_write( machine, state->m_s3c240x_iic.address, data_shift); + eeprom_write( machine(), m_s3c240x_iic.address, data_shift); } } break; } - enable_interrupt = BIT( state->m_s3c240x_iic_regs[0], 5); + enable_interrupt = BIT( m_s3c240x_iic_regs[0], 5); if (enable_interrupt) { - s3c240x_request_irq( machine, INT_IIC); + s3c240x_request_irq( machine(), INT_IIC); } } @@ -1582,10 +1579,10 @@ WRITE32_MEMBER(gp32_state::s3c240x_iis_w) } } -static TIMER_CALLBACK( s3c240x_iis_timer_exp ) +TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_iis_timer_exp) { - verboselog( machine, 2, "IIS timer callback\n"); - s3c240x_dma_request_iis( machine); + verboselog( machine(), 2, "IIS timer callback\n"); + s3c240x_dma_request_iis( machine()); } // RTC @@ -1657,18 +1654,18 @@ WRITE32_MEMBER(gp32_state::s3c240x_mmc_w) static void s3c240x_machine_start( running_machine &machine) { gp32_state *state = machine.driver_data(); - state->m_s3c240x_pwm_timer[0] = machine.scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)0); - state->m_s3c240x_pwm_timer[1] = machine.scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)1); - state->m_s3c240x_pwm_timer[2] = machine.scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)2); - state->m_s3c240x_pwm_timer[3] = machine.scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)3); - state->m_s3c240x_pwm_timer[4] = machine.scheduler().timer_alloc(FUNC(s3c240x_pwm_timer_exp), (void *)(FPTR)4); - state->m_s3c240x_dma_timer[0] = machine.scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)0); - state->m_s3c240x_dma_timer[1] = machine.scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)1); - state->m_s3c240x_dma_timer[2] = machine.scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)2); - state->m_s3c240x_dma_timer[3] = machine.scheduler().timer_alloc(FUNC(s3c240x_dma_timer_exp), (void *)(FPTR)3); - state->m_s3c240x_iic_timer = machine.scheduler().timer_alloc(FUNC(s3c240x_iic_timer_exp), (void *)(FPTR)0); - state->m_s3c240x_iis_timer = machine.scheduler().timer_alloc(FUNC(s3c240x_iis_timer_exp), (void *)(FPTR)0); - state->m_s3c240x_lcd_timer = machine.scheduler().timer_alloc(FUNC(s3c240x_lcd_timer_exp), (void *)(FPTR)0); + state->m_s3c240x_pwm_timer[0] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)0); + state->m_s3c240x_pwm_timer[1] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)1); + state->m_s3c240x_pwm_timer[2] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)2); + state->m_s3c240x_pwm_timer[3] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)3); + state->m_s3c240x_pwm_timer[4] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)4); + state->m_s3c240x_dma_timer[0] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)0); + state->m_s3c240x_dma_timer[1] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)1); + state->m_s3c240x_dma_timer[2] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)2); + state->m_s3c240x_dma_timer[3] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)3); + state->m_s3c240x_iic_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iic_timer_exp),state), (void *)(FPTR)0); + state->m_s3c240x_iis_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iis_timer_exp),state), (void *)(FPTR)0); + state->m_s3c240x_lcd_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_lcd_timer_exp),state), (void *)(FPTR)0); state->m_eeprom_data = auto_alloc_array( machine, UINT8, 0x2000); machine.device("nvram")->set_base(state->m_eeprom_data, 0x2000); smc_init( machine); diff --git a/src/mess/drivers/intv.c b/src/mess/drivers/intv.c index f2afa25fd32..d144a3184b3 100644 --- a/src/mess/drivers/intv.c +++ b/src/mess/drivers/intv.c @@ -796,15 +796,15 @@ ADDRESS_MAP_END /* This is needed because MAME core does not allow PULSE_LINE. The time interval is not critical, although it should be below 1000. */ -static TIMER_CALLBACK(intv_interrupt2_complete) +TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt2_complete) { - machine.device("keyboard")->execute().set_input_line(0, CLEAR_LINE); + machine().device("keyboard")->execute().set_input_line(0, CLEAR_LINE); } INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt2) { machine().device("keyboard")->execute().set_input_line(0, ASSERT_LINE); - machine().scheduler().timer_set(machine().device("keyboard")->cycles_to_attotime(100), FUNC(intv_interrupt2_complete)); + machine().scheduler().timer_set(machine().device("keyboard")->cycles_to_attotime(100), timer_expired_delegate(FUNC(intv_state::intv_interrupt2_complete),this)); } static MACHINE_CONFIG_START( intv, intv_state ) diff --git a/src/mess/drivers/mpf1.c b/src/mess/drivers/mpf1.c index 641f2ee2be3..34f380c583b 100644 --- a/src/mess/drivers/mpf1.c +++ b/src/mess/drivers/mpf1.c @@ -203,16 +203,15 @@ INPUT_PORTS_END /* Intel 8255A Interface */ -static TIMER_CALLBACK( led_refresh ) +TIMER_CALLBACK_MEMBER(mpf1_state::led_refresh) { - mpf1_state *state = machine.driver_data(); - if (BIT(state->m_lednum, 5)) output_set_digit_value(0, param); - if (BIT(state->m_lednum, 4)) output_set_digit_value(1, param); - if (BIT(state->m_lednum, 3)) output_set_digit_value(2, param); - if (BIT(state->m_lednum, 2)) output_set_digit_value(3, param); - if (BIT(state->m_lednum, 1)) output_set_digit_value(4, param); - if (BIT(state->m_lednum, 0)) output_set_digit_value(5, param); + if (BIT(m_lednum, 5)) output_set_digit_value(0, param); + if (BIT(m_lednum, 4)) output_set_digit_value(1, param); + if (BIT(m_lednum, 3)) output_set_digit_value(2, param); + if (BIT(m_lednum, 2)) output_set_digit_value(3, param); + if (BIT(m_lednum, 1)) output_set_digit_value(4, param); + if (BIT(m_lednum, 0)) output_set_digit_value(5, param); } READ8_MEMBER( mpf1_state::ppi_pa_r ) @@ -346,7 +345,7 @@ static TIMER_DEVICE_CALLBACK( check_halt_callback ) void mpf1_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(mpf1_state::led_refresh),this)); /* register for state saving */ save_item(NAME(m_break)); diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c index 0ec5e4798a7..917cc466d53 100644 --- a/src/mess/drivers/nc.c +++ b/src/mess/drivers/nc.c @@ -296,19 +296,18 @@ static void nc_update_interrupts(running_machine &machine) } } -static TIMER_CALLBACK(nc_keyboard_timer_callback) +TIMER_CALLBACK_MEMBER(nc_state::nc_keyboard_timer_callback) { - nc_state *state = machine.driver_data(); LOG(("keyboard int\n")); /* set int */ - state->m_irq_status |= (1<<3); + m_irq_status |= (1<<3); /* update ints */ - nc_update_interrupts(machine); + nc_update_interrupts(machine()); /* don't trigger again, but don't free it */ - state->m_keyboard_timer->reset(); + m_keyboard_timer->reset(); } @@ -539,7 +538,7 @@ static TIMER_DEVICE_CALLBACK(dummy_timer_callback) state->m_previous_inputport_10_state = inputport_10_state; } -static TIMER_CALLBACK(nc_serial_timer_callback); + static void nc_common_init_machine(running_machine &machine) { @@ -767,9 +766,9 @@ static const unsigned long baud_rate_table[]= 19200 }; -static TIMER_CALLBACK(nc_serial_timer_callback) +TIMER_CALLBACK_MEMBER(nc_state::nc_serial_timer_callback) { - i8251_device *uart = machine.device("uart"); + i8251_device *uart = machine().device("uart"); uart->transmit_clock(); uart->receive_clock(); @@ -952,11 +951,11 @@ void nc_state::machine_start() machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc100_machine_stop),&machine())); /* keyboard timer */ - m_keyboard_timer = machine().scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback)); + m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); m_keyboard_timer->adjust(attotime::from_msec(10)); /* serial timer */ - m_serial_timer = machine().scheduler().timer_alloc(FUNC(nc_serial_timer_callback)); + m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_serial_timer_callback),this)); } @@ -1342,11 +1341,11 @@ MACHINE_START_MEMBER(nc_state,nc200) machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc200_machine_stop),&machine())); /* keyboard timer */ - m_keyboard_timer = machine().scheduler().timer_alloc(FUNC(nc_keyboard_timer_callback)); + m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); m_keyboard_timer->adjust(attotime::from_msec(10)); /* serial timer */ - m_serial_timer = machine().scheduler().timer_alloc(FUNC(nc_serial_timer_callback)); + m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_serial_timer_callback),this)); } /* diff --git a/src/mess/drivers/osi.c b/src/mess/drivers/osi.c index 875892b1243..7f339d1c97f 100644 --- a/src/mess/drivers/osi.c +++ b/src/mess/drivers/osi.c @@ -903,16 +903,16 @@ ROM_END /* Driver Initialization */ -static TIMER_CALLBACK( setup_beep ) +TIMER_CALLBACK_MEMBER(sb2m600_state::setup_beep) { - device_t *speaker = machine.device(BEEPER_TAG); + device_t *speaker = machine().device(BEEPER_TAG); beep_set_state(speaker, 0); beep_set_frequency(speaker, 300); } DRIVER_INIT_MEMBER(c1p_state,c1p) { - machine().scheduler().timer_set(attotime::zero, FUNC(setup_beep)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sb2m600_state::setup_beep),this)); } diff --git a/src/mess/drivers/pcw.c b/src/mess/drivers/pcw.c index adec44c1e34..9e87a8e38ea 100644 --- a/src/mess/drivers/pcw.c +++ b/src/mess/drivers/pcw.c @@ -162,11 +162,10 @@ static void pcw_update_irqs(running_machine &machine) machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } -static TIMER_CALLBACK(pcw_timer_pulse) +TIMER_CALLBACK_MEMBER(pcw_state::pcw_timer_pulse) { - pcw_state *state = machine.driver_data(); - state->m_timer_irq_flag = 0; - pcw_update_irqs(machine); + m_timer_irq_flag = 0; + pcw_update_irqs(machine()); } /* callback for 1/300ths of a second interrupt */ @@ -177,7 +176,7 @@ static TIMER_DEVICE_CALLBACK(pcw_timer_interrupt) state->m_timer_irq_flag = 1; pcw_update_irqs(timer.machine()); - timer.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(pcw_timer_pulse)); + timer.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse),state)); } /* fdc interrupt callback. set/clear fdc int */ @@ -731,73 +730,71 @@ READ8_MEMBER(pcw_state::pcw_printer_status_r) * T0: Paper sensor (?) * T1: Print head location (1 if not at left margin) */ -static TIMER_CALLBACK(pcw_stepper_callback) +TIMER_CALLBACK_MEMBER(pcw_state::pcw_stepper_callback) { - pcw_state *state = machine.driver_data(); - //popmessage("PRN: P2 bits %s %s %s\nSerial: %02x\nHeadpos: %i",state->m_printer_p2 & 0x40 ? " " : "6",state->m_printer_p2 & 0x20 ? " " : "5",state->m_printer_p2 & 0x10 ? " " : "4",state->m_printer_shift_output,state->m_printer_headpos); - if((state->m_printer_p2 & 0x10) == 0) // print head motor active + //popmessage("PRN: P2 bits %s %s %s\nSerial: %02x\nHeadpos: %i",m_printer_p2 & 0x40 ? " " : "6",m_printer_p2 & 0x20 ? " " : "5",m_printer_p2 & 0x10 ? " " : "4",m_printer_shift_output,m_printer_headpos); + if((m_printer_p2 & 0x10) == 0) // print head motor active { - UINT8 stepper_state = (state->m_printer_shift_output >> 4) & 0x0f; - if(stepper_state == full_step_table[(state->m_head_motor_state + 1) & 0x03]) + UINT8 stepper_state = (m_printer_shift_output >> 4) & 0x0f; + if(stepper_state == full_step_table[(m_head_motor_state + 1) & 0x03]) { - state->m_printer_headpos += 2; - state->m_head_motor_state++; - logerror("Printer head moved forward by 2 to %i\n",state->m_printer_headpos); + m_printer_headpos += 2; + m_head_motor_state++; + logerror("Printer head moved forward by 2 to %i\n",m_printer_headpos); } - if(stepper_state == half_step_table[(state->m_head_motor_state + 1) & 0x03]) + if(stepper_state == half_step_table[(m_head_motor_state + 1) & 0x03]) { - state->m_printer_headpos += 1; - state->m_head_motor_state++; - logerror("Printer head moved forward by 1 to %i\n",state->m_printer_headpos); + m_printer_headpos += 1; + m_head_motor_state++; + logerror("Printer head moved forward by 1 to %i\n",m_printer_headpos); } - if(stepper_state == full_step_table[(state->m_head_motor_state - 1) & 0x03]) + if(stepper_state == full_step_table[(m_head_motor_state - 1) & 0x03]) { - state->m_printer_headpos -= 2; - state->m_head_motor_state--; - logerror("Printer head moved back by 2 to %i\n",state->m_printer_headpos); + m_printer_headpos -= 2; + m_head_motor_state--; + logerror("Printer head moved back by 2 to %i\n",m_printer_headpos); } - if(stepper_state == half_step_table[(state->m_head_motor_state - 1) & 0x03]) + if(stepper_state == half_step_table[(m_head_motor_state - 1) & 0x03]) { - state->m_printer_headpos -= 1; - state->m_head_motor_state--; - logerror("Printer head moved back by 1 to %i\n",state->m_printer_headpos); + m_printer_headpos -= 1; + m_head_motor_state--; + logerror("Printer head moved back by 1 to %i\n",m_printer_headpos); } - if(state->m_printer_headpos < 0) - state->m_printer_headpos = 0; - if(state->m_printer_headpos > PCW_PRINTER_WIDTH) - state->m_printer_headpos = PCW_PRINTER_WIDTH; - state->m_head_motor_state &= 0x03; - state->m_printer_p2 |= 0x10; + if(m_printer_headpos < 0) + m_printer_headpos = 0; + if(m_printer_headpos > PCW_PRINTER_WIDTH) + m_printer_headpos = PCW_PRINTER_WIDTH; + m_head_motor_state &= 0x03; + m_printer_p2 |= 0x10; } - if((state->m_printer_p2 & 0x20) == 0) // line feed motor active + if((m_printer_p2 & 0x20) == 0) // line feed motor active { - UINT8 stepper_state = state->m_printer_shift_output & 0x0f; - if(stepper_state == full_step_table[(state->m_linefeed_motor_state + 1) & 0x03]) + UINT8 stepper_state = m_printer_shift_output & 0x0f; + if(stepper_state == full_step_table[(m_linefeed_motor_state + 1) & 0x03]) { - state->m_paper_feed++; - if(state->m_paper_feed > PCW_PRINTER_HEIGHT*2) - state->m_paper_feed = 0; - state->m_linefeed_motor_state++; + m_paper_feed++; + if(m_paper_feed > PCW_PRINTER_HEIGHT*2) + m_paper_feed = 0; + m_linefeed_motor_state++; } - if(stepper_state == half_step_table[(state->m_linefeed_motor_state + 1) & 0x03]) + if(stepper_state == half_step_table[(m_linefeed_motor_state + 1) & 0x03]) { - state->m_paper_feed++; - if(state->m_paper_feed > PCW_PRINTER_HEIGHT*2) - state->m_paper_feed = 0; - state->m_linefeed_motor_state++; + m_paper_feed++; + if(m_paper_feed > PCW_PRINTER_HEIGHT*2) + m_paper_feed = 0; + m_linefeed_motor_state++; } - state->m_linefeed_motor_state &= 0x03; - state->m_printer_p2 |= 0x20; + m_linefeed_motor_state &= 0x03; + m_printer_p2 |= 0x20; } } -static TIMER_CALLBACK(pcw_pins_callback) +TIMER_CALLBACK_MEMBER(pcw_state::pcw_pins_callback) { - pcw_state *state = machine.driver_data(); - pcw_printer_fire_pins(machine,state->m_printer_pins); - state->m_printer_p2 |= 0x40; + pcw_printer_fire_pins(machine(),m_printer_pins); + m_printer_p2 |= 0x40; } READ8_MEMBER(pcw_state::mcu_printer_p1_r) @@ -1034,9 +1031,9 @@ static ADDRESS_MAP_START(pcw_keyboard_io, AS_IO, 8, pcw_state ) ADDRESS_MAP_END -static TIMER_CALLBACK(setup_beep) +TIMER_CALLBACK_MEMBER(pcw_state::setup_beep) { - device_t *speaker = machine.device(BEEPER_TAG); + device_t *speaker = machine().device(BEEPER_TAG); beep_set_state(speaker, 0); beep_set_frequency(speaker, 3750); } @@ -1096,10 +1093,10 @@ DRIVER_INIT_MEMBER(pcw_state,pcw) m_roller_ram_offset = 0; /* timer interrupt */ - machine().scheduler().timer_set(attotime::zero, FUNC(setup_beep)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(pcw_state::setup_beep),this)); - m_prn_stepper = machine().scheduler().timer_alloc(FUNC(pcw_stepper_callback)); - m_prn_pins = machine().scheduler().timer_alloc(FUNC(pcw_pins_callback)); + m_prn_stepper = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_stepper_callback),this)); + m_prn_pins = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pcw_state::pcw_pins_callback),this)); } diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c index 98c48831efe..44d13c57e0a 100644 --- a/src/mess/drivers/pdp1.c +++ b/src/mess/drivers/pdp1.c @@ -383,10 +383,10 @@ by a pdp-1 programming error, even if there is no emulator error. */ static int tape_read(pdp1_state *state, UINT8 *reply); -static TIMER_CALLBACK(reader_callback); -static TIMER_CALLBACK(puncher_callback); -static TIMER_CALLBACK(tyo_callback); -static TIMER_CALLBACK(dpy_callback); + + + + static void pdp1_machine_stop(running_machine &machine); static void pdp1_tape_read_binary(device_t *device); @@ -658,10 +658,10 @@ void pdp1_state::machine_start() machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine())); - m_tape_reader.timer = machine().scheduler().timer_alloc(FUNC(reader_callback)); - m_tape_puncher.timer = machine().scheduler().timer_alloc(FUNC(puncher_callback)); - m_typewriter.tyo_timer = machine().scheduler().timer_alloc(FUNC(tyo_callback)); - m_dpy_timer = machine().scheduler().timer_alloc(FUNC(dpy_callback)); + m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this)); + m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this)); + m_typewriter.tyo_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::tyo_callback),this)); + m_dpy_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::dpy_callback),this)); m_tape_reader.timer->adjust(attotime::zero, 0, attotime::from_hz(2500)); m_tape_reader.timer->enable(0); } @@ -902,54 +902,53 @@ static void begin_tape_read(pdp1_state *state, int binary, int nac) /* timer callback to simulate reader IO */ -static TIMER_CALLBACK(reader_callback) +TIMER_CALLBACK_MEMBER(pdp1_state::reader_callback) { - pdp1_state *state = machine.driver_data(); int not_ready; UINT8 data; - if (state->m_tape_reader.rc) + if (m_tape_reader.rc) { - not_ready = tape_read(state, & data); + not_ready = tape_read(this, & data); if (not_ready) { - state->m_tape_reader.motor_on = 0; /* let us stop the motor */ + m_tape_reader.motor_on = 0; /* let us stop the motor */ } else { - if ((! state->m_tape_reader.rby) || (data & 0200)) + if ((! m_tape_reader.rby) || (data & 0200)) { - state->m_tape_reader.rb |= (state->m_tape_reader.rby) ? (data & 077) : data; + m_tape_reader.rb |= (m_tape_reader.rby) ? (data & 077) : data; - if (state->m_tape_reader.rc != 3) + if (m_tape_reader.rc != 3) { - state->m_tape_reader.rb <<= 6; + m_tape_reader.rb <<= 6; } - state->m_tape_reader.rc = (state->m_tape_reader.rc+1) & 3; + m_tape_reader.rc = (m_tape_reader.rc+1) & 3; - if (state->m_tape_reader.rc == 0) + if (m_tape_reader.rc == 0) { /* IO complete */ - state->m_tape_reader.rcl = 0; - if (state->m_tape_reader.rcp) + m_tape_reader.rcl = 0; + if (m_tape_reader.rcp) { - machine.device("maincpu")->state().set_state_int(PDP1_IO, state->m_tape_reader.rb); /* transfer reader buffer to IO */ - pdp1_pulse_iot_done(machine.device("maincpu")); + machine().device("maincpu")->state().set_state_int(PDP1_IO, m_tape_reader.rb); /* transfer reader buffer to IO */ + pdp1_pulse_iot_done(machine().device("maincpu")); } else - state->m_io_status |= io_st_ptr; + m_io_status |= io_st_ptr; } } } } - if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) + if (m_tape_reader.motor_on && m_tape_reader.rcl) { - state->m_tape_reader.timer->enable(1); + m_tape_reader.timer->enable(1); } else { - state->m_tape_reader.timer->enable(0); + m_tape_reader.timer->enable(0); } } @@ -1080,14 +1079,13 @@ static void tape_write(pdp1_state *state, UINT8 data) /* timer callback to generate punch completion pulse */ -static TIMER_CALLBACK(puncher_callback) +TIMER_CALLBACK_MEMBER(pdp1_state::puncher_callback) { - pdp1_state *state = machine.driver_data(); int nac = param; - state->m_io_status |= io_st_ptp; + m_io_status |= io_st_ptp; if (nac) { - pdp1_pulse_iot_done(machine.device("maincpu")); + pdp1_pulse_iot_done(machine().device("maincpu")); } } @@ -1290,14 +1288,13 @@ static void typewriter_out(running_machine &machine, UINT8 data) /* timer callback to generate typewriter completion pulse */ -static TIMER_CALLBACK(tyo_callback) +TIMER_CALLBACK_MEMBER(pdp1_state::tyo_callback) { - pdp1_state *state = machine.driver_data(); int nac = param; - state->m_io_status |= io_st_tyo; + m_io_status |= io_st_tyo; if (nac) { - pdp1_pulse_iot_done(machine.device("maincpu")); + pdp1_pulse_iot_done(machine().device("maincpu")); } } @@ -1413,9 +1410,9 @@ static void iot_tyi(device_t *device, int op2, int nac, int mb, int *io, int ac) /* timer callback to generate crt completion pulse */ -static TIMER_CALLBACK(dpy_callback) +TIMER_CALLBACK_MEMBER(pdp1_state::dpy_callback) { - pdp1_pulse_iot_done(machine.device("maincpu")); + pdp1_pulse_iot_done(machine().device("maincpu")); } @@ -1478,10 +1475,9 @@ static void parallel_drum_set_il(pdp1_state *state, int il) } #ifdef UNUSED_FUNCTION -static TIMER_CALLBACK(il_timer_callback) +TIMER_CALLBACK_MEMBER(pdp1_state::il_timer_callback) { - pdp1_state *state = machine.driver_data(); - if (state->m_parallel_drum.dba) + if (m_parallel_drum.dba) { /* set break request and status bit 5 */ /* ... */ @@ -1493,7 +1489,7 @@ static void parallel_drum_init(pdp1_state *state) state->m_parallel_drum.rotation_timer = machine.scheduler().timer_alloc(); state->m_parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); - state->m_parallel_drum.il_timer = machine.scheduler().timer_alloc(FUNC(il_timer_callback)); + state->m_parallel_drum.il_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::il_timer_callback),this)); parallel_drum_set_il(0); } #endif diff --git a/src/mess/drivers/samcoupe.c b/src/mess/drivers/samcoupe.c index ee0f700d36c..752e25a4af7 100644 --- a/src/mess/drivers/samcoupe.c +++ b/src/mess/drivers/samcoupe.c @@ -325,15 +325,14 @@ ADDRESS_MAP_END INTERRUPTS ***************************************************************************/ -static TIMER_CALLBACK( irq_off ) +TIMER_CALLBACK_MEMBER(samcoupe_state::irq_off) { - samcoupe_state *state = machine.driver_data(); /* adjust STATUS register */ - state->m_status |= param; + m_status |= param; /* clear interrupt */ - if ((state->m_status & 0x1f) == 0x1f) - machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + if ((m_status & 0x1f) == 0x1f) + machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); } @@ -343,7 +342,7 @@ void samcoupe_irq(device_t *device, UINT8 src) /* assert irq and a timer to set it off again */ device->execute().set_input_line(0, ASSERT_LINE); - device->machine().scheduler().timer_set(attotime::from_usec(20), FUNC(irq_off), src); + device->machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(samcoupe_state::irq_off),state), src); /* adjust STATUS register */ state->m_status &= ~src; diff --git a/src/mess/drivers/sg1000.c b/src/mess/drivers/sg1000.c index 5d645b1bbc7..a316baf1821 100644 --- a/src/mess/drivers/sg1000.c +++ b/src/mess/drivers/sg1000.c @@ -1025,19 +1025,19 @@ static const sn76496_config psg_intf = TIMER_CALLBACK( lightgun_tick ) -------------------------------------------------*/ -static TIMER_CALLBACK( lightgun_tick ) +TIMER_CALLBACK_MEMBER(sg1000_state::lightgun_tick) { - UINT8 *rom = machine.root_device().memregion(Z80_TAG)->base(); + UINT8 *rom = machine().root_device().memregion(Z80_TAG)->base(); if (IS_CARTRIDGE_TV_DRAW(rom)) { /* enable crosshair for TV Draw */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL); } else { /* disable crosshair for other cartridges */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_NONE); } } @@ -1048,7 +1048,7 @@ static TIMER_CALLBACK( lightgun_tick ) void sg1000_state::machine_start() { /* toggle light gun crosshair */ - machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sg1000_state::lightgun_tick),this)); /* register for state saving */ save_item(NAME(m_tvdraw_data)); @@ -1061,7 +1061,7 @@ void sg1000_state::machine_start() void sc3000_state::machine_start() { /* toggle light gun crosshair */ - machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sg1000_state::lightgun_tick),this)); /* register for state saving */ save_item(NAME(m_tvdraw_data)); diff --git a/src/mess/drivers/studio2.c b/src/mess/drivers/studio2.c index f13f3d6eeec..f5190dde8b5 100644 --- a/src/mess/drivers/studio2.c +++ b/src/mess/drivers/studio2.c @@ -546,16 +546,16 @@ ROM_END /* Driver Initialization */ -static TIMER_CALLBACK( setup_beep ) +TIMER_CALLBACK_MEMBER(studio2_state::setup_beep) { - device_t *speaker = machine.device(BEEPER_TAG); + device_t *speaker = machine().device(BEEPER_TAG); beep_set_state(speaker, 0); beep_set_frequency(speaker, 300); } DRIVER_INIT_MEMBER(studio2_state,studio2) { - machine().scheduler().timer_set(attotime::zero, FUNC(setup_beep)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(studio2_state::setup_beep),this)); } /* Game Drivers */ diff --git a/src/mess/drivers/svision.c b/src/mess/drivers/svision.c index 9fa25bdd801..b6060605ec6 100644 --- a/src/mess/drivers/svision.c +++ b/src/mess/drivers/svision.c @@ -24,36 +24,36 @@ #define YPOS state->m_reg[3] #define BANK m_reg[0x26] -static TIMER_CALLBACK(svision_pet_timer) +TIMER_CALLBACK_MEMBER(svision_state::svision_pet_timer) { - svision_state *state = machine.driver_data(); - switch (state->m_pet.state) + switch (m_pet.state) { case 0: - state->m_pet.input = machine.root_device().ioport("JOY2")->read(); + m_pet.input = machine().root_device().ioport("JOY2")->read(); /* fall through */ case 2: case 4: case 6: case 8: case 10: case 12: case 14: - state->m_pet.clock=state->m_pet.state&2; - state->m_pet.data=state->m_pet.input&1; - state->m_pet.input>>=1; - state->m_pet.state++; + m_pet.clock=m_pet.state&2; + m_pet.data=m_pet.input&1; + m_pet.input>>=1; + m_pet.state++; break; case 16+15: - state->m_pet.state = 0; + m_pet.state = 0; break; default: - state->m_pet.state++; + m_pet.state++; break; } } static TIMER_DEVICE_CALLBACK(svision_pet_timer_dev) { - svision_pet_timer(timer.machine(),ptr,param); + svision_state *state = timer.machine().driver_data(); + state->svision_pet_timer(ptr,param); } void svision_irq(running_machine &machine) @@ -65,12 +65,11 @@ void svision_irq(running_machine &machine) machine.device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE); } -static TIMER_CALLBACK(svision_timer) +TIMER_CALLBACK_MEMBER(svision_state::svision_timer) { - svision_state *state = machine.driver_data(); - state->m_svision.timer_shot = TRUE; - state->m_svision.timer1->enable(FALSE); - svision_irq( machine ); + m_svision.timer_shot = TRUE; + m_svision.timer1->enable(FALSE); + svision_irq( machine() ); } READ8_MEMBER(svision_state::svision_r) @@ -424,7 +423,7 @@ INTERRUPT_GEN_MEMBER(svision_state::svision_frame_int) DRIVER_INIT_MEMBER(svision_state,svision) { - m_svision.timer1 = machine().scheduler().timer_alloc(FUNC(svision_timer)); + m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); m_sound = machine().device("custom"); m_dma_finished = svision_dma_finished(m_sound); m_pet.on = FALSE; @@ -433,13 +432,13 @@ DRIVER_INIT_MEMBER(svision_state,svision) DRIVER_INIT_MEMBER(svision_state,svisions) { - m_svision.timer1 = machine().scheduler().timer_alloc(FUNC(svision_timer)); + m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); m_sound = machine().device("custom"); m_dma_finished = svision_dma_finished(m_sound); membank("bank2")->set_base(memregion("user1")->base() + 0x1c000); - m_svision.timer1 = machine().scheduler().timer_alloc(FUNC(svision_timer)); + m_svision.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_timer),this)); m_pet.on = TRUE; - m_pet.timer = machine().scheduler().timer_alloc(FUNC(svision_pet_timer)); + m_pet.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(svision_state::svision_pet_timer),this)); } static DEVICE_IMAGE_LOAD( svision_cart ) diff --git a/src/mess/drivers/tmc1800.c b/src/mess/drivers/tmc1800.c index fd4df95a5bf..d8735aec1e8 100644 --- a/src/mess/drivers/tmc1800.c +++ b/src/mess/drivers/tmc1800.c @@ -900,16 +900,16 @@ ROM_END /* Driver Initialization */ -static TIMER_CALLBACK(setup_beep) +TIMER_CALLBACK_MEMBER(tmc1800_state::setup_beep) { - device_t *speaker = machine.device(BEEPER_TAG); + device_t *speaker = machine().device(BEEPER_TAG); beep_set_state(speaker, 0); beep_set_frequency( speaker, 0 ); } DRIVER_INIT_MEMBER(tmc1800_state,tmc1800) { - machine().scheduler().timer_set(attotime::zero, FUNC(setup_beep)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(tmc1800_state::setup_beep),this)); } /* System Drivers */ diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c index fabaf530b8e..059f3c71387 100644 --- a/src/mess/drivers/tx0.c +++ b/src/mess/drivers/tx0.c @@ -340,10 +340,10 @@ static const crt_interface tx0_crt_interface = */ -static TIMER_CALLBACK(reader_callback); -static TIMER_CALLBACK(puncher_callback); -static TIMER_CALLBACK(prt_callback); -static TIMER_CALLBACK(dis_callback); + + + + @@ -383,10 +383,10 @@ static void tx0_machine_stop(running_machine &machine) void tx0_state::machine_start() { - m_tape_reader.timer = machine().scheduler().timer_alloc(FUNC(reader_callback)); - m_tape_puncher.timer = machine().scheduler().timer_alloc(FUNC(puncher_callback)); - m_typewriter.prt_timer = machine().scheduler().timer_alloc(FUNC(prt_callback)); - m_dis_timer = machine().scheduler().timer_alloc(FUNC(dis_callback)); + m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::reader_callback),this)); + m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::puncher_callback),this)); + m_typewriter.prt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::prt_callback),this)); + m_dis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tx0_state::dis_callback),this)); machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(tx0_machine_stop),&machine())); } @@ -631,49 +631,48 @@ static void begin_tape_read(tx0_state *state, int binary) /* timer callback to simulate reader IO */ -static TIMER_CALLBACK(reader_callback) +TIMER_CALLBACK_MEMBER(tx0_state::reader_callback) { - tx0_state *state = machine.driver_data(); int not_ready; UINT8 data; int ac; - if (state->m_tape_reader.rc) + if (m_tape_reader.rc) { - not_ready = tape_read(state, & data); + not_ready = tape_read(this, & data); if (not_ready) { - state->m_tape_reader.motor_on = 0; /* let us stop the motor */ + m_tape_reader.motor_on = 0; /* let us stop the motor */ } else { if (data & 0100) { /* read current AC */ - ac = machine.device("maincpu")->state().state_int(TX0_AC); + ac = machine().device("maincpu")->state().state_int(TX0_AC); /* cycle right */ ac = (ac >> 1) | ((ac & 1) << 17); /* shuffle and insert data into AC */ ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); /* write modified AC */ - machine.device("maincpu")->state().set_state_int(TX0_AC, ac); + machine().device("maincpu")->state().set_state_int(TX0_AC, ac); - state->m_tape_reader.rc = (state->m_tape_reader.rc+1) & 3; + m_tape_reader.rc = (m_tape_reader.rc+1) & 3; - if (state->m_tape_reader.rc == 0) + if (m_tape_reader.rc == 0) { /* IO complete */ - state->m_tape_reader.rcl = 0; - machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); + m_tape_reader.rcl = 0; + machine().device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); } } } } - if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) + if (m_tape_reader.motor_on && m_tape_reader.rcl) /* delay is approximately 1/400s */ - state->m_tape_reader.timer->adjust(attotime::from_usec(2500)); + m_tape_reader.timer->adjust(attotime::from_usec(2500)); else - state->m_tape_reader.timer->enable(0); + m_tape_reader.timer->enable(0); } /* @@ -697,9 +696,9 @@ void tx0_punchtape_image_device::call_unload() state->m_tape_puncher.fd = NULL; } -static TIMER_CALLBACK(puncher_callback) +TIMER_CALLBACK_MEMBER(tx0_state::puncher_callback) { - machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); + machine().device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); } /* @@ -792,9 +791,9 @@ static void typewriter_out(running_machine &machine, UINT8 data) /* timer callback to generate typewriter completion pulse */ -static TIMER_CALLBACK(prt_callback) +TIMER_CALLBACK_MEMBER(tx0_state::prt_callback) { - machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); + machine().device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); } /* @@ -819,9 +818,9 @@ static void tx0_io_prt(device_t *device) /* timer callback to generate crt completion pulse */ -static TIMER_CALLBACK(dis_callback) +TIMER_CALLBACK_MEMBER(tx0_state::dis_callback) { - machine.device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); + machine().device("maincpu")->state().set_state_int(TX0_IO_COMPLETE, (UINT64)0); } /* diff --git a/src/mess/drivers/x07.c b/src/mess/drivers/x07.c index 5e6a8044826..701cde1bf84 100644 --- a/src/mess/drivers/x07.c +++ b/src/mess/drivers/x07.c @@ -666,20 +666,18 @@ void x07_state::cassette_w() m_cass_data = m_regs_w[7]; } -static TIMER_CALLBACK( cassette_tick ) +TIMER_CALLBACK_MEMBER(x07_state::cassette_tick) { - x07_state *state = machine.driver_data(); - state->m_cass_clk++; + m_cass_clk++; } -static TIMER_CALLBACK( cassette_poll ) +TIMER_CALLBACK_MEMBER(x07_state::cassette_poll) { - x07_state *state = machine.driver_data(); - if ((state->m_cassette->get_state() & 0x03) == CASSETTE_PLAY) - state->cassette_load(); - else if ((state->m_cassette->get_state() & 0x03) == CASSETTE_RECORD) - state->cassette_save(); + if ((m_cassette->get_state() & 0x03) == CASSETTE_PLAY) + cassette_load(); + else if ((m_cassette->get_state() & 0x03) == CASSETTE_RECORD) + cassette_save(); } void x07_state::cassette_load() @@ -1367,26 +1365,23 @@ static TIMER_DEVICE_CALLBACK( blink_timer ) state->m_blink = !state->m_blink; } -static TIMER_CALLBACK( rsta_clear ) +TIMER_CALLBACK_MEMBER(x07_state::rsta_clear) { - x07_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(NSC800_RSTA, CLEAR_LINE); + m_maincpu->set_input_line(NSC800_RSTA, CLEAR_LINE); - if (state->m_kb_size) - state->kb_irq(); + if (m_kb_size) + kb_irq(); } -static TIMER_CALLBACK( rstb_clear ) +TIMER_CALLBACK_MEMBER(x07_state::rstb_clear) { - x07_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(NSC800_RSTB, CLEAR_LINE); + m_maincpu->set_input_line(NSC800_RSTB, CLEAR_LINE); } -static TIMER_CALLBACK( beep_stop ) +TIMER_CALLBACK_MEMBER(x07_state::beep_stop) { - x07_state *state = machine.driver_data(); - beep_set_state(state->m_beep, 0); + beep_set_state(m_beep, 0); } static const gfx_layout x07_charlayout = @@ -1406,11 +1401,11 @@ GFXDECODE_END void x07_state::machine_start() { - m_rsta_clear = machine().scheduler().timer_alloc(FUNC(rsta_clear)); - m_rstb_clear = machine().scheduler().timer_alloc(FUNC(rstb_clear)); - m_beep_stop = machine().scheduler().timer_alloc(FUNC(beep_stop)); - m_cass_poll = machine().scheduler().timer_alloc(FUNC(cassette_poll)); - m_cass_tick = machine().scheduler().timer_alloc(FUNC(cassette_tick)); + m_rsta_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rsta_clear),this)); + m_rstb_clear = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::rstb_clear),this)); + m_beep_stop = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::beep_stop),this)); + m_cass_poll = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_poll),this)); + m_cass_tick = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x07_state::cassette_tick),this)); /* Save State */ save_item(NAME(m_sleep)); diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index edb9d055e5c..854ae7385c3 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -2432,32 +2432,31 @@ TIMER_DEVICE_CALLBACK(x1_keyboard_callback) } } -TIMER_CALLBACK(x1_rtc_increment) +TIMER_CALLBACK_MEMBER(x1_state::x1_rtc_increment) { - x1_state *state = machine.driver_data(); static const UINT8 dpm[12] = { 0x31, 0x28, 0x31, 0x30, 0x31, 0x30, 0x31, 0x31, 0x30, 0x31, 0x30, 0x31 }; - state->m_rtc.sec++; + m_rtc.sec++; - if((state->m_rtc.sec & 0x0f) >= 0x0a) { state->m_rtc.sec+=0x10; state->m_rtc.sec&=0xf0; } - if((state->m_rtc.sec & 0xf0) >= 0x60) { state->m_rtc.min++; state->m_rtc.sec = 0; } - if((state->m_rtc.min & 0x0f) >= 0x0a) { state->m_rtc.min+=0x10; state->m_rtc.min&=0xf0; } - if((state->m_rtc.min & 0xf0) >= 0x60) { state->m_rtc.hour++; state->m_rtc.min = 0; } - if((state->m_rtc.hour & 0x0f) >= 0x0a) { state->m_rtc.hour+=0x10; state->m_rtc.hour&=0xf0; } - if((state->m_rtc.hour & 0xff) >= 0x24) { state->m_rtc.day++; state->m_rtc.wday++; state->m_rtc.hour = 0; } - if((state->m_rtc.wday & 0x0f) >= 0x07) { state->m_rtc.wday = 0; } - if((state->m_rtc.day & 0x0f) >= 0x0a) { state->m_rtc.day+=0x10; state->m_rtc.day&=0xf0; } + if((m_rtc.sec & 0x0f) >= 0x0a) { m_rtc.sec+=0x10; m_rtc.sec&=0xf0; } + if((m_rtc.sec & 0xf0) >= 0x60) { m_rtc.min++; m_rtc.sec = 0; } + if((m_rtc.min & 0x0f) >= 0x0a) { m_rtc.min+=0x10; m_rtc.min&=0xf0; } + if((m_rtc.min & 0xf0) >= 0x60) { m_rtc.hour++; m_rtc.min = 0; } + if((m_rtc.hour & 0x0f) >= 0x0a) { m_rtc.hour+=0x10; m_rtc.hour&=0xf0; } + if((m_rtc.hour & 0xff) >= 0x24) { m_rtc.day++; m_rtc.wday++; m_rtc.hour = 0; } + if((m_rtc.wday & 0x0f) >= 0x07) { m_rtc.wday = 0; } + if((m_rtc.day & 0x0f) >= 0x0a) { m_rtc.day+=0x10; m_rtc.day&=0xf0; } /* FIXME: very crude leap year support (i.e. it treats the RTC to be with a 2000-2099 timeline), dunno how the real x1 supports this, maybe it just have a 1980-1999 timeline since year 0x00 shows as a XX on display */ - if(((state->m_rtc.year % 4) == 0) && state->m_rtc.month == 2) + if(((m_rtc.year % 4) == 0) && m_rtc.month == 2) { - if((state->m_rtc.day & 0xff) >= dpm[state->m_rtc.month-1]+1+1) - { state->m_rtc.month++; state->m_rtc.day = 0x01; } + if((m_rtc.day & 0xff) >= dpm[m_rtc.month-1]+1+1) + { m_rtc.month++; m_rtc.day = 0x01; } } - else if((state->m_rtc.day & 0xff) >= dpm[state->m_rtc.month-1]+1){ state->m_rtc.month++; state->m_rtc.day = 0x01; } - if(state->m_rtc.month > 12) { state->m_rtc.year++; state->m_rtc.month = 0x01; } - if((state->m_rtc.year & 0x0f) >= 0x0a) { state->m_rtc.year+=0x10; state->m_rtc.year&=0xf0; } - if((state->m_rtc.year & 0xf0) >= 0xa0) { state->m_rtc.year = 0; } //roll over + else if((m_rtc.day & 0xff) >= dpm[m_rtc.month-1]+1){ m_rtc.month++; m_rtc.day = 0x01; } + if(m_rtc.month > 12) { m_rtc.year++; m_rtc.month = 0x01; } + if((m_rtc.year & 0x0f) >= 0x0a) { m_rtc.year+=0x10; m_rtc.year&=0xf0; } + if((m_rtc.year & 0xf0) >= 0xa0) { m_rtc.year = 0; } //roll over } MACHINE_RESET_MEMBER(x1_state,x1) @@ -2530,7 +2529,7 @@ MACHINE_START_MEMBER(x1_state,x1) m_rtc.min = ((systime.local_time.minute / 10)<<4) | ((systime.local_time.minute % 10) & 0xf); m_rtc.sec = ((systime.local_time.second / 10)<<4) | ((systime.local_time.second % 10) & 0xf); - m_rtc_timer = machine().scheduler().timer_alloc(FUNC(x1_rtc_increment)); + m_rtc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x1_state::x1_rtc_increment),this)); } } diff --git a/src/mess/drivers/x68k.c b/src/mess/drivers/x68k.c index 73df7848ddc..2039b5bba60 100644 --- a/src/mess/drivers/x68k.c +++ b/src/mess/drivers/x68k.c @@ -177,58 +177,57 @@ static void mfp_init(running_machine &machine) state->m_mfp.current_irq = -1; // No current interrupt #if 0 - mfp_timer[0] = machine.scheduler().timer_alloc(FUNC(mfp_timer_a_callback)); - mfp_timer[1] = machine.scheduler().timer_alloc(FUNC(mfp_timer_b_callback)); - mfp_timer[2] = machine.scheduler().timer_alloc(FUNC(mfp_timer_c_callback)); - mfp_timer[3] = machine.scheduler().timer_alloc(FUNC(mfp_timer_d_callback)); - mfp_irq = machine.scheduler().timer_alloc(FUNC(mfp_update_irq)); + mfp_timer[0] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_a_callback),this)); + mfp_timer[1] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_b_callback),this)); + mfp_timer[2] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_c_callback),this)); + mfp_timer[3] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_timer_d_callback),this)); + mfp_irq = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::mfp_update_irq),this)); mfp_irq->adjust(attotime::zero, 0, attotime::from_usec(32)); #endif } #ifdef UNUSED_FUNCTION -TIMER_CALLBACK(mfp_update_irq) +TIMER_CALLBACK_MEMBER(x68k_state::mfp_update_irq) { - x68k_state *state = machine.driver_data(); int x; - if((state->m_ioc.irqstatus & 0xc0) != 0) + if((m_ioc.irqstatus & 0xc0) != 0) return; // check for pending IRQs, in priority order - if(state->m_mfp.ipra != 0) + if(m_mfp.ipra != 0) { for(x=7;x>=0;x--) { - if((state->m_mfp.ipra & (1 << x)) && (state->m_mfp.imra & (1 << x))) + if((m_mfp.ipra & (1 << x)) && (m_mfp.imra & (1 << x))) { - state->m_current_irq_line = state->m_mfp.irqline; - state->m_mfp.current_irq = x + 8; + m_current_irq_line = m_mfp.irqline; + m_mfp.current_irq = x + 8; // assert IRQ line -// if(state->m_mfp.iera & (1 << x)) +// if(m_mfp.iera & (1 << x)) { - state->m_current_vector[6] = (state->m_mfp.vr & 0xf0) | (x+8); - machine.device("maincpu")->execute().set_input_line_and_vector(state->m_mfp.irqline,ASSERT_LINE,(state->m_mfp.vr & 0xf0) | (x + 8)); -// logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(state->m_mfp.vr & 0xf0) | (x+8),state->m_mfp.irqline); + m_current_vector[6] = (m_mfp.vr & 0xf0) | (x+8); + machine().device("maincpu")->execute().set_input_line_and_vector(m_mfp.irqline,ASSERT_LINE,(m_mfp.vr & 0xf0) | (x + 8)); +// logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(m_mfp.vr & 0xf0) | (x+8),m_mfp.irqline); return; // one at a time only } } } } - if(state->m_mfp.iprb != 0) + if(m_mfp.iprb != 0) { for(x=7;x>=0;x--) { - if((state->m_mfp.iprb & (1 << x)) && (state->m_mfp.imrb & (1 << x))) + if((m_mfp.iprb & (1 << x)) && (m_mfp.imrb & (1 << x))) { - state->m_current_irq_line = state->m_mfp.irqline; - state->m_mfp.current_irq = x; + m_current_irq_line = m_mfp.irqline; + m_mfp.current_irq = x; // assert IRQ line -// if(state->m_mfp.ierb & (1 << x)) +// if(m_mfp.ierb & (1 << x)) { - state->m_current_vector[6] = (state->m_mfp.vr & 0xf0) | x; - machine.device("maincpu")->execute().set_input_line_and_vector(state->m_mfp.irqline,ASSERT_LINE,(state->m_mfp.vr & 0xf0) | x); -// logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(state->m_mfp.vr & 0xf0) | x,state->m_mfp.irqline); + m_current_vector[6] = (m_mfp.vr & 0xf0) | x; + machine().device("maincpu")->execute().set_input_line_and_vector(m_mfp.irqline,ASSERT_LINE,(m_mfp.vr & 0xf0) | x); +// logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(m_mfp.vr & 0xf0) | x,m_mfp.irqline); return; // one at a time only } } @@ -262,46 +261,42 @@ void mfp_trigger_irq(running_machine &machine, int irq) } -TIMER_CALLBACK(mfp_timer_a_callback) +TIMER_CALLBACK_MEMBER(x68k_state::mfp_timer_a_callback) { - x68k_state *state = machine.driver_data(); - state->m_mfp.timer[0].counter--; - if(state->m_mfp.timer[0].counter == 0) + m_mfp.timer[0].counter--; + if(m_mfp.timer[0].counter == 0) { - state->m_mfp.timer[0].counter = state->m_mfp.tadr; + m_mfp.timer[0].counter = m_mfp.tadr; mfp_trigger_irq(MFP_IRQ_TIMERA); } } -TIMER_CALLBACK(mfp_timer_b_callback) +TIMER_CALLBACK_MEMBER(x68k_state::mfp_timer_b_callback) { - x68k_state *state = machine.driver_data(); - state->m_mfp.timer[1].counter--; - if(state->m_mfp.timer[1].counter == 0) + m_mfp.timer[1].counter--; + if(m_mfp.timer[1].counter == 0) { - state->m_mfp.timer[1].counter = state->m_mfp.tbdr; + m_mfp.timer[1].counter = m_mfp.tbdr; mfp_trigger_irq(MFP_IRQ_TIMERB); } } -TIMER_CALLBACK(mfp_timer_c_callback) +TIMER_CALLBACK_MEMBER(x68k_state::mfp_timer_c_callback) { - x68k_state *state = machine.driver_data(); - state->m_mfp.timer[2].counter--; - if(state->m_mfp.timer[2].counter == 0) + m_mfp.timer[2].counter--; + if(m_mfp.timer[2].counter == 0) { - state->m_mfp.timer[2].counter = state->m_mfp.tcdr; + m_mfp.timer[2].counter = m_mfp.tcdr; mfp_trigger_irq(MFP_IRQ_TIMERC); } } -TIMER_CALLBACK(mfp_timer_d_callback) +TIMER_CALLBACK_MEMBER(x68k_state::mfp_timer_d_callback) { - x68k_state *state = machine.driver_data(); - state->m_mfp.timer[3].counter--; - if(state->m_mfp.timer[3].counter == 0) + m_mfp.timer[3].counter--; + if(m_mfp.timer[3].counter == 0) { - state->m_mfp.timer[3].counter = state->m_mfp.tddr; + m_mfp.timer[3].counter = m_mfp.tddr; mfp_trigger_irq(MFP_IRQ_TIMERD); } } @@ -322,18 +317,17 @@ void mfp_set_timer(int timer, unsigned char data) #endif // LED timer callback -static TIMER_CALLBACK( x68k_led_callback ) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_led_callback) { - x68k_state *state = machine.driver_data(); int drive; - if(state->m_led_state == 0) - state->m_led_state = 1; + if(m_led_state == 0) + m_led_state = 1; else - state->m_led_state = 0; - if(state->m_led_state == 1) + m_led_state = 0; + if(m_led_state == 1) { for(drive=0;drive<4;drive++) - output_set_indexed_value("ctrl_drv",drive,state->m_fdc.led_ctrl[drive] ? 0 : 1); + output_set_indexed_value("ctrl_drv",drive,m_fdc.led_ctrl[drive] ? 0 : 1); } else { @@ -470,48 +464,47 @@ static void x68k_keyboard_push_scancode(running_machine &machine,unsigned char c } } -static TIMER_CALLBACK(x68k_keyboard_poll) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_keyboard_poll) { - x68k_state *state = machine.driver_data(); int x; static const char *const keynames[] = { "key1", "key2", "key3", "key4" }; for(x=0;x<0x80;x++) { // adjust delay/repeat timers - if(state->m_keyboard.keytime[x] > 0) + if(m_keyboard.keytime[x] > 0) { - state->m_keyboard.keytime[x] -= 5; + m_keyboard.keytime[x] -= 5; } - if(!(machine.root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + if(!(machine().root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) { - if(state->m_keyboard.keyon[x] != 0) + if(m_keyboard.keyon[x] != 0) { - x68k_keyboard_push_scancode(machine,0x80 + x); - state->m_keyboard.keytime[x] = 0; - state->m_keyboard.keyon[x] = 0; - state->m_keyboard.last_pressed = 0; + x68k_keyboard_push_scancode(machine(),0x80 + x); + m_keyboard.keytime[x] = 0; + m_keyboard.keyon[x] = 0; + m_keyboard.last_pressed = 0; logerror("KB: Released key 0x%02x\n",x); } } // check to see if a key is being held - if(state->m_keyboard.keyon[x] != 0 && state->m_keyboard.keytime[x] == 0 && state->m_keyboard.last_pressed == x) + if(m_keyboard.keyon[x] != 0 && m_keyboard.keytime[x] == 0 && m_keyboard.last_pressed == x) { - if(machine.root_device().ioport(keynames[state->m_keyboard.last_pressed / 32])->read() & (1 << (state->m_keyboard.last_pressed % 32))) + if(machine().root_device().ioport(keynames[m_keyboard.last_pressed / 32])->read() & (1 << (m_keyboard.last_pressed % 32))) { - x68k_keyboard_push_scancode(machine,state->m_keyboard.last_pressed); - state->m_keyboard.keytime[state->m_keyboard.last_pressed] = (state->m_keyboard.repeat^2)*5+30; - logerror("KB: Holding key 0x%02x\n",state->m_keyboard.last_pressed); + x68k_keyboard_push_scancode(machine(),m_keyboard.last_pressed); + m_keyboard.keytime[m_keyboard.last_pressed] = (m_keyboard.repeat^2)*5+30; + logerror("KB: Holding key 0x%02x\n",m_keyboard.last_pressed); } } - if((machine.root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + if((machine().root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) { - if(state->m_keyboard.keyon[x] == 0) + if(m_keyboard.keyon[x] == 0) { - x68k_keyboard_push_scancode(machine,x); - state->m_keyboard.keytime[x] = state->m_keyboard.delay * 100 + 200; - state->m_keyboard.keyon[x] = 1; - state->m_keyboard.last_pressed = x; + x68k_keyboard_push_scancode(machine(),x); + m_keyboard.keytime[x] = m_keyboard.delay * 100 + 200; + m_keyboard.keyon[x] = 1; + m_keyboard.last_pressed = x; logerror("KB: Pushed key 0x%02x\n",x); } } @@ -634,14 +627,13 @@ static WRITE16_HANDLER( x68k_scc_w ) state->m_scc_prev = scc->get_reg_b(5) & 0x02; } -static TIMER_CALLBACK(x68k_scc_ack) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_scc_ack) { - x68k_state *state = machine.driver_data(); - scc8530_t *scc = machine.device("scc"); - if(state->m_mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty + scc8530_t *scc = machine().device("scc"); + if(m_mouse.bufferempty != 0) // nothing to do if the mouse data buffer is empty return; -// if((state->m_ioc.irqstatus & 0xc0) != 0) +// if((m_ioc.irqstatus & 0xc0) != 0) // return; // hard-code the IRQ vector for now, until the SCC code is more complete @@ -651,10 +643,10 @@ static TIMER_CALLBACK(x68k_scc_ack) { if(scc->get_reg_b(5) & 0x02) // RTS signal { - state->m_mouse.irqactive = 1; - state->m_current_vector[5] = 0x54; - state->m_current_irq_line = 5; - machine.device("maincpu")->execute().set_input_line_and_vector(5,ASSERT_LINE,0x54); + m_mouse.irqactive = 1; + m_current_vector[5] = 0x54; + m_current_irq_line = 5; + machine().device("maincpu")->execute().set_input_line_and_vector(5,ASSERT_LINE,0x54); } } } @@ -725,23 +717,21 @@ static UINT8 md_3button_r(device_t* device, int port) } // Megadrive 6 button gamepad -static TIMER_CALLBACK(md_6button_port1_timeout) +TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port1_timeout) { - x68k_state *state = machine.driver_data(); - state->m_mdctrl.seq1 = 0; + m_mdctrl.seq1 = 0; } -static TIMER_CALLBACK(md_6button_port2_timeout) +TIMER_CALLBACK_MEMBER(x68k_state::md_6button_port2_timeout) { - x68k_state *state = machine.driver_data(); - state->m_mdctrl.seq2 = 0; + m_mdctrl.seq2 = 0; } static void md_6button_init(running_machine &machine) { x68k_state *state = machine.driver_data(); - state->m_mdctrl.io_timeout1 = machine.scheduler().timer_alloc(FUNC(md_6button_port1_timeout)); - state->m_mdctrl.io_timeout2 = machine.scheduler().timer_alloc(FUNC(md_6button_port2_timeout)); + state->m_mdctrl.io_timeout1 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::md_6button_port1_timeout),state)); + state->m_mdctrl.io_timeout2 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::md_6button_port2_timeout),state)); } static UINT8 md_6button_r(device_t* device, int port) @@ -1689,20 +1679,20 @@ static WRITE16_HANDLER( x68k_enh_areaset_w ) logerror("SYS: Enhanced Supervisor area set (from %iMB): 0x%02x\n",(offset + 1) * 2,data & 0xff); } -static TIMER_CALLBACK(x68k_bus_error) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_bus_error) { int val = param; int v; - UINT8 *ram = machine.device(RAM_TAG)->pointer(); + UINT8 *ram = machine().device(RAM_TAG)->pointer(); - if(strcmp(machine.system().name,"x68030") == 0) + if(strcmp(machine().system().name,"x68030") == 0) v = 0x0b; else v = 0x09; if(ram[v] != 0x02) // normal vector for bus errors points to 02FF0540 { - machine.device("maincpu")->execute().set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - machine.device("maincpu")->execute().set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); popmessage("Bus error: Unused RAM access [%08x]", val); } } @@ -1720,7 +1710,7 @@ static READ16_HANDLER( x68k_rom0_r ) offset *= 2; if(ACCESSING_BITS_0_7) offset++; - space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), FUNC(x68k_bus_error), 0xbffffc+offset); + space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),state), 0xbffffc+offset); } return 0xff; } @@ -1738,7 +1728,7 @@ static WRITE16_HANDLER( x68k_rom0_w ) offset *= 2; if(ACCESSING_BITS_0_7) offset++; - space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), FUNC(x68k_bus_error), 0xbffffc+offset); + space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),state), 0xbffffc+offset); } } @@ -1755,7 +1745,7 @@ static READ16_HANDLER( x68k_emptyram_r ) offset *= 2; if(ACCESSING_BITS_0_7) offset++; - space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), FUNC(x68k_bus_error), offset); + space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),state), offset); } return 0xff; } @@ -1773,7 +1763,7 @@ static WRITE16_HANDLER( x68k_emptyram_w ) offset *= 2; if(ACCESSING_BITS_0_7) offset++; - space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), FUNC(x68k_bus_error), offset); + space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(4), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),state), offset); } } @@ -1788,7 +1778,7 @@ static READ16_HANDLER( x68k_exp_r ) offset *= 2; if(ACCESSING_BITS_0_7) offset++; - space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(16), FUNC(x68k_bus_error), 0xeafa00+offset); + space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(16), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),state), 0xeafa00+offset); // machine.device("maincpu")->execute().set_input_line_and_vector(2,ASSERT_LINE,state->m_current_vector[2]); } return 0xffff; @@ -1805,7 +1795,7 @@ static WRITE16_HANDLER( x68k_exp_w ) offset *= 2; if(ACCESSING_BITS_0_7) offset++; - space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(16), FUNC(x68k_bus_error), 0xeafa00+offset); + space.machine().scheduler().timer_set(space.machine().device("maincpu")->cycles_to_attotime(16), timer_expired_delegate(FUNC(x68k_state::x68k_bus_error),state), 0xeafa00+offset); // machine.device("maincpu")->execute().set_input_line_and_vector(2,ASSERT_LINE,state->m_current_vector[2]); } } @@ -2482,13 +2472,12 @@ static void x68k_unload_proc(device_image_interface &image) state->m_fdc.disk_inserted[floppy_get_drive(&image.device())] = 0; } -static TIMER_CALLBACK( x68k_net_irq ) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_net_irq) { - x68k_state *state = machine.driver_data(); - state->m_current_vector[2] = 0xf9; - state->m_current_irq_line = 2; - machine.device("maincpu")->execute().set_input_line_and_vector(2,ASSERT_LINE,state->m_current_vector[2]); + m_current_vector[2] = 0xf9; + m_current_irq_line = 2; + machine().device("maincpu")->execute().set_input_line_and_vector(2,ASSERT_LINE,m_current_vector[2]); } static void x68k_irq2_line(device_t* device,int state) @@ -2708,13 +2697,13 @@ DRIVER_INIT_MEMBER(x68k_state,x68000) // init keyboard m_keyboard.delay = 500; // 3*100+200 m_keyboard.repeat = 110; // 4^2*5+30 - m_kb_timer = machine().scheduler().timer_alloc(FUNC(x68k_keyboard_poll)); - m_scanline_timer = machine().scheduler().timer_alloc(FUNC(x68k_hsync)); - m_raster_irq = machine().scheduler().timer_alloc(FUNC(x68k_crtc_raster_irq)); - m_vblank_irq = machine().scheduler().timer_alloc(FUNC(x68k_crtc_vblank_irq)); - m_mouse_timer = machine().scheduler().timer_alloc(FUNC(x68k_scc_ack)); - m_led_timer = machine().scheduler().timer_alloc(FUNC(x68k_led_callback)); - m_net_timer = machine().scheduler().timer_alloc(FUNC(x68k_net_irq)); + m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_keyboard_poll),this)); + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_hsync),this)); + m_raster_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_crtc_raster_irq),this)); + m_vblank_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_crtc_vblank_irq),this)); + m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_scc_ack),this)); + m_led_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_led_callback),this)); + m_net_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(x68k_state::x68k_net_irq),this)); // Initialise timers for 6-button MD controllers md_6button_init(machine()); diff --git a/src/mess/drivers/xerox820.c b/src/mess/drivers/xerox820.c index 46163de5641..ffc5ac09a6b 100644 --- a/src/mess/drivers/xerox820.c +++ b/src/mess/drivers/xerox820.c @@ -386,10 +386,9 @@ static INPUT_PORTS_START( xerox820 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RIGHT CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) INPUT_PORTS_END -static TIMER_CALLBACK( bigboard_beepoff ) +TIMER_CALLBACK_MEMBER(xerox820_state::bigboard_beepoff) { - xerox820_state *state = machine.driver_data(); - beep_set_state(state->m_beeper, 0); + beep_set_state(m_beeper, 0); } /* Z80 PIO */ @@ -461,7 +460,7 @@ WRITE8_MEMBER( xerox820_state::kbpio_pa_w ) /* beeper on bigboard */ if (BIT(data, 5) & (!m_bit5)) { - machine().scheduler().timer_set(attotime::from_msec(40), FUNC(bigboard_beepoff)); + machine().scheduler().timer_set(attotime::from_msec(40), timer_expired_delegate(FUNC(xerox820_state::bigboard_beepoff),this)); beep_set_state(m_beeper, 1 ); } m_bit5 = BIT(data, 5); diff --git a/src/mess/includes/aim65.h b/src/mess/includes/aim65.h index a6a4dd3e558..55f8435769c 100644 --- a/src/mess/includes/aim65.h +++ b/src/mess/includes/aim65.h @@ -57,6 +57,7 @@ public: required_device m_cass1; required_device m_cass2; virtual void machine_start(); + TIMER_CALLBACK_MEMBER(aim65_printer_timer); }; diff --git a/src/mess/includes/amstrad.h b/src/mess/includes/amstrad.h index d09c7e20b90..2138df11439 100644 --- a/src/mess/includes/amstrad.h +++ b/src/mess/includes/amstrad.h @@ -170,6 +170,9 @@ public: UINT32 screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_amstrad(screen_device &screen, bool state); DECLARE_INPUT_CHANGED_MEMBER(cpc_monitor_changed); + TIMER_CALLBACK_MEMBER(amstrad_pc2_low); + TIMER_CALLBACK_MEMBER(amstrad_video_update_timer); + TIMER_CALLBACK_MEMBER(cb_set_resolution); }; diff --git a/src/mess/includes/apple1.h b/src/mess/includes/apple1.h index 4e5d4e890e4..cf0b78efebb 100644 --- a/src/mess/includes/apple1.h +++ b/src/mess/includes/apple1.h @@ -48,6 +48,10 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(apple1_kbd_poll); + TIMER_CALLBACK_MEMBER(apple1_kbd_strobe_end); + TIMER_CALLBACK_MEMBER(apple1_dsp_ready_start); + TIMER_CALLBACK_MEMBER(apple1_dsp_ready_end); }; diff --git a/src/mess/includes/apple2gs.h b/src/mess/includes/apple2gs.h index 5f6fb740dec..e52f640f5e3 100644 --- a/src/mess/includes/apple2gs.h +++ b/src/mess/includes/apple2gs.h @@ -142,6 +142,9 @@ public: DECLARE_MACHINE_START(apple2gsr1); DECLARE_MACHINE_START(apple2gscommon); UINT32 screen_update_apple2gs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(apple2gs_clock_tick); + TIMER_CALLBACK_MEMBER(apple2gs_qsecond_tick); + TIMER_CALLBACK_MEMBER(apple2gs_scanline_tick); }; diff --git a/src/mess/includes/atarist.h b/src/mess/includes/atarist.h index fbfc8b90e36..a92939e3ead 100644 --- a/src/mess/includes/atarist.h +++ b/src/mess/includes/atarist.h @@ -274,6 +274,10 @@ public: floppy_image_device *floppy_devices[2]; static const floppy_format_type floppy_formats[]; + TIMER_CALLBACK_MEMBER(st_mouse_tick); + TIMER_CALLBACK_MEMBER(atarist_shifter_tick); + TIMER_CALLBACK_MEMBER(atarist_glue_tick); + TIMER_CALLBACK_MEMBER(atarist_blitter_tick); }; class megast_state : public st_state @@ -327,6 +331,9 @@ public: DECLARE_READ8_MEMBER( mfp_gpio_r ); + TIMER_CALLBACK_MEMBER(atariste_dmasound_tick); + TIMER_CALLBACK_MEMBER(atariste_microwire_tick); + void dmasound_set_state(int level); void dmasound_tick(); void microwire_shift(); diff --git a/src/mess/includes/bbc.h b/src/mess/includes/bbc.h index 52fadd1bcd8..3a1c57aacb6 100644 --- a/src/mess/includes/bbc.h +++ b/src/mess/includes/bbc.h @@ -285,6 +285,7 @@ public: INTERRUPT_GEN_MEMBER(bbcb_vsync); INTERRUPT_GEN_MEMBER(bbcb_keyscan); INTERRUPT_GEN_MEMBER(bbcm_keyscan); + TIMER_CALLBACK_MEMBER(bbc_tape_timer_cb); }; diff --git a/src/mess/includes/bebox.h b/src/mess/includes/bebox.h index caac592cbd0..bdcb46c5295 100644 --- a/src/mess/includes/bebox.h +++ b/src/mess/includes/bebox.h @@ -41,6 +41,7 @@ public: DECLARE_DRIVER_INIT(bebox); virtual void machine_start(); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(bebox_get_devices); }; diff --git a/src/mess/includes/beta.h b/src/mess/includes/beta.h index 25742d2bbfb..0c6ded0d9dd 100644 --- a/src/mess/includes/beta.h +++ b/src/mess/includes/beta.h @@ -49,6 +49,7 @@ public: UINT8 m_segment; emu_timer *m_led_refresh_timer; + TIMER_CALLBACK_MEMBER(led_refresh); }; #endif diff --git a/src/mess/includes/bk.h b/src/mess/includes/bk.h index 73257e3863e..faafa357e5a 100644 --- a/src/mess/includes/bk.h +++ b/src/mess/includes/bk.h @@ -37,6 +37,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_bk0010(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(keyboard_callback); }; #endif /* BK_H_ */ diff --git a/src/mess/includes/cgenie.h b/src/mess/includes/cgenie.h index b2ed3fb103a..adb17fad988 100644 --- a/src/mess/includes/cgenie.h +++ b/src/mess/includes/cgenie.h @@ -73,6 +73,7 @@ public: UINT32 screen_update_cgenie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(cgenie_timer_interrupt); INTERRUPT_GEN_MEMBER(cgenie_frame_interrupt); + TIMER_CALLBACK_MEMBER(handle_cassette_input); }; diff --git a/src/mess/includes/coleco.h b/src/mess/includes/coleco.h index 6e898bfcd23..b4be062369a 100644 --- a/src/mess/includes/coleco.h +++ b/src/mess/includes/coleco.h @@ -43,6 +43,9 @@ public: int m_joy_d7_state[2]; UINT8 m_joy_analog_state[2]; UINT8 m_joy_analog_reload[2]; + TIMER_CALLBACK_MEMBER(paddle_d7reset_callback); + TIMER_CALLBACK_MEMBER(paddle_irqreset_callback); + TIMER_CALLBACK_MEMBER(paddle_pulse_callback); }; #endif diff --git a/src/mess/includes/compis.h b/src/mess/includes/compis.h index d905919f527..a2fed45a505 100644 --- a/src/mess/includes/compis.h +++ b/src/mess/includes/compis.h @@ -188,6 +188,8 @@ public: virtual void palette_init(); UINT32 screen_update_compis2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(compis_vblank_int); + TIMER_CALLBACK_MEMBER(internal_timer_int); + TIMER_CALLBACK_MEMBER(dma_timer_callback); }; diff --git a/src/mess/includes/cxhumax.h b/src/mess/includes/cxhumax.h index 2edc045c49d..63d0f9e7742 100644 --- a/src/mess/includes/cxhumax.h +++ b/src/mess/includes/cxhumax.h @@ -152,6 +152,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(timer_tick); }; #define INTDEST 0 // Interrupt destination (1=IRQ, 0=FIQ) diff --git a/src/mess/includes/dai.h b/src/mess/includes/dai.h index 142ecf53745..57a5703d084 100644 --- a/src/mess/includes/dai.h +++ b/src/mess/includes/dai.h @@ -81,6 +81,8 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(dai_bootstrap_callback); + TIMER_CALLBACK_MEMBER(dai_timer); }; diff --git a/src/mess/includes/electron.h b/src/mess/includes/electron.h index 6752c448081..1ff1f02cc72 100644 --- a/src/mess/includes/electron.h +++ b/src/mess/includes/electron.h @@ -75,6 +75,9 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(electron_tape_timer_handler); + TIMER_CALLBACK_MEMBER(setup_beep); + TIMER_CALLBACK_MEMBER(electron_scanline_interrupt); }; diff --git a/src/mess/includes/fm7.h b/src/mess/includes/fm7.h index e55bab7a9c0..271a15390d9 100644 --- a/src/mess/includes/fm7.h +++ b/src/mess/includes/fm7.h @@ -239,6 +239,13 @@ public: DECLARE_MACHINE_START(fm11); DECLARE_MACHINE_START(fm16); UINT32 screen_update_fm7(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(fm7_beeper_off); + TIMER_CALLBACK_MEMBER(fm77av_encoder_ack); + TIMER_CALLBACK_MEMBER(fm7_timer_irq); + TIMER_CALLBACK_MEMBER(fm7_subtimer_irq); + TIMER_CALLBACK_MEMBER(fm7_keyboard_poll); + TIMER_CALLBACK_MEMBER(fm77av_alu_task_end); + TIMER_CALLBACK_MEMBER(fm77av_vsync); }; /*----------- defined in video/fm7.c -----------*/ diff --git a/src/mess/includes/fmtowns.h b/src/mess/includes/fmtowns.h index d9978a85793..b5c52f27126 100644 --- a/src/mess/includes/fmtowns.h +++ b/src/mess/includes/fmtowns.h @@ -276,6 +276,11 @@ class towns_state : public driver_device void wait_end(); public: INTERRUPT_GEN_MEMBER(towns_vsync_irq); + TIMER_CALLBACK_MEMBER(towns_cd_status_ready); + TIMER_CALLBACK_MEMBER(towns_cdrom_read_byte); + TIMER_CALLBACK_MEMBER(towns_delay_cdda); + TIMER_CALLBACK_MEMBER(towns_sprite_done); + TIMER_CALLBACK_MEMBER(towns_vblank_end); }; class marty_state : public towns_state diff --git a/src/mess/includes/galaxy.h b/src/mess/includes/galaxy.h index 37da82ef0f4..3c8dbffc921 100644 --- a/src/mess/includes/galaxy.h +++ b/src/mess/includes/galaxy.h @@ -33,6 +33,7 @@ public: DECLARE_MACHINE_RESET(galaxyp); UINT32 screen_update_galaxy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(galaxy_interrupt); + TIMER_CALLBACK_MEMBER(gal_video); }; diff --git a/src/mess/includes/gamecom.h b/src/mess/includes/gamecom.h index 75f59454e9e..f35683ac061 100644 --- a/src/mess/includes/gamecom.h +++ b/src/mess/includes/gamecom.h @@ -244,6 +244,8 @@ public: virtual void video_start(); virtual void palette_init(); INTERRUPT_GEN_MEMBER(gamecom_interrupt); + TIMER_CALLBACK_MEMBER(gamecom_clock_timer_callback); + TIMER_CALLBACK_MEMBER(gamecom_scanline); }; diff --git a/src/mess/includes/gb.h b/src/mess/includes/gb.h index 4e9808f9c84..112ea2e1b54 100644 --- a/src/mess/includes/gb.h +++ b/src/mess/includes/gb.h @@ -246,6 +246,10 @@ public: DECLARE_MACHINE_START(gb_video); DECLARE_MACHINE_START(gbc_video); INTERRUPT_GEN_MEMBER(gb_scanline_interrupt); + TIMER_CALLBACK_MEMBER(gb_serial_timer_proc); + TIMER_CALLBACK_MEMBER(gb_video_init_vbl); + TIMER_CALLBACK_MEMBER(gb_lcd_timer_proc); + TIMER_CALLBACK_MEMBER(gbc_lcd_timer_proc); }; diff --git a/src/mess/includes/gba.h b/src/mess/includes/gba.h index e155f9500c8..94ece976e86 100644 --- a/src/mess/includes/gba.h +++ b/src/mess/includes/gba.h @@ -240,6 +240,11 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void palette_init(); + TIMER_CALLBACK_MEMBER(dma_complete); + TIMER_CALLBACK_MEMBER(timer_expire); + TIMER_CALLBACK_MEMBER(handle_irq); + TIMER_CALLBACK_MEMBER(perform_hbl); + TIMER_CALLBACK_MEMBER(perform_scan); }; /*----------- defined in video/gba.c -----------*/ diff --git a/src/mess/includes/gp32.h b/src/mess/includes/gp32.h index 7e09a05cdd5..645e62c0fd2 100644 --- a/src/mess/includes/gp32.h +++ b/src/mess/includes/gp32.h @@ -164,6 +164,11 @@ public: virtual void machine_start(); virtual void machine_reset(); UINT32 screen_update_gp32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(s3c240x_lcd_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_pwm_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_dma_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_iic_timer_exp); + TIMER_CALLBACK_MEMBER(s3c240x_iis_timer_exp); }; diff --git a/src/mess/includes/hec2hrp.h b/src/mess/includes/hec2hrp.h index 6eeae173b3e..073f75ff29a 100644 --- a/src/mess/includes/hec2hrp.h +++ b/src/mess/includes/hec2hrp.h @@ -137,6 +137,7 @@ public: DECLARE_MACHINE_START(hec2mdhrx); DECLARE_MACHINE_RESET(hec2mdhrx); UINT32 screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(Callback_CK); }; /*----------- defined in machine/hec2hrp.c -----------*/ diff --git a/src/mess/includes/hp48.h b/src/mess/includes/hp48.h index 2efad289c1c..7286e164de9 100644 --- a/src/mess/includes/hp48.h +++ b/src/mess/includes/hp48.h @@ -78,6 +78,12 @@ public: DECLARE_WRITE8_MEMBER(hp48_io_w); DECLARE_READ8_MEMBER(hp48_io_r); DECLARE_READ8_MEMBER(hp48_bank_r); + TIMER_CALLBACK_MEMBER(hp48_rs232_byte_recv_cb); + TIMER_CALLBACK_MEMBER(hp48_rs232_byte_sent_cb); + TIMER_CALLBACK_MEMBER(hp48_chardev_byte_recv_cb); + TIMER_CALLBACK_MEMBER(hp48_kbd_cb); + TIMER_CALLBACK_MEMBER(hp48_timer1_cb); + TIMER_CALLBACK_MEMBER(hp48_timer2_cb); }; diff --git a/src/mess/includes/intv.h b/src/mess/includes/intv.h index 605113e7de4..bd92507db60 100644 --- a/src/mess/includes/intv.h +++ b/src/mess/includes/intv.h @@ -134,6 +134,9 @@ public: UINT32 screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(intv_interrupt2); INTERRUPT_GEN_MEMBER(intv_interrupt); + TIMER_CALLBACK_MEMBER(intv_interrupt2_complete); + TIMER_CALLBACK_MEMBER(intv_interrupt_complete); + TIMER_CALLBACK_MEMBER(intv_btb_fill); }; /*----------- defined in video/intv.c -----------*/ diff --git a/src/mess/includes/irisha.h b/src/mess/includes/irisha.h index fa14659ecfd..a42c29e0b56 100644 --- a/src/mess/includes/irisha.h +++ b/src/mess/includes/irisha.h @@ -47,6 +47,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(irisha_key); }; diff --git a/src/mess/includes/kaypro.h b/src/mess/includes/kaypro.h index 5b17abf5931..81086510487 100644 --- a/src/mess/includes/kaypro.h +++ b/src/mess/includes/kaypro.h @@ -79,6 +79,7 @@ public: UINT32 screen_update_kaypro2x(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(kay_kbd_interrupt); + TIMER_CALLBACK_MEMBER(kaypro_timer_callback); }; diff --git a/src/mess/includes/kc.h b/src/mess/includes/kc.h index 3176dc26df2..25ca9801a8f 100644 --- a/src/mess/includes/kc.h +++ b/src/mess/includes/kc.h @@ -146,6 +146,8 @@ public: kcexp_slot_device * m_expansions[3]; DECLARE_PALETTE_INIT(kc85); + TIMER_CALLBACK_MEMBER(kc_cassette_oneshot_timer); + TIMER_CALLBACK_MEMBER(kc_cassette_timer_callback); }; diff --git a/src/mess/includes/lisa.h b/src/mess/includes/lisa.h index 614593da754..4682bde8af4 100644 --- a/src/mess/includes/lisa.h +++ b/src/mess/includes/lisa.h @@ -165,6 +165,9 @@ public: virtual void video_start(); UINT32 screen_update_lisa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(lisa_interrupt); + TIMER_CALLBACK_MEMBER(handle_mouse); + TIMER_CALLBACK_MEMBER(read_COPS_command); + TIMER_CALLBACK_MEMBER(set_COPS_ready); }; diff --git a/src/mess/includes/lviv.h b/src/mess/includes/lviv.h index b1e628ceaa8..1539856ceab 100644 --- a/src/mess/includes/lviv.h +++ b/src/mess/includes/lviv.h @@ -27,6 +27,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(lviv_reset); }; diff --git a/src/mess/includes/lynx.h b/src/mess/includes/lynx.h index ab019d5e9b4..033efc3382c 100644 --- a/src/mess/includes/lynx.h +++ b/src/mess/includes/lynx.h @@ -140,6 +140,10 @@ public: virtual void machine_start(); virtual void machine_reset(); virtual void palette_init(); + TIMER_CALLBACK_MEMBER(lynx_blitter_timer); + TIMER_CALLBACK_MEMBER(lynx_timer_shot); + TIMER_CALLBACK_MEMBER(lynx_uart_loopback_timer); + TIMER_CALLBACK_MEMBER(lynx_uart_timer); }; diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h index 29bef81d3c4..ce9159101e6 100644 --- a/src/mess/includes/mac.h +++ b/src/mess/includes/mac.h @@ -523,6 +523,12 @@ public: UINT32 screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(mac_rbv_vbl); + TIMER_CALLBACK_MEMBER(kbd_clock); + TIMER_CALLBACK_MEMBER(inquiry_timeout_func); + TIMER_CALLBACK_MEMBER(mac_6015_tick); + TIMER_CALLBACK_MEMBER(mac_scanline_tick); + TIMER_CALLBACK_MEMBER(dafb_vbl_tick); + TIMER_CALLBACK_MEMBER(dafb_cursor_tick); }; #endif /* MAC_H_ */ diff --git a/src/mess/includes/macpci.h b/src/mess/includes/macpci.h index df88bcc94b4..b1acd5ef89d 100644 --- a/src/mess/includes/macpci.h +++ b/src/mess/includes/macpci.h @@ -158,6 +158,7 @@ private: public: emu_timer *m_scanline_timer; UINT32 screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(mac_6015_tick); }; #endif /* PCIMAC_H_ */ diff --git a/src/mess/includes/mbc55x.h b/src/mess/includes/mbc55x.h index e0d0a6067f4..8d8dc3a8ba2 100644 --- a/src/mess/includes/mbc55x.h +++ b/src/mess/includes/mbc55x.h @@ -157,6 +157,7 @@ public: virtual void video_reset(); virtual void palette_init(); void screen_eof_mbc55x(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(keyscan_callback); }; /* IO chips */ diff --git a/src/mess/includes/mbee.h b/src/mess/includes/mbee.h index c27d66b7672..58cc964f379 100644 --- a/src/mess/includes/mbee.h +++ b/src/mess/includes/mbee.h @@ -142,6 +142,9 @@ public: DECLARE_MACHINE_RESET(mbeett); UINT32 screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(mbee_interrupt); + TIMER_CALLBACK_MEMBER(mbee256_kbd); + TIMER_CALLBACK_MEMBER(mbee_rtc_irq); + TIMER_CALLBACK_MEMBER(mbee_reset); }; diff --git a/src/mess/includes/microtan.h b/src/mess/includes/microtan.h index f3277a2c465..01330509793 100644 --- a/src/mess/includes/microtan.h +++ b/src/mess/includes/microtan.h @@ -53,6 +53,8 @@ public: virtual void video_start(); UINT32 screen_update_microtan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(microtan_interrupt); + TIMER_CALLBACK_MEMBER(microtan_read_cassette); + TIMER_CALLBACK_MEMBER(microtan_pulse_nmi); }; diff --git a/src/mess/includes/mikro80.h b/src/mess/includes/mikro80.h index 1b94982e1ac..70f1d34783a 100644 --- a/src/mess/includes/mikro80.h +++ b/src/mess/includes/mikro80.h @@ -34,6 +34,7 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(mikro80_reset); }; diff --git a/src/mess/includes/mpf1.h b/src/mess/includes/mpf1.h index 638e80554b8..a761abd2bc9 100644 --- a/src/mess/includes/mpf1.h +++ b/src/mess/includes/mpf1.h @@ -55,6 +55,7 @@ public: emu_timer *m_led_refresh_timer; DECLARE_DRIVER_INIT(mpf1); + TIMER_CALLBACK_MEMBER(led_refresh); }; #endif diff --git a/src/mess/includes/nc.h b/src/mess/includes/nc.h index f100470e170..0dd1444d448 100644 --- a/src/mess/includes/nc.h +++ b/src/mess/includes/nc.h @@ -80,6 +80,8 @@ public: DECLARE_MACHINE_START(nc200); DECLARE_MACHINE_RESET(nc200); UINT32 screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(nc_keyboard_timer_callback); + TIMER_CALLBACK_MEMBER(nc_serial_timer_callback); }; diff --git a/src/mess/includes/nes.h b/src/mess/includes/nes.h index dc4a81a0135..d8f742d5428 100644 --- a/src/mess/includes/nes.h +++ b/src/mess/includes/nes.h @@ -124,6 +124,8 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(nes_irq_callback); + TIMER_CALLBACK_MEMBER(lightgun_tick); }; /*----------- defined in machine/nes.c -----------*/ diff --git a/src/mess/includes/odyssey2.h b/src/mess/includes/odyssey2.h index 514047e869a..d248b919b05 100644 --- a/src/mess/includes/odyssey2.h +++ b/src/mess/includes/odyssey2.h @@ -115,6 +115,8 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_odyssey2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(i824x_scanline_callback); + TIMER_CALLBACK_MEMBER(i824x_hblank_callback); }; diff --git a/src/mess/includes/ondra.h b/src/mess/includes/ondra.h index 2195e1bf324..427441c4763 100644 --- a/src/mess/includes/ondra.h +++ b/src/mess/includes/ondra.h @@ -25,6 +25,7 @@ public: virtual void video_start(); UINT32 screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(ondra_interrupt); + TIMER_CALLBACK_MEMBER(nmi_check_callback); }; #endif diff --git a/src/mess/includes/oric.h b/src/mess/includes/oric.h index 85c2ec8ac4b..d8b4243fd7f 100644 --- a/src/mess/includes/oric.h +++ b/src/mess/includes/oric.h @@ -108,6 +108,8 @@ public: virtual void palette_init(); DECLARE_MACHINE_START(telestrat); UINT32 screen_update_oric(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(oric_refresh_tape); + TIMER_CALLBACK_MEMBER(oric_vh_timer_callback); }; /*----------- defined in machine/oric.c -----------*/ diff --git a/src/mess/includes/osborne1.h b/src/mess/includes/osborne1.h index 5d5c33ac646..6dea71cc926 100644 --- a/src/mess/includes/osborne1.h +++ b/src/mess/includes/osborne1.h @@ -82,6 +82,8 @@ public: DECLARE_DRIVER_INIT(osborne1); virtual void machine_reset(); virtual void palette_init(); + TIMER_CALLBACK_MEMBER(osborne1_video_callback); + TIMER_CALLBACK_MEMBER(setup_osborne1); }; diff --git a/src/mess/includes/osi.h b/src/mess/includes/osi.h index 0dcc6138eb8..4a8395225e1 100644 --- a/src/mess/includes/osi.h +++ b/src/mess/includes/osi.h @@ -64,6 +64,7 @@ public: /* floppy state */ int m_fdc_index; + TIMER_CALLBACK_MEMBER(setup_beep); }; class c1p_state : public sb2m600_state diff --git a/src/mess/includes/pc.h b/src/mess/includes/pc.h index 0d724fe1cdd..d949e037616 100644 --- a/src/mess/includes/pc.h +++ b/src/mess/includes/pc.h @@ -86,6 +86,10 @@ public: DECLARE_MACHINE_START(pcjr); DECLARE_MACHINE_RESET(pcjr); DECLARE_MACHINE_START(mc1502); + TIMER_CALLBACK_MEMBER(pcjr_delayed_pic8259_irq); + TIMER_CALLBACK_MEMBER(pcjr_keyb_signal_callback); + TIMER_CALLBACK_MEMBER(mc1502_keyb_signal_callback); + TIMER_CALLBACK_MEMBER(pc_rtc_timer); }; /*----------- defined in machine/pc.c -----------*/ diff --git a/src/mess/includes/pc1251.h b/src/mess/includes/pc1251.h index 0fa894a190e..3bd20c84ebf 100644 --- a/src/mess/includes/pc1251.h +++ b/src/mess/includes/pc1251.h @@ -27,6 +27,7 @@ public: DECLARE_DRIVER_INIT(pc1251); UINT32 screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pc1251_power_up); }; diff --git a/src/mess/includes/pc1350.h b/src/mess/includes/pc1350.h index 1603afc2b18..acf981affbf 100644 --- a/src/mess/includes/pc1350.h +++ b/src/mess/includes/pc1350.h @@ -25,6 +25,7 @@ public: int m_power; UINT8 m_reg[0x1000]; UINT32 screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pc1350_power_up); }; diff --git a/src/mess/includes/pc1401.h b/src/mess/includes/pc1401.h index 3be86862f39..e0e66d6c202 100644 --- a/src/mess/includes/pc1401.h +++ b/src/mess/includes/pc1401.h @@ -27,6 +27,7 @@ public: UINT8 m_reg[0x100]; DECLARE_DRIVER_INIT(pc1401); UINT32 screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pc1401_power_up); }; diff --git a/src/mess/includes/pc1403.h b/src/mess/includes/pc1403.h index b7b2494d36c..a7b88c10408 100644 --- a/src/mess/includes/pc1403.h +++ b/src/mess/includes/pc1403.h @@ -30,6 +30,7 @@ public: DECLARE_DRIVER_INIT(pc1403); UINT32 screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pc1403_power_up); }; diff --git a/src/mess/includes/pce.h b/src/mess/includes/pce.h index e9e870ed744..8242b1c490d 100644 --- a/src/mess/includes/pce.h +++ b/src/mess/includes/pce.h @@ -142,6 +142,13 @@ public: UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_MACHINE_START(pce); DECLARE_MACHINE_RESET(mess_pce); + TIMER_CALLBACK_MEMBER(pce_cd_data_timer_callback); + TIMER_CALLBACK_MEMBER(pce_cd_cdda_fadeout_callback); + TIMER_CALLBACK_MEMBER(pce_cd_cdda_fadein_callback); + TIMER_CALLBACK_MEMBER(pce_cd_adpcm_fadeout_callback); + TIMER_CALLBACK_MEMBER(pce_cd_adpcm_fadein_callback); + TIMER_CALLBACK_MEMBER(pce_cd_clear_ack); + TIMER_CALLBACK_MEMBER(pce_cd_adpcm_dma_timer_callback); }; diff --git a/src/mess/includes/pcw.h b/src/mess/includes/pcw.h index fbde9538ed4..f87c7e6ff49 100644 --- a/src/mess/includes/pcw.h +++ b/src/mess/includes/pcw.h @@ -101,6 +101,10 @@ public: virtual void palette_init(); UINT32 screen_update_pcw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_pcw_printer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pcw_timer_pulse); + TIMER_CALLBACK_MEMBER(pcw_stepper_callback); + TIMER_CALLBACK_MEMBER(pcw_pins_callback); + TIMER_CALLBACK_MEMBER(setup_beep); }; #endif /* PCW_H_ */ diff --git a/src/mess/includes/pdp1.h b/src/mess/includes/pdp1.h index 9871f6ae235..1e907ffc6fc 100644 --- a/src/mess/includes/pdp1.h +++ b/src/mess/includes/pdp1.h @@ -262,6 +262,11 @@ public: UINT32 screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_pdp1(screen_device &screen, bool state); INTERRUPT_GEN_MEMBER(pdp1_interrupt); + TIMER_CALLBACK_MEMBER(reader_callback); + TIMER_CALLBACK_MEMBER(puncher_callback); + TIMER_CALLBACK_MEMBER(tyo_callback); + TIMER_CALLBACK_MEMBER(dpy_callback); + TIMER_CALLBACK_MEMBER(il_timer_callback); }; /*----------- defined in video/pdp1.c -----------*/ diff --git a/src/mess/includes/pecom.h b/src/mess/includes/pecom.h index 18c1f33777d..e5c351c69c0 100644 --- a/src/mess/includes/pecom.h +++ b/src/mess/includes/pecom.h @@ -40,6 +40,7 @@ public: virtual void machine_reset(); DECLARE_VIDEO_START(pecom); DECLARE_INPUT_CHANGED_MEMBER(ef_w); + TIMER_CALLBACK_MEMBER(reset_tick); }; /*----------- defined in machine/pecom.c -----------*/ diff --git a/src/mess/includes/pet.h b/src/mess/includes/pet.h index d9fda31cd52..5bfb40bede5 100644 --- a/src/mess/includes/pet.h +++ b/src/mess/includes/pet.h @@ -57,6 +57,9 @@ public: DECLARE_VIDEO_START(pet_crtc); UINT32 screen_update_pet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(pet_frame_interrupt); + TIMER_CALLBACK_MEMBER(pet_interrupt); + TIMER_CALLBACK_MEMBER(pet_tape1_timer); + TIMER_CALLBACK_MEMBER(pet_tape2_timer); }; /*----------- defined in video/pet.c -----------*/ diff --git a/src/mess/includes/pmd85.h b/src/mess/includes/pmd85.h index d6df21cea0d..ab0120e2df8 100644 --- a/src/mess/includes/pmd85.h +++ b/src/mess/includes/pmd85.h @@ -40,6 +40,9 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback); + TIMER_CALLBACK_MEMBER(pmd_reset); + TIMER_CALLBACK_MEMBER(setup_machine_state); }; diff --git a/src/mess/includes/pokemini.h b/src/mess/includes/pokemini.h index 958b70f4410..71202ba6b46 100644 --- a/src/mess/includes/pokemini.h +++ b/src/mess/includes/pokemini.h @@ -64,6 +64,15 @@ public: UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual void palette_init(); + TIMER_CALLBACK_MEMBER(pokemini_seconds_timer_callback); + TIMER_CALLBACK_MEMBER(pokemini_256hz_timer_callback); + TIMER_CALLBACK_MEMBER(pokemini_timer1_callback); + TIMER_CALLBACK_MEMBER(pokemini_timer1_hi_callback); + TIMER_CALLBACK_MEMBER(pokemini_timer2_callback); + TIMER_CALLBACK_MEMBER(pokemini_timer2_hi_callback); + TIMER_CALLBACK_MEMBER(pokemini_timer3_callback); + TIMER_CALLBACK_MEMBER(pokemini_timer3_hi_callback); + TIMER_CALLBACK_MEMBER(pokemini_prc_counter_callback); }; diff --git a/src/mess/includes/poly88.h b/src/mess/includes/poly88.h index 9947b6c9a47..87822084b78 100644 --- a/src/mess/includes/poly88.h +++ b/src/mess/includes/poly88.h @@ -35,6 +35,10 @@ public: virtual void video_start(); UINT32 screen_update_poly88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(poly88_interrupt); + TIMER_CALLBACK_MEMBER(poly88_usart_timer_callback); + TIMER_CALLBACK_MEMBER(keyboard_callback); + TIMER_CALLBACK_MEMBER(poly88_cassette_timer_callback); + TIMER_CALLBACK_MEMBER(setup_machine_state); }; diff --git a/src/mess/includes/radio86.h b/src/mess/includes/radio86.h index a9024886d76..e4696b3adfd 100644 --- a/src/mess/includes/radio86.h +++ b/src/mess/includes/radio86.h @@ -39,6 +39,7 @@ public: DECLARE_MACHINE_RESET(radio86); DECLARE_PALETTE_INIT(radio86); UINT32 screen_update_radio86(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(radio86_reset); }; diff --git a/src/mess/includes/rm380z.h b/src/mess/includes/rm380z.h index f5e9de2cf65..757963a0819 100644 --- a/src/mess/includes/rm380z.h +++ b/src/mess/includes/rm380z.h @@ -125,6 +125,7 @@ public: int keyboard_decode(); void update_screen(bitmap_ind16 &bitmap); UINT32 screen_update_rm380z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(static_vblank_timer); }; diff --git a/src/mess/includes/rmnimbus.h b/src/mess/includes/rmnimbus.h index c7565a5a2d1..a90f54ba636 100644 --- a/src/mess/includes/rmnimbus.h +++ b/src/mess/includes/rmnimbus.h @@ -228,6 +228,10 @@ public: virtual void palette_init(); UINT32 screen_update_nimbus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_nimbus(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(internal_timer_int); + TIMER_CALLBACK_MEMBER(dma_timer_callback); + TIMER_CALLBACK_MEMBER(keyscan_callback); + TIMER_CALLBACK_MEMBER(mouse_callback); }; diff --git a/src/mess/includes/samcoupe.h b/src/mess/includes/samcoupe.h index a38e0b5188a..0be6ec6b588 100644 --- a/src/mess/includes/samcoupe.h +++ b/src/mess/includes/samcoupe.h @@ -83,6 +83,9 @@ public: virtual void machine_reset(); virtual void palette_init(); INTERRUPT_GEN_MEMBER(samcoupe_frame_interrupt); + TIMER_CALLBACK_MEMBER(irq_off); + TIMER_CALLBACK_MEMBER(samcoupe_mouse_reset); + TIMER_CALLBACK_MEMBER(sam_video_update_callback); }; diff --git a/src/mess/includes/sg1000.h b/src/mess/includes/sg1000.h index 4b425a458ec..bae777db184 100644 --- a/src/mess/includes/sg1000.h +++ b/src/mess/includes/sg1000.h @@ -72,6 +72,7 @@ public: /* TV Draw state */ UINT8 m_tvdraw_data; + TIMER_CALLBACK_MEMBER(lightgun_tick); }; class sc3000_state : public sg1000_state diff --git a/src/mess/includes/sms.h b/src/mess/includes/sms.h index 290bde97e11..11c280bb845 100644 --- a/src/mess/includes/sms.h +++ b/src/mess/includes/sms.h @@ -186,6 +186,10 @@ public: UINT32 screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_INPUT_CHANGED_MEMBER(lgun1_changed); DECLARE_INPUT_CHANGED_MEMBER(lgun2_changed); + TIMER_CALLBACK_MEMBER(rapid_fire_callback); + TIMER_CALLBACK_MEMBER(lightgun_tick); + TIMER_CALLBACK_MEMBER(lphaser_1_callback); + TIMER_CALLBACK_MEMBER(lphaser_2_callback); }; diff --git a/src/mess/includes/sorcerer.h b/src/mess/includes/sorcerer.h index 2822f20edaa..01f0a2036be 100644 --- a/src/mess/includes/sorcerer.h +++ b/src/mess/includes/sorcerer.h @@ -86,6 +86,9 @@ public: virtual void machine_start(); virtual void machine_reset(); DECLARE_MACHINE_START(sorcererd); + TIMER_CALLBACK_MEMBER(sorcerer_serial_tc); + TIMER_CALLBACK_MEMBER(sorcerer_cassette_tc); + TIMER_CALLBACK_MEMBER(sorcerer_reset); }; diff --git a/src/mess/includes/special.h b/src/mess/includes/special.h index 38f74b3dc73..512423606b1 100644 --- a/src/mess/includes/special.h +++ b/src/mess/includes/special.h @@ -94,6 +94,8 @@ public: UINT32 screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(special_reset); + TIMER_CALLBACK_MEMBER(setup_pit8253_gates); }; diff --git a/src/mess/includes/studio2.h b/src/mess/includes/studio2.h index 146228996e5..2eab34b441c 100644 --- a/src/mess/includes/studio2.h +++ b/src/mess/includes/studio2.h @@ -49,6 +49,7 @@ public: /* keyboard state */ UINT8 m_keylatch; DECLARE_DRIVER_INIT(studio2); + TIMER_CALLBACK_MEMBER(setup_beep); }; class visicom_state : public studio2_state diff --git a/src/mess/includes/super80.h b/src/mess/includes/super80.h index b3d69d953b8..bad31dcc438 100644 --- a/src/mess/includes/super80.h +++ b/src/mess/includes/super80.h @@ -86,6 +86,9 @@ public: UINT32 screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_super80m(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(super80_timer); + TIMER_CALLBACK_MEMBER(super80_reset); + TIMER_CALLBACK_MEMBER(super80_halfspeed); }; diff --git a/src/mess/includes/svision.h b/src/mess/includes/svision.h index 7b3668c5264..4f22b33e134 100644 --- a/src/mess/includes/svision.h +++ b/src/mess/includes/svision.h @@ -57,6 +57,8 @@ public: UINT32 screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_tvlink(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(svision_frame_int); + TIMER_CALLBACK_MEMBER(svision_pet_timer); + TIMER_CALLBACK_MEMBER(svision_timer); }; diff --git a/src/mess/includes/sym1.h b/src/mess/includes/sym1.h index 607f1adfc5e..f4cd88613d7 100644 --- a/src/mess/includes/sym1.h +++ b/src/mess/includes/sym1.h @@ -41,6 +41,7 @@ public: emu_timer *m_led_update; DECLARE_DRIVER_INIT(sym1); virtual void machine_reset(); + TIMER_CALLBACK_MEMBER(led_refresh); }; /*----------- defined in machine/sym1.c -----------*/ diff --git a/src/mess/includes/ti85.h b/src/mess/includes/ti85.h index aa6d495f083..4da9813df6d 100644 --- a/src/mess/includes/ti85.h +++ b/src/mess/includes/ti85.h @@ -102,6 +102,7 @@ public: DECLARE_MACHINE_START(ti86); DECLARE_MACHINE_START(ti83p); UINT32 screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(ti85_timer_callback); }; diff --git a/src/mess/includes/tmc1800.h b/src/mess/includes/tmc1800.h index 2a492efa7c1..56db14635c2 100644 --- a/src/mess/includes/tmc1800.h +++ b/src/mess/includes/tmc1800.h @@ -49,6 +49,7 @@ public: /* keyboard state */ int m_keylatch; /* key latch */ DECLARE_DRIVER_INIT(tmc1800); + TIMER_CALLBACK_MEMBER(setup_beep); }; class osc1000b_state : public driver_device diff --git a/src/mess/includes/trs80.h b/src/mess/includes/trs80.h index b593553d7d7..fab02d71e2c 100644 --- a/src/mess/includes/trs80.h +++ b/src/mess/includes/trs80.h @@ -124,6 +124,7 @@ public: UINT32 screen_update_meritum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(trs80_rtc_interrupt); INTERRUPT_GEN_MEMBER(trs80_fdc_interrupt); + TIMER_CALLBACK_MEMBER(cassette_data_callback); }; diff --git a/src/mess/includes/tx0.h b/src/mess/includes/tx0.h index 60f1a637cf2..5d2eed03669 100644 --- a/src/mess/includes/tx0.h +++ b/src/mess/includes/tx0.h @@ -153,6 +153,10 @@ public: UINT32 screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_tx0(screen_device &screen, bool state); INTERRUPT_GEN_MEMBER(tx0_interrupt); + TIMER_CALLBACK_MEMBER(reader_callback); + TIMER_CALLBACK_MEMBER(puncher_callback); + TIMER_CALLBACK_MEMBER(prt_callback); + TIMER_CALLBACK_MEMBER(dis_callback); }; diff --git a/src/mess/includes/ut88.h b/src/mess/includes/ut88.h index e875cd825db..631f874ff6c 100644 --- a/src/mess/includes/ut88.h +++ b/src/mess/includes/ut88.h @@ -48,6 +48,8 @@ public: DECLARE_MACHINE_START(ut88mini); DECLARE_MACHINE_RESET(ut88mini); UINT32 screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(ut88_reset); + TIMER_CALLBACK_MEMBER(update_display); }; diff --git a/src/mess/includes/vector06.h b/src/mess/includes/vector06.h index 582fd6f3188..16614ad78f8 100644 --- a/src/mess/includes/vector06.h +++ b/src/mess/includes/vector06.h @@ -65,6 +65,7 @@ public: virtual void palette_init(); UINT32 screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vector06_interrupt); + TIMER_CALLBACK_MEMBER(reset_check_callback); }; diff --git a/src/mess/includes/wswan.h b/src/mess/includes/wswan.h index 9dce3291da7..6ba9e45d41f 100644 --- a/src/mess/includes/wswan.h +++ b/src/mess/includes/wswan.h @@ -157,6 +157,8 @@ public: virtual void palette_init(); DECLARE_MACHINE_START(wscolor); DECLARE_PALETTE_INIT(wscolor); + TIMER_CALLBACK_MEMBER(wswan_rtc_callback); + TIMER_CALLBACK_MEMBER(wswan_scanline_interrupt); }; diff --git a/src/mess/includes/x07.h b/src/mess/includes/x07.h index 8d4a0fbedbc..6987ea9d302 100644 --- a/src/mess/includes/x07.h +++ b/src/mess/includes/x07.h @@ -260,4 +260,9 @@ public: UINT8 m_prn_buffer[0x100]; UINT8 m_prn_size; virtual void palette_init(); + TIMER_CALLBACK_MEMBER(cassette_tick); + TIMER_CALLBACK_MEMBER(cassette_poll); + TIMER_CALLBACK_MEMBER(rsta_clear); + TIMER_CALLBACK_MEMBER(rstb_clear); + TIMER_CALLBACK_MEMBER(beep_stop); }; diff --git a/src/mess/includes/x1.h b/src/mess/includes/x1.h index ebdd255ccb5..1e4c19c2c2a 100644 --- a/src/mess/includes/x1.h +++ b/src/mess/includes/x1.h @@ -202,6 +202,7 @@ public: UINT32 screen_update_x1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_INPUT_CHANGED_MEMBER(ipl_reset); DECLARE_INPUT_CHANGED_MEMBER(nmi_reset); + TIMER_CALLBACK_MEMBER(x1_rtc_increment); }; diff --git a/src/mess/includes/x68k.h b/src/mess/includes/x68k.h index 3b665ba601d..1fbe2e38755 100644 --- a/src/mess/includes/x68k.h +++ b/src/mess/includes/x68k.h @@ -268,6 +268,23 @@ public: DECLARE_PALETTE_INIT(x68000); UINT32 screen_update_x68000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(x68k_vsync_irq); + TIMER_CALLBACK_MEMBER(mfp_update_irq); + TIMER_CALLBACK_MEMBER(mfp_timer_a_callback); + TIMER_CALLBACK_MEMBER(mfp_timer_b_callback); + TIMER_CALLBACK_MEMBER(mfp_timer_c_callback); + TIMER_CALLBACK_MEMBER(mfp_timer_d_callback); + TIMER_CALLBACK_MEMBER(x68k_led_callback); + TIMER_CALLBACK_MEMBER(x68k_keyboard_poll); + TIMER_CALLBACK_MEMBER(x68k_scc_ack); + TIMER_CALLBACK_MEMBER(md_6button_port1_timeout); + TIMER_CALLBACK_MEMBER(md_6button_port2_timeout); + TIMER_CALLBACK_MEMBER(x68k_bus_error); + TIMER_CALLBACK_MEMBER(x68k_net_irq); + TIMER_CALLBACK_MEMBER(x68k_crtc_operation_end); + TIMER_CALLBACK_MEMBER(x68k_hsync); + TIMER_CALLBACK_MEMBER(x68k_crtc_raster_end); + TIMER_CALLBACK_MEMBER(x68k_crtc_raster_irq); + TIMER_CALLBACK_MEMBER(x68k_crtc_vblank_irq); }; diff --git a/src/mess/includes/xerox820.h b/src/mess/includes/xerox820.h index eebeb9b7040..1275fb290d0 100644 --- a/src/mess/includes/xerox820.h +++ b/src/mess/includes/xerox820.h @@ -82,6 +82,7 @@ public: int m_fdc_drq; /* data request */ int m_8n5; /* 5.25" / 8" drive select */ int m_dsdd; /* double sided disk detect */ + TIMER_CALLBACK_MEMBER(bigboard_beepoff); }; class xerox820ii_state : public xerox820_state diff --git a/src/mess/includes/z80ne.h b/src/mess/includes/z80ne.h index 55c9c6e5408..2199b76e346 100644 --- a/src/mess/includes/z80ne.h +++ b/src/mess/includes/z80ne.h @@ -106,6 +106,8 @@ public: DECLARE_MACHINE_RESET(z80ne_base); DECLARE_INPUT_CHANGED_MEMBER(z80ne_reset); DECLARE_INPUT_CHANGED_MEMBER(z80ne_nmi); + TIMER_CALLBACK_MEMBER(z80ne_cassette_tc); + TIMER_CALLBACK_MEMBER(z80ne_kbd_scan); }; diff --git a/src/mess/includes/zx.h b/src/mess/includes/zx.h index b18877253b6..c1b2c89425d 100644 --- a/src/mess/includes/zx.h +++ b/src/mess/includes/zx.h @@ -58,6 +58,9 @@ public: DECLARE_MACHINE_RESET(pc8300); DECLARE_MACHINE_RESET(pow3000); void screen_eof_zx(screen_device &screen, bool state); + TIMER_CALLBACK_MEMBER(zx_tape_pulse); + TIMER_CALLBACK_MEMBER(zx_ula_nmi); + TIMER_CALLBACK_MEMBER(zx_ula_irq); }; /*----------- defined in video/zx.c -----------*/ diff --git a/src/mess/machine/aim65.c b/src/mess/machine/aim65.c index fa65a95df30..2c5f651d016 100644 --- a/src/mess/machine/aim65.c +++ b/src/mess/machine/aim65.c @@ -300,42 +300,41 @@ DRIVER_MEMBER(aim65_state, aim65_printer_on), // out CB2 */ -static TIMER_CALLBACK(aim65_printer_timer) +TIMER_CALLBACK_MEMBER(aim65_state::aim65_printer_timer) { - aim65_state *state = machine.driver_data(); - via6522_device *via_0 = machine.device("via6522_0"); + via6522_device *via_0 = machine().device("via6522_0"); - via_0->write_cb1(state->m_printer_level); - via_0->write_cb1(!state->m_printer_level); - state->m_printer_level ^= 1; + via_0->write_cb1(m_printer_level); + via_0->write_cb1(!m_printer_level); + m_printer_level ^= 1; - if (state->m_printer_dir) + if (m_printer_dir) { - if (state->m_printer_x > 0) - state->m_printer_x--; + if (m_printer_x > 0) + m_printer_x--; else { - state->m_printer_dir = 0; - state->m_printer_x++; - state->m_printer_y++; + m_printer_dir = 0; + m_printer_x++; + m_printer_y++; } } else { - if (state->m_printer_x < 9) - state->m_printer_x++; + if (m_printer_x < 9) + m_printer_x++; else { - state->m_printer_dir = 1; - state->m_printer_x--; - state->m_printer_y++; + m_printer_dir = 1; + m_printer_x--; + m_printer_y++; } } - if (state->m_printer_y > 500) state->m_printer_y = 0; + if (m_printer_y > 500) m_printer_y = 0; - state->m_flag_a=0; - state->m_flag_b=0; + m_flag_a=0; + m_flag_b=0; } @@ -369,7 +368,7 @@ WRITE8_MEMBER( aim65_state::aim65_pa_w ) VIDEO_START_MEMBER(aim65_state,aim65) { - m_print_timer = machine().scheduler().timer_alloc(FUNC(aim65_printer_timer)); + m_print_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aim65_state::aim65_printer_timer),this)); m_printerRAM = auto_alloc_array(machine(), UINT16, (600 * 10 * 2) / 2); memset(m_printerRAM, 0, videoram_size); VIDEO_START_CALL_MEMBER(generic); diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c index 8a6066b441d..f0497f37588 100644 --- a/src/mess/machine/amstrad.c +++ b/src/mess/machine/amstrad.c @@ -227,10 +227,9 @@ WRITE_LINE_DEVICE_HANDLER( aleste_interrupt ) /* Some games set the 8255 to mode 1 and expect a strobe signal */ /* on PC2. Apparently PC2 is always low on the CPC. ?!? */ -static TIMER_CALLBACK(amstrad_pc2_low) +TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_pc2_low) { - amstrad_state *state = machine.driver_data(); - state->m_ppi->pc2_w(0); + m_ppi->pc2_w(0); } @@ -578,12 +577,12 @@ static void amstrad_plus_handle_dma(running_machine &machine) amstrad_plus_dma_parse( machine, 2 ); } -static TIMER_CALLBACK(amstrad_video_update_timer) +TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_video_update_timer) { if(param == 1) - amstrad_plus_update_video(machine); + amstrad_plus_update_video(machine()); else - amstrad_update_video(machine); + amstrad_update_video(machine()); } /* Set the new colour from the GateArray */ @@ -594,7 +593,7 @@ static void amstrad_vh_update_colour(running_machine &machine, int PenIndex, UIN { int val; - machine.scheduler().timer_set( attotime::from_usec(0), FUNC(amstrad_video_update_timer),1); + machine.scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),state),1); /* CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette */ val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; /* red */ @@ -605,7 +604,7 @@ static void amstrad_vh_update_colour(running_machine &machine, int PenIndex, UIN } else { - machine.scheduler().timer_set( attotime::from_usec(0), FUNC(amstrad_video_update_timer),0); + machine.scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),state),0); } state->m_GateArray_render_colours[PenIndex] = hw_colour_index; } @@ -614,7 +613,7 @@ static void amstrad_vh_update_colour(running_machine &machine, int PenIndex, UIN static void aleste_vh_update_colour(running_machine &machine, int PenIndex, UINT16 hw_colour_index) { amstrad_state *state = machine.driver_data(); - machine.scheduler().timer_set( attotime::from_usec(0), FUNC(amstrad_video_update_timer),0); + machine.scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),state),0); state->m_GateArray_render_colours[PenIndex] = hw_colour_index+32; } @@ -969,7 +968,7 @@ static WRITE_LINE_DEVICE_HANDLER( amstrad_vsync_changed ) drvstate->m_gate_array.vsync = state ? 1 : 0; /* Schedule a write to PC2 */ - device->machine().scheduler().timer_set( attotime::zero, FUNC(amstrad_pc2_low)); + device->machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),drvstate)); } @@ -992,7 +991,7 @@ static WRITE_LINE_DEVICE_HANDLER( amstrad_plus_vsync_changed ) drvstate->m_gate_array.vsync = state ? 1 : 0; /* Schedule a write to PC2 */ - device->machine().scheduler().timer_set( attotime::zero, FUNC(amstrad_pc2_low)); + device->machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),drvstate)); } @@ -2041,9 +2040,9 @@ WRITE8_MEMBER(amstrad_state::amstrad_cpc_io_w) break; case 0x01: /* Write to selected internal 6845 register Write Only */ if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - machine().scheduler().timer_set( attotime::from_usec(0), FUNC(amstrad_video_update_timer),1); + machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),1); else - machine().scheduler().timer_set( attotime::from_usec(0), FUNC(amstrad_video_update_timer),0); + machine().scheduler().timer_set( attotime::from_usec(0), timer_expired_delegate(FUNC(amstrad_state::amstrad_video_update_timer),this),0); mc6845->register_w( space, 0, data ); /* printer port bit 8 */ @@ -2582,7 +2581,7 @@ READ8_DEVICE_HANDLER (amstrad_ppi_portb_r) logerror("amstrad_ppi_portb_r\n"); /* Schedule a write to PC2 */ - space.machine().scheduler().timer_set( attotime::zero, FUNC(amstrad_pc2_low)); + space.machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),state)); return data; } @@ -2912,15 +2911,14 @@ static void amstrad_common_init(running_machine &machine) state->m_maincpu->set_irq_acknowledge_callback(amstrad_cpu_acknowledge_int); } -static TIMER_CALLBACK( cb_set_resolution ) +TIMER_CALLBACK_MEMBER(amstrad_state::cb_set_resolution) { - amstrad_state *state = machine.driver_data(); -// screen_device *screen = downcast(state->m_screen); +// screen_device *screen = downcast(m_screen); rectangle visarea; attoseconds_t refresh; int height; - if ( machine.root_device().ioport( "solder_links" )->read() & 0x10 ) + if ( machine().root_device().ioport( "solder_links" )->read() & 0x10 ) { /* PAL */ visarea.set(0, 64 + 640 + 64 - 1, 34, 34 + 15 + 242 + 15 - 1); @@ -2933,7 +2931,7 @@ static TIMER_CALLBACK( cb_set_resolution ) height = 262; } refresh = HZ_TO_ATTOSECONDS( XTAL_16MHz ) * 1024 * height; - state->m_screen->configure( 1024, height, visarea, refresh ); + m_screen->configure( 1024, height, visarea, refresh ); } @@ -2963,7 +2961,7 @@ MACHINE_RESET_MEMBER(amstrad_state,amstrad) m_gate_array.hsync = 0; m_gate_array.vsync = 0; - machine().scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution)); + machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this)); } @@ -3015,7 +3013,7 @@ MACHINE_RESET_MEMBER(amstrad_state,plus) space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); // multiface_init(); - machine().scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution)); + machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this)); } MACHINE_START_MEMBER(amstrad_state,gx4000) @@ -3064,7 +3062,7 @@ MACHINE_RESET_MEMBER(amstrad_state,gx4000) space.install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),this)); space.install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),this)); - machine().scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution)); + machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this)); } MACHINE_START_MEMBER(amstrad_state,kccomp) @@ -3116,7 +3114,7 @@ MACHINE_RESET_MEMBER(amstrad_state,aleste) amstrad_common_init(machine()); amstrad_reset_machine(machine()); - machine().scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution)); + machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::cb_set_resolution),this)); } diff --git a/src/mess/machine/apple1.c b/src/mess/machine/apple1.c index f6424e3042f..65c16c7533f 100644 --- a/src/mess/machine/apple1.c +++ b/src/mess/machine/apple1.c @@ -51,15 +51,15 @@ #include "imagedev/cassette.h" #include "machine/ram.h" -static TIMER_CALLBACK(apple1_kbd_poll); -static TIMER_CALLBACK(apple1_kbd_strobe_end); + + static DECLARE_READ8_DEVICE_HANDLER( apple1_pia0_kbdin ); static DECLARE_WRITE8_DEVICE_HANDLER( apple1_pia0_dspout ); static DECLARE_WRITE8_DEVICE_HANDLER( apple1_pia0_dsp_write_signal ); -static TIMER_CALLBACK(apple1_dsp_ready_start); -static TIMER_CALLBACK(apple1_dsp_ready_end); + + /***************************************************************************** ** Structures @@ -158,7 +158,7 @@ DRIVER_INIT_MEMBER(apple1_state,apple1) A 120-Hz poll rate seems to be fast enough to ensure no keystrokes are missed. */ - machine().scheduler().timer_pulse(attotime::from_hz(120), FUNC(apple1_kbd_poll)); + machine().scheduler().timer_pulse(attotime::from_hz(120), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_poll),this)); } @@ -277,13 +277,12 @@ SNAPSHOT_LOAD(apple1) ** If multiple newly-pressed keys are found, the one closest to the ** end of the input ports list is counted; the others are ignored. *****************************************************************************/ -static TIMER_CALLBACK(apple1_kbd_poll) +TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) { - apple1_state *state = machine.driver_data(); int port, bit; int key_pressed; UINT32 shiftkeys, ctrlkeys; - pia6821_device *pia = machine.device("pia"); + pia6821_device *pia = machine().device("pia"); static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" }; /* This holds the values of all the input ports for ordinary keys @@ -292,56 +291,56 @@ static TIMER_CALLBACK(apple1_kbd_poll) /* First we check the RESET and CLEAR SCREEN pushbutton switches. */ /* The RESET switch resets the CPU and the 6820 PIA. */ - if (machine.root_device().ioport("KEY5")->read() & 0x0001) + if (machine().root_device().ioport("KEY5")->read() & 0x0001) { - if (!state->m_reset_flag) { - state->m_reset_flag = 1; + if (!m_reset_flag) { + m_reset_flag = 1; /* using PULSE_LINE does not allow us to press and hold key */ - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); pia->reset(); } } - else if (state->m_reset_flag) { + else if (m_reset_flag) { /* RESET released--allow the processor to continue. */ - state->m_reset_flag = 0; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + m_reset_flag = 0; + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); } /* The CLEAR SCREEN switch clears the video hardware. */ - if (machine.root_device().ioport("KEY5")->read() & 0x0002) + if (machine().root_device().ioport("KEY5")->read() & 0x0002) { - if (!state->m_vh_clrscrn_pressed) + if (!m_vh_clrscrn_pressed) { /* Ignore further video writes, and clear the screen. */ - state->m_vh_clrscrn_pressed = 1; - apple1_vh_dsp_clr(machine); + m_vh_clrscrn_pressed = 1; + apple1_vh_dsp_clr(machine()); } } - else if (state->m_vh_clrscrn_pressed) + else if (m_vh_clrscrn_pressed) { /* CLEAR SCREEN released--pay attention to video writes again. */ - state->m_vh_clrscrn_pressed = 0; + m_vh_clrscrn_pressed = 0; } /* Now we scan all the input ports for ordinary keys, recording new keypresses while ignoring keys that were already pressed in the last scan. */ - state->m_kbd_data = 0; + m_kbd_data = 0; key_pressed = 0; /* The keyboard strobe line should always be low when a scan starts. */ pia->ca1_w(0); - shiftkeys = machine.root_device().ioport("KEY4")->read() & 0x0003; - ctrlkeys = machine.root_device().ioport("KEY4")->read() & 0x000c; + shiftkeys = machine().root_device().ioport("KEY4")->read() & 0x0003; + ctrlkeys = machine().root_device().ioport("KEY4")->read() & 0x000c; for (port = 0; port < 4; port++) { UINT32 portval, newkeys; - portval = machine.root_device().ioport(keynames[port])->read(); - newkeys = portval & ~(state->m_kbd_last_scan[port]); + portval = machine().root_device().ioport(keynames[port])->read(); + newkeys = portval & ~(m_kbd_last_scan[port]); if (newkeys) { @@ -349,7 +348,7 @@ static TIMER_CALLBACK(apple1_kbd_poll) for (bit = 0; bit < 16; bit++) { if (newkeys & 1) { - state->m_kbd_data = (ctrlkeys) + m_kbd_data = (ctrlkeys) ? apple1_control_keymap[port*16 + bit] : (shiftkeys) ? apple1_shifted_keymap[port*16 + bit] @@ -358,7 +357,7 @@ static TIMER_CALLBACK(apple1_kbd_poll) newkeys >>= 1; } } - state->m_kbd_last_scan[port] = portval; + m_kbd_last_scan[port] = portval; } if (key_pressed) @@ -366,13 +365,13 @@ static TIMER_CALLBACK(apple1_kbd_poll) /* The keyboard will pulse its strobe line when a key is pressed. A 10-usec pulse is typical. */ pia->ca1_w(1); - machine.scheduler().timer_set(attotime::from_usec(10), FUNC(apple1_kbd_strobe_end)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(apple1_state::apple1_kbd_strobe_end),this)); } } -static TIMER_CALLBACK(apple1_kbd_strobe_end) +TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_strobe_end) { - pia6821_device *pia = machine.device("pia"); + pia6821_device *pia = machine().device("pia"); /* End of the keyboard strobe pulse. */ pia->ca1_w(0); @@ -412,25 +411,26 @@ static WRITE8_DEVICE_HANDLER( apple1_pia0_dsp_write_signal ) Only then will it assert \RDA to signal readiness for another write. Thus the write delay depends on the cursor position and where the display is in the refresh cycle. */ + apple1_state *state = space.machine().driver_data(); if (!data) - space.machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(space.machine()), FUNC(apple1_dsp_ready_start)); + space.machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(space.machine()), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),state)); } -static TIMER_CALLBACK(apple1_dsp_ready_start) +TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_start) { - pia6821_device *pia = machine.device("pia"); + pia6821_device *pia = machine().device("pia"); /* When the display asserts \RDA to signal it is ready, it triggers a 74123 one-shot to send a 3.5-usec low pulse to PIA input CB1. The end of this pulse will tell the PIA that the display is ready for another write. */ pia->cb1_w(0); - machine.scheduler().timer_set(attotime::from_nsec(3500), FUNC(apple1_dsp_ready_end)); + machine().scheduler().timer_set(attotime::from_nsec(3500), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_end),this)); } -static TIMER_CALLBACK(apple1_dsp_ready_end) +TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_end) { - pia6821_device *pia = machine.device("pia"); + pia6821_device *pia = machine().device("pia"); /* The one-shot pulse has ended; return CB1 to high, so we can do another display write. */ diff --git a/src/mess/machine/apple2gs.c b/src/mess/machine/apple2gs.c index ec88a568215..d79ac46b44b 100644 --- a/src/mess/machine/apple2gs.c +++ b/src/mess/machine/apple2gs.c @@ -294,25 +294,23 @@ void apple2gs_doc_irq(device_t *device, int state) /* Clock interrupt */ -static TIMER_CALLBACK( apple2gs_clock_tick ) +TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_clock_tick) { - apple2gs_state *state = machine.driver_data(); - if ((state->m_vgcint & 0x04) && !(state->m_vgcint & 0x40)) + if ((m_vgcint & 0x04) && !(m_vgcint & 0x40)) { - state->m_vgcint |= 0xc0; - apple2gs_add_irq(machine, IRQ_VGC_SECOND); + m_vgcint |= 0xc0; + apple2gs_add_irq(machine(), IRQ_VGC_SECOND); } } /* Quarter-second interrupt */ -static TIMER_CALLBACK( apple2gs_qsecond_tick ) +TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_qsecond_tick) { - apple2gs_state *state = machine.driver_data(); - if ((state->m_inten & 0x10) && !(state->m_intflag & 0x10)) + if ((m_inten & 0x10) && !(m_intflag & 0x10)) { - state->m_intflag |= 0x10; - apple2gs_add_irq(machine, IRQ_INTEN_QSECOND); + m_intflag |= 0x10; + apple2gs_add_irq(machine(), IRQ_INTEN_QSECOND); } } @@ -736,31 +734,30 @@ static void apple2gs_set_scanint(running_machine &machine, UINT8 data) } -static TIMER_CALLBACK(apple2gs_scanline_tick) +TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_scanline_tick) { - apple2gs_state *state = machine.driver_data(); int scanline; - scanline = machine.primary_screen->vpos(); - machine.primary_screen->update_partial(scanline); + scanline = machine().primary_screen->vpos(); + machine().primary_screen->update_partial(scanline); /* check scanline interrupt bits if we're in super hi-res and the current scanline is within the active display area */ - if ((state->m_newvideo & 0x80) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1))) + if ((m_newvideo & 0x80) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1))) { UINT8 scb; - scb = state->m_slowmem[0x19D00 + scanline - BORDER_TOP + 1]; + scb = m_slowmem[0x19D00 + scanline - BORDER_TOP + 1]; if (scb & 0x40) { // scanline int flag is set even when the actual interrupt is disabled - state->m_vgcint |= 0x20; + m_vgcint |= 0x20; // see if the interrupt is also enabled and trigger it if so - if (state->m_vgcint & 0x02) + if (m_vgcint & 0x02) { - state->m_vgcint |= 0x80; - apple2gs_add_irq(machine, IRQ_VGC_SCANLINE); + m_vgcint |= 0x80; + apple2gs_add_irq(machine(), IRQ_VGC_SCANLINE); } } } @@ -768,28 +765,28 @@ static TIMER_CALLBACK(apple2gs_scanline_tick) if (scanline == (192+BORDER_TOP)) { /* VBL interrupt */ - if ((state->m_inten & 0x08) && !(state->m_intflag & 0x08)) + if ((m_inten & 0x08) && !(m_intflag & 0x08)) { - state->m_intflag |= 0x08; - apple2gs_add_irq(machine, IRQ_INTEN_VBL); + m_intflag |= 0x08; + apple2gs_add_irq(machine(), IRQ_INTEN_VBL); } } /* check the mouse status */ if ((scanline % 8) == 0) { - adb_check_mouse(machine); + adb_check_mouse(machine()); /* call Apple II interrupt handler */ - if ((machine.primary_screen->vpos() % 8) == 7) + if ((machine().primary_screen->vpos() % 8) == 7) { - //apple2_interrupt(machine.device("maincpu")); + //apple2_interrupt(machine().device("maincpu")); /* TODO: check me! */ - machine.primary_screen->update_partial(machine.primary_screen->vpos()); + machine().primary_screen->update_partial(machine().primary_screen->vpos()); } } - state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos((scanline+1)%262, 0)); + m_scanline_timer->adjust(machine().primary_screen->time_until_pos((scanline+1)%262, 0)); } @@ -1993,13 +1990,13 @@ MACHINE_START_MEMBER(apple2gs_state,apple2gscommon) state_save_register_item(machine(), "ECHOBANK", NULL,0, m_echo_bank); - m_clock_timer = machine().scheduler().timer_alloc(FUNC(apple2gs_clock_tick)); + m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_clock_tick),this)); m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - m_qsecond_timer = machine().scheduler().timer_alloc(FUNC(apple2gs_qsecond_tick)); + m_qsecond_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_qsecond_tick),this)); m_qsecond_timer->adjust(attotime::from_usec(266700), 0, attotime::from_usec(266700)); - m_scanline_timer = machine().scheduler().timer_alloc(FUNC(apple2gs_scanline_tick)); + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apple2gs_state::apple2gs_scanline_tick),this)); m_scanline_timer->adjust(attotime::never); // fire on scanline zero diff --git a/src/mess/machine/bbc.c b/src/mess/machine/bbc.c index d692a118179..a913baa2f73 100644 --- a/src/mess/machine/bbc.c +++ b/src/mess/machine/bbc.c @@ -1314,63 +1314,62 @@ static void MC6850_Receive_Clock(running_machine &machine, int new_clock) state->m_mc6850_clock = new_clock; } -static TIMER_CALLBACK(bbc_tape_timer_cb) +TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) { - bbc_state *state = machine.driver_data(); double dev_val; - dev_val=machine.device(CASSETTE_TAG)->input(); + dev_val=machine().device(CASSETTE_TAG)->input(); // look for rising edges on the cassette wave - if (((dev_val>=0.0) && (state->m_last_dev_val<0.0)) || ((dev_val<0.0) && (state->m_last_dev_val>=0.0))) + if (((dev_val>=0.0) && (m_last_dev_val<0.0)) || ((dev_val<0.0) && (m_last_dev_val>=0.0))) { - if (state->m_wav_len>(9*3)) + if (m_wav_len>(9*3)) { //this is to long to recive anything so reset the serial IC. This is a hack, this should be done as a timer in the MC6850 code. - logerror ("Cassette length %d\n",state->m_wav_len); - state->m_len0=0; - state->m_len1=0; - state->m_len2=0; - state->m_len3=0; - state->m_wav_len=0; + logerror ("Cassette length %d\n",m_wav_len); + m_len0=0; + m_len1=0; + m_len2=0; + m_len3=0; + m_wav_len=0; } - state->m_len3=state->m_len2; - state->m_len2=state->m_len1; - state->m_len1=state->m_len0; - state->m_len0=state->m_wav_len; + m_len3=m_len2; + m_len2=m_len1; + m_len1=m_len0; + m_len0=m_wav_len; - state->m_wav_len=0; - logerror ("cassette %d %d %d %d\n",state->m_len3,state->m_len2,state->m_len1,state->m_len0); + m_wav_len=0; + logerror ("cassette %d %d %d %d\n",m_len3,m_len2,m_len1,m_len0); - if ((state->m_len0+state->m_len1)>=(18+18-5)) + if ((m_len0+m_len1)>=(18+18-5)) { /* Clock a 0 onto the serial line */ logerror("Serial value 0\n"); - MC6850_Receive_Clock(machine, 0); - state->m_len0=0; - state->m_len1=0; - state->m_len2=0; - state->m_len3=0; + MC6850_Receive_Clock(machine(), 0); + m_len0=0; + m_len1=0; + m_len2=0; + m_len3=0; } - if (((state->m_len0+state->m_len1+state->m_len2+state->m_len3)<=41) && (state->m_len3!=0)) + if (((m_len0+m_len1+m_len2+m_len3)<=41) && (m_len3!=0)) { /* Clock a 1 onto the serial line */ logerror("Serial value 1\n"); - MC6850_Receive_Clock(machine, 1); - state->m_len0=0; - state->m_len1=0; - state->m_len2=0; - state->m_len3=0; + MC6850_Receive_Clock(machine(), 1); + m_len0=0; + m_len1=0; + m_len2=0; + m_len3=0; } } - state->m_wav_len++; - state->m_last_dev_val=dev_val; + m_wav_len++; + m_last_dev_val=dev_val; } @@ -1987,12 +1986,12 @@ DEVICE_IMAGE_LOAD( bbcb_cart ) DRIVER_INIT_MEMBER(bbc_state,bbc) { m_Master=0; - m_tape_timer = machine().scheduler().timer_alloc(FUNC(bbc_tape_timer_cb)); + m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bbc_state::bbc_tape_timer_cb),this)); } DRIVER_INIT_MEMBER(bbc_state,bbcm) { m_Master=1; - m_tape_timer = machine().scheduler().timer_alloc(FUNC(bbc_tape_timer_cb)); + m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bbc_state::bbc_tape_timer_cb),this)); } MACHINE_START_MEMBER(bbc_state,bbca) diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c index 0dc6f6b5428..44f2bed740a 100644 --- a/src/mess/machine/bebox.c +++ b/src/mess/machine/bebox.c @@ -968,12 +968,11 @@ void scsi53c810_pci_write(device_t *busdevice, device_t *device, int function, i } -static TIMER_CALLBACK( bebox_get_devices ) { - bebox_state *state = machine.driver_data(); - state->m_devices.pic8259_master = machine.device("pic8259_master"); - state->m_devices.pic8259_slave = machine.device("pic8259_slave"); - state->m_devices.dma8237_1 = machine.device("dma8237_1"); - state->m_devices.dma8237_2 = machine.device("dma8237_2"); +TIMER_CALLBACK_MEMBER(bebox_state::bebox_get_devices){ + m_devices.pic8259_master = machine().device("pic8259_master"); + m_devices.pic8259_slave = machine().device("pic8259_slave"); + m_devices.dma8237_1 = machine().device("dma8237_1"); + m_devices.dma8237_2 = machine().device("dma8237_2"); } @@ -990,7 +989,7 @@ void bebox_state::machine_reset() m_devices.dma8237_1 = NULL; m_devices.dma8237_2 = NULL; - machine().scheduler().timer_set(attotime::zero, FUNC(bebox_get_devices)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(bebox_state::bebox_get_devices),this)); machine().device("ppc1")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); machine().device("ppc2")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); diff --git a/src/mess/machine/bk.c b/src/mess/machine/bk.c index d1a943af6de..8249a34eccf 100644 --- a/src/mess/machine/bk.c +++ b/src/mess/machine/bk.c @@ -13,9 +13,8 @@ #include "includes/bk.h" -static TIMER_CALLBACK(keyboard_callback) +TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) { - bk_state *state = machine.driver_data(); UINT8 code, i, j; static const char *const keynames[] = { "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", @@ -24,42 +23,42 @@ static TIMER_CALLBACK(keyboard_callback) for(i = 1; i < 12; i++) { - code = machine.root_device().ioport(keynames[i-1])->read(); + code = machine().root_device().ioport(keynames[i-1])->read(); if (code != 0) { for(j = 0; j < 8; j++) { if (code == (1 << j)) { - state->m_key_code = j + i*8; + m_key_code = j + i*8; break; } } - if ((machine.root_device().ioport("LINE0")->read() & 4) == 4) + if ((machine().root_device().ioport("LINE0")->read() & 4) == 4) { if (i==6 || i==7) { - state->m_key_code -= 16; + m_key_code -= 16; } } - if ((machine.root_device().ioport("LINE0")->read() & 4) == 4) + if ((machine().root_device().ioport("LINE0")->read() & 4) == 4) { if (i>=8 && i<=11) { - state->m_key_code += 32; + m_key_code += 32; } } - state->m_key_pressed = 0x40; - if ((machine.root_device().ioport("LINE0")->read() & 2) == 0) + m_key_pressed = 0x40; + if ((machine().root_device().ioport("LINE0")->read() & 2) == 0) { - state->m_key_irq_vector = 0x30; + m_key_irq_vector = 0x30; } else { - state->m_key_irq_vector = 0xBC; + m_key_irq_vector = 0xBC; } - machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); + machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); break; } } @@ -68,7 +67,7 @@ static TIMER_CALLBACK(keyboard_callback) void bk_state::machine_start() { - machine().scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(2400), timer_expired_delegate(FUNC(bk_state::keyboard_callback),this)); } static IRQ_CALLBACK(bk0010_irq_callback) diff --git a/src/mess/machine/cgenie.c b/src/mess/machine/cgenie.c index e0d5cd76770..6356d72fa38 100644 --- a/src/mess/machine/cgenie.c +++ b/src/mess/machine/cgenie.c @@ -32,15 +32,14 @@ -static TIMER_CALLBACK( handle_cassette_input ) +TIMER_CALLBACK_MEMBER(cgenie_state::handle_cassette_input) { - cgenie_state *state = machine.driver_data(); - UINT8 new_level = ( (machine.device(CASSETTE_TAG)->input()) > 0.0 ) ? 1 : 0; + UINT8 new_level = ( (machine().device(CASSETTE_TAG)->input()) > 0.0 ) ? 1 : 0; - if ( new_level != state->m_cass_level ) + if ( new_level != m_cass_level ) { - state->m_cass_level = new_level; - state->m_cass_bit ^= 1; + m_cass_level = new_level; + m_cass_bit ^= 1; } } @@ -151,7 +150,7 @@ void cgenie_state::machine_start() space.install_legacy_write_handler(0x4000, 0x4000 + machine().device(RAM_TAG)->size() - 1, FUNC(cgenie_videoram_w)); m_videoram = machine().device(RAM_TAG)->pointer(); membank("bank1")->set_base(machine().device(RAM_TAG)->pointer()); - machine().scheduler().timer_pulse(attotime::from_hz(11025), FUNC(handle_cassette_input)); + machine().scheduler().timer_pulse(attotime::from_hz(11025), timer_expired_delegate(FUNC(cgenie_state::handle_cassette_input),this)); } /************************************* diff --git a/src/mess/machine/compis.c b/src/mess/machine/compis.c index 8883de1f273..c9b64de3411 100644 --- a/src/mess/machine/compis.c +++ b/src/mess/machine/compis.c @@ -596,11 +596,10 @@ void compis_state::handle_eoi(int data) * *************************************/ -static TIMER_CALLBACK(internal_timer_int) +TIMER_CALLBACK_MEMBER(compis_state::internal_timer_int) { - compis_state *state = machine.driver_data(); int which = param; - struct timer_state *t = &state->m_i186.timer[which]; + struct timer_state *t = &m_i186.timer[which]; if (LOG_TIMER) logerror("Hit interrupt callback for timer %d\n", which); @@ -610,8 +609,8 @@ static TIMER_CALLBACK(internal_timer_int) /* request an interrupt */ if (t->control & 0x2000) { - state->m_i186.intr.status |= 0x01 << which; - update_interrupt_state(machine); + m_i186.intr.status |= 0x01 << which; + update_interrupt_state(machine()); if (LOG_TIMER) logerror(" Generating timer interrupt\n"); } @@ -781,11 +780,10 @@ void compis_state::internal_timer_update(int which, int new_count, int new_maxA, * *************************************/ -static TIMER_CALLBACK(dma_timer_callback) +TIMER_CALLBACK_MEMBER(compis_state::dma_timer_callback) { - compis_state *state = machine.driver_data(); int which = param; - struct dma_state *d = &state->m_i186.dma[which]; + struct dma_state *d = &m_i186.dma[which]; /* force an update and see if we're really done */ //stream_update(dma_stream, 0); @@ -799,8 +797,8 @@ static TIMER_CALLBACK(dma_timer_callback) if (d->control & 0x0100) { if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source); - state->m_i186.intr.request |= 0x04 << which; - update_interrupt_state(machine); + m_i186.intr.request |= 0x04 << which; + update_interrupt_state(machine()); } } @@ -1301,14 +1299,14 @@ static void compis_cpu_init(running_machine &machine) { compis_state *state = machine.driver_data(); /* create timers here so they stick around */ - state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int)); - state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int)); - state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int)); - state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback)); - state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback)); + state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),state)); + state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),state)); + state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),state)); + state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(timer_expired_delegate()); + state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(timer_expired_delegate()); + state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(timer_expired_delegate()); + state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::dma_timer_callback),state)); + state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::dma_timer_callback),state)); } /*-------------------------------------------------------------------------*/ diff --git a/src/mess/machine/dai.c b/src/mess/machine/dai.c index 7a069090de6..7d8ddb05455 100644 --- a/src/mess/machine/dai.c +++ b/src/mess/machine/dai.c @@ -34,9 +34,9 @@ static void dai_update_memory(running_machine &machine, int dai_rom_bank) state->membank("bank2")->set_entry(dai_rom_bank); } -static TIMER_CALLBACK(dai_bootstrap_callback) +TIMER_CALLBACK_MEMBER(dai_state::dai_bootstrap_callback) { - machine.device("maincpu")->state().set_pc(0xc000); + machine().device("maincpu")->state().set_pc(0xc000); } @@ -105,18 +105,17 @@ const struct pit8253_config dai_pit8253_intf = } }; -static TIMER_CALLBACK( dai_timer ) +TIMER_CALLBACK_MEMBER(dai_state::dai_timer) { - dai_state *state = machine.driver_data(); - state->m_tms5501->set_pio_bit_7((state->ioport("IN8")->read() & 0x04) ? 1:0); + m_tms5501->set_pio_bit_7((ioport("IN8")->read() & 0x04) ? 1:0); } void dai_state::machine_start() { membank("bank2")->configure_entries(0, 4, memregion("maincpu")->base() + 0x010000, 0x1000); - machine().scheduler().timer_set(attotime::zero, FUNC(dai_bootstrap_callback)); - machine().scheduler().timer_pulse(attotime::from_hz(100), FUNC(dai_timer)); /* timer for tms5501 */ + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(dai_state::dai_bootstrap_callback),this)); + machine().scheduler().timer_pulse(attotime::from_hz(100), timer_expired_delegate(FUNC(dai_state::dai_timer),this)); /* timer for tms5501 */ memset(machine().device(RAM_TAG)->pointer(), 0, machine().device(RAM_TAG)->size()); } diff --git a/src/mess/machine/electron.c b/src/mess/machine/electron.c index 8f920490b5f..570b5ea4e6e 100644 --- a/src/mess/machine/electron.c +++ b/src/mess/machine/electron.c @@ -41,75 +41,74 @@ void electron_state::electron_tape_stop() #define TAPE_LOW 0x00; #define TAPE_HIGH 0xFF; -static TIMER_CALLBACK(electron_tape_timer_handler) +TIMER_CALLBACK_MEMBER(electron_state::electron_tape_timer_handler) { - electron_state *state = machine.driver_data(); - if ( state->m_ula.cassette_motor_mode ) + if ( m_ula.cassette_motor_mode ) { double tap_val; - tap_val = cassette_device_image(machine)->input(); + tap_val = cassette_device_image(machine())->input(); if ( tap_val < -0.5 ) { - state->m_ula.tape_value = ( state->m_ula.tape_value << 8 ) | TAPE_LOW; - state->m_ula.tape_steps++; + m_ula.tape_value = ( m_ula.tape_value << 8 ) | TAPE_LOW; + m_ula.tape_steps++; } else if ( tap_val > 0.5 ) { - state->m_ula.tape_value = ( state->m_ula.tape_value << 8 ) | TAPE_HIGH; - state->m_ula.tape_steps++; + m_ula.tape_value = ( m_ula.tape_value << 8 ) | TAPE_HIGH; + m_ula.tape_steps++; } else { - state->m_ula.tape_steps = 0; - state->m_ula.bit_count = 0; - state->m_ula.high_tone_set = 0; - state->m_ula.tape_value = 0x80808080; + m_ula.tape_steps = 0; + m_ula.bit_count = 0; + m_ula.high_tone_set = 0; + m_ula.tape_value = 0x80808080; } - if ( state->m_ula.tape_steps > 2 && ( state->m_ula.tape_value == 0x0000FFFF || state->m_ula.tape_value == 0x00FF00FF ) ) + if ( m_ula.tape_steps > 2 && ( m_ula.tape_value == 0x0000FFFF || m_ula.tape_value == 0x00FF00FF ) ) { - state->m_ula.tape_steps = 0; - switch( state->m_ula.bit_count ) + m_ula.tape_steps = 0; + switch( m_ula.bit_count ) { case 0: /* start bit */ - state->m_ula.start_bit = ( ( state->m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); - //logerror( "++ Read start bit: %d\n", state->m_ula.start_bit ); - if ( state->m_ula.start_bit ) + m_ula.start_bit = ( ( m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); + //logerror( "++ Read start bit: %d\n", m_ula.start_bit ); + if ( m_ula.start_bit ) { - if ( state->m_ula.high_tone_set ) + if ( m_ula.high_tone_set ) { - state->m_ula.bit_count--; + m_ula.bit_count--; } } else { - state->m_ula.high_tone_set = 0; + m_ula.high_tone_set = 0; } break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: - //logerror( "++ Read regular bit: %d\n", state->m_ula.tape_value == 0x0000FFFF ? 0 : 1 ); - state->m_ula.tape_byte = ( state->m_ula.tape_byte >> 1 ) | ( state->m_ula.tape_value == 0x0000FFFF ? 0 : 0x80 ); + //logerror( "++ Read regular bit: %d\n", m_ula.tape_value == 0x0000FFFF ? 0 : 1 ); + m_ula.tape_byte = ( m_ula.tape_byte >> 1 ) | ( m_ula.tape_value == 0x0000FFFF ? 0 : 0x80 ); break; case 9: /* stop bit */ - state->m_ula.stop_bit = ( ( state->m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); - //logerror( "++ Read stop bit: %d\n", state->m_ula.stop_bit ); - if ( state->m_ula.start_bit && state->m_ula.stop_bit && state->m_ula.tape_byte == 0xFF && ! state->m_ula.high_tone_set ) + m_ula.stop_bit = ( ( m_ula.tape_value == 0x0000FFFF ) ? 0 : 1 ); + //logerror( "++ Read stop bit: %d\n", m_ula.stop_bit ); + if ( m_ula.start_bit && m_ula.stop_bit && m_ula.tape_byte == 0xFF && ! m_ula.high_tone_set ) { - electron_interrupt_handler( machine, INT_SET, INT_HIGH_TONE ); - state->m_ula.high_tone_set = 1; + electron_interrupt_handler( machine(), INT_SET, INT_HIGH_TONE ); + m_ula.high_tone_set = 1; } - else if ( ! state->m_ula.start_bit && state->m_ula.stop_bit ) + else if ( ! m_ula.start_bit && m_ula.stop_bit ) { - //logerror( "-- Byte read from tape: %02x\n", state->m_ula.tape_byte ); - electron_interrupt_handler( machine, INT_SET, INT_RECEIVE_FULL ); + //logerror( "-- Byte read from tape: %02x\n", m_ula.tape_byte ); + electron_interrupt_handler( machine(), INT_SET, INT_RECEIVE_FULL ); } else { - logerror( "Invalid start/stop bit combination detected: %d,%d\n", state->m_ula.start_bit, state->m_ula.stop_bit ); + logerror( "Invalid start/stop bit combination detected: %d,%d\n", m_ula.start_bit, m_ula.stop_bit ); } break; } - state->m_ula.bit_count = ( state->m_ula.bit_count + 1 ) % 10; + m_ula.bit_count = ( m_ula.bit_count + 1 ) % 10; } } } @@ -315,9 +314,9 @@ void electron_interrupt_handler(running_machine &machine, int mode, int interrup Machine Initialisation functions ***************************************/ -static TIMER_CALLBACK(setup_beep) +TIMER_CALLBACK_MEMBER(electron_state::setup_beep) { - device_t *speaker = machine.device(BEEPER_TAG); + device_t *speaker = machine().device(BEEPER_TAG); beep_set_state( speaker, 0 ); beep_set_frequency( speaker, 300 ); } @@ -346,8 +345,8 @@ void electron_state::machine_start() m_ula.interrupt_status = 0x82; m_ula.interrupt_control = 0x00; - machine().scheduler().timer_set(attotime::zero, FUNC(setup_beep)); - m_tape_timer = machine().scheduler().timer_alloc(FUNC(electron_tape_timer_handler)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this)); + m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this)); machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(electron_reset),&machine())); } diff --git a/src/mess/machine/gamecom.c b/src/mess/machine/gamecom.c index a4be8c572c6..670d8f308ba 100644 --- a/src/mess/machine/gamecom.c +++ b/src/mess/machine/gamecom.c @@ -5,12 +5,12 @@ static const int gamecom_timer_limit[8] = { 2, 1024, 2048, 4096, 8192, 16384, 32768, 65536 }; -static TIMER_CALLBACK(gamecom_clock_timer_callback) +TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_clock_timer_callback) { - UINT8 * RAM = machine.root_device().memregion("maincpu")->base(); + UINT8 * RAM = machine().root_device().memregion("maincpu")->base(); UINT8 val = ( ( RAM[SM8521_CLKT] & 0x3F ) + 1 ) & 0x3F; RAM[SM8521_CLKT] = ( RAM[SM8521_CLKT] & 0xC0 ) | val; - machine.device("maincpu")->execute().set_input_line(CK_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(CK_INT, ASSERT_LINE ); } void gamecom_state::machine_reset() @@ -536,7 +536,7 @@ void gamecom_update_timers( device_t *device, int cycles ) DRIVER_INIT_MEMBER(gamecom_state,gamecom) { - m_clock_timer = machine().scheduler().timer_alloc(FUNC(gamecom_clock_timer_callback)); + m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_clock_timer_callback),this)); m_p_ram = memregion("maincpu")->base(); // required here because pio_w gets called before machine_reset } diff --git a/src/mess/machine/gb.c b/src/mess/machine/gb.c index 34d10a6d08f..ba18534f6ac 100644 --- a/src/mess/machine/gb.c +++ b/src/mess/machine/gb.c @@ -80,7 +80,7 @@ enum { Prototypes */ -static TIMER_CALLBACK(gb_serial_timer_proc); + static void gb_machine_stop(running_machine &machine); @@ -250,7 +250,7 @@ MACHINE_START_MEMBER(gb_state,gb) machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine())); /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(FUNC(gb_serial_timer_proc)); + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); m_gb_serial_timer->enable( 0 ); MACHINE_START_CALL_MEMBER( gb_video ); @@ -261,7 +261,7 @@ MACHINE_START_MEMBER(gb_state,gbc) machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine())); /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(FUNC(gb_serial_timer_proc)); + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); m_gb_serial_timer->enable( 0 ); MACHINE_START_CALL_MEMBER( gbc_video ); @@ -291,7 +291,7 @@ MACHINE_START_MEMBER(gb_state,sgb) machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine())); /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(FUNC(gb_serial_timer_proc)); + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); m_gb_serial_timer->enable( 0 ); MACHINE_START_CALL_MEMBER( gb_video ); @@ -1896,19 +1896,18 @@ INTERRUPT_GEN_MEMBER(gb_state::gb_scanline_interrupt) { } -static TIMER_CALLBACK(gb_serial_timer_proc) +TIMER_CALLBACK_MEMBER(gb_state::gb_serial_timer_proc) { - gb_state *state = machine.driver_data(); /* Shift in a received bit */ - state->SIODATA = (state->SIODATA << 1) | 0x01; + SIODATA = (SIODATA << 1) | 0x01; /* Decrement number of handled bits */ - state->m_SIOCount--; + m_SIOCount--; /* If all bits done, stop timer and trigger interrupt */ - if ( ! state->m_SIOCount ) + if ( ! m_SIOCount ) { - state->SIOCONT &= 0x7F; - state->m_gb_serial_timer->enable( 0 ); - machine.device("maincpu")->execute().set_input_line(SIO_INT, ASSERT_LINE); + SIOCONT &= 0x7F; + m_gb_serial_timer->enable( 0 ); + machine().device("maincpu")->execute().set_input_line(SIO_INT, ASSERT_LINE); } } @@ -2017,7 +2016,7 @@ READ8_MEMBER(gb_state::gbc_io2_r) MACHINE_START_MEMBER(gb_state,megaduck) { /* Allocate the serial timer, and disable it */ - m_gb_serial_timer = machine().scheduler().timer_alloc(FUNC(gb_serial_timer_proc)); + m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); m_gb_serial_timer->enable( 0 ); MACHINE_START_CALL_MEMBER( gb_video ); diff --git a/src/mess/machine/hec2hrp.c b/src/mess/machine/hec2hrp.c index e9c589de947..e00554b2d50 100644 --- a/src/mess/machine/hec2hrp.c +++ b/src/mess/machine/hec2hrp.c @@ -100,11 +100,10 @@ return ((strncmp(machine.system().name , "hec2mdhrx", 9)==0) || } /* Cassette timer*/ -static TIMER_CALLBACK( Callback_CK ) +TIMER_CALLBACK_MEMBER(hec2hrp_state::Callback_CK) { - hec2hrp_state *state = machine.driver_data(); /* To generate the CK signal (K7)*/ - state->m_CK_signal++; + m_CK_signal++; } void hector_minidisc_init(running_machine &machine) @@ -891,7 +890,7 @@ void hector_init(running_machine &machine) state->m_pot0 = state->m_pot1 = 0x40; /* For Cassette synchro*/ - state->m_Cassette_timer = machine.scheduler().timer_alloc(FUNC(Callback_CK)); + state->m_Cassette_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(hec2hrp_state::Callback_CK),state)); state->m_Cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/ /* Sound sn76477*/ diff --git a/src/mess/machine/hp48.c b/src/mess/machine/hp48.c index e7bd484c109..f2548951d2d 100644 --- a/src/mess/machine/hp48.c +++ b/src/mess/machine/hp48.c @@ -95,21 +95,20 @@ static void hp48_pulse_irq( running_machine &machine, int irq_line) #define RS232_DELAY attotime::from_usec( 300 ) /* end of receive event */ -static TIMER_CALLBACK( hp48_rs232_byte_recv_cb ) +TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_recv_cb) { - hp48_state *state = machine.driver_data(); LOG_SERIAL(( "%f hp48_rs232_byte_recv_cb: end of receive, data=%02x\n", - machine.time().as_double(), param )); + machine().time().as_double(), param )); - state->m_io[0x14] = param & 0xf; /* receive zone */ - state->m_io[0x15] = param >> 4; - state->m_io[0x11] &= ~2; /* clear byte receiving */ - state->m_io[0x11] |= 1; /* set byte received */ + m_io[0x14] = param & 0xf; /* receive zone */ + m_io[0x15] = param >> 4; + m_io[0x11] &= ~2; /* clear byte receiving */ + m_io[0x11] |= 1; /* set byte received */ /* interrupt */ - if ( state->m_io[0x10] & 2 ) + if ( m_io[0x10] & 2 ) { - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + hp48_pulse_irq( machine(), SATURN_IRQ_LINE ); } } @@ -129,33 +128,32 @@ void hp48_rs232_start_recv_byte( running_machine &machine, UINT8 data ) } /* schedule end of reception */ - machine.scheduler().timer_set( RS232_DELAY, FUNC(hp48_rs232_byte_recv_cb), data); + machine.scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_recv_cb),state), data); } /* end of send event */ -static TIMER_CALLBACK( hp48_rs232_byte_sent_cb ) +TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_sent_cb) { - hp48_state *state = machine.driver_data(); - //device_image_interface *xmodem = dynamic_cast(machine.device("rs232_x")); - //device_image_interface *kermit = dynamic_cast(machine.device("rs232_k")); + //device_image_interface *xmodem = dynamic_cast(machine().device("rs232_x")); + //device_image_interface *kermit = dynamic_cast(machine().device("rs232_k")); LOG_SERIAL(( "%f hp48_rs232_byte_sent_cb: end of send, data=%02x\n", - machine.time().as_double(), param )); + machine().time().as_double(), param )); - state->m_io[0x12] &= ~3; /* clear byte sending and buffer full */ + m_io[0x12] &= ~3; /* clear byte sending and buffer full */ /* interrupt */ - if ( state->m_io[0x10] & 4 ) + if ( m_io[0x10] & 4 ) { - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + hp48_pulse_irq( machine(), SATURN_IRQ_LINE ); } /* protocol action */ //if ( xmodem && xmodem->exists() ) xmodem_receive_byte( &xmodem->device(), param ); //else if ( kermit && kermit->exists() ) kermit_receive_byte( &kermit->device(), param ); //#ifdef CHARDEV -// else chardev_out( state->m_chardev, param ); +// else chardev_out( m_chardev, param ); //#endif } @@ -172,29 +170,28 @@ static void hp48_rs232_send_byte( running_machine &machine ) state->m_io[0x12] |= 3; /* schedule transmission */ - machine.scheduler().timer_set( RS232_DELAY, FUNC(hp48_rs232_byte_sent_cb), data); + machine.scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_sent_cb),state), data); } #ifdef CHARDEV -static TIMER_CALLBACK( hp48_chardev_byte_recv_cb ) +TIMER_CALLBACK_MEMBER(hp48_state::hp48_chardev_byte_recv_cb) { - hp48_state *state = machine.driver_data(); - UINT8 data = chardev_in( state->m_chardev ); + UINT8 data = chardev_in( m_chardev ); LOG_SERIAL(( "%f hp48_chardev_byte_recv_cb: end of receive, data=%02x\n", - machine.time().as_double(), data )); + machine().time().as_double(), data )); - state->m_io[0x14] = data & 0xf; /* receive zone */ - state->m_io[0x15] = data >> 4; - state->m_io[0x11] &= ~2; /* clear byte receiving */ - state->m_io[0x11] |= 1; /* set byte received */ + m_io[0x14] = data & 0xf; /* receive zone */ + m_io[0x15] = data >> 4; + m_io[0x11] &= ~2; /* clear byte receiving */ + m_io[0x11] |= 1; /* set byte received */ /* interrupt */ - if ( state->m_io[0x10] & 2 ) + if ( m_io[0x10] & 2 ) { - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + hp48_pulse_irq( machine(), SATURN_IRQ_LINE ); } } @@ -215,7 +212,7 @@ static void hp48_chardev_start_recv_byte( running_machine &machine, chardev_err } /* schedule end of reception */ - machine.scheduler().timer_set( RS232_DELAY, FUNC(hp48_chardev_byte_recv_cb)); + machine.scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_chardev_byte_recv_cb),this)); } static void hp48_chardev_ready_to_send( running_machine &machine ) @@ -305,22 +302,21 @@ static void hp48_update_kdn( running_machine &machine ) } /* periodic keyboard polling, generates an interrupt */ -static TIMER_CALLBACK( hp48_kbd_cb ) +TIMER_CALLBACK_MEMBER(hp48_state::hp48_kbd_cb) { - hp48_state *state = machine.driver_data(); /* NMI for ON key */ - if ( machine.root_device().ioport( "ON" )->read() ) + if ( machine().root_device().ioport( "ON" )->read() ) { LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", - machine.time().as_double() )); - state->m_io[0x19] |= 8; /* set service request */ - hp48_pulse_irq( machine, SATURN_WAKEUP_LINE ); - hp48_pulse_irq( machine, SATURN_NMI_LINE ); + machine().time().as_double() )); + m_io[0x19] |= 8; /* set service request */ + hp48_pulse_irq( machine(), SATURN_WAKEUP_LINE ); + hp48_pulse_irq( machine(), SATURN_NMI_LINE ); return; } /* regular keys */ - hp48_update_kdn( machine ); + hp48_update_kdn( machine() ); } /* RSI opcode */ @@ -611,53 +607,51 @@ READ8_MEMBER(hp48_state::hp48_bank_r) /* ---------------- timers --------------- */ -static TIMER_CALLBACK( hp48_timer1_cb ) +TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer1_cb) { - hp48_state *state = machine.driver_data(); - if ( !(state->m_io[0x2f] & 1) ) return; /* timer enable */ + if ( !(m_io[0x2f] & 1) ) return; /* timer enable */ - state->m_timer1 = (state->m_timer1 - 1) & 0xf; + m_timer1 = (m_timer1 - 1) & 0xf; /* wake-up on carry */ - if ( (state->m_io[0x2e] & 4) && (state->m_timer1 == 0xf) ) + if ( (m_io[0x2e] & 4) && (m_timer1 == 0xf) ) { LOG(( "wake-up on timer1\n" )); - state->m_io[0x2e] |= 8; /* set service request */ - state->m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine, SATURN_WAKEUP_LINE ); + m_io[0x2e] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( machine(), SATURN_WAKEUP_LINE ); } /* interrupt on carry */ - if ( (state->m_io[0x2e] & 2) && (state->m_timer1 == 0xf) ) + if ( (m_io[0x2e] & 2) && (m_timer1 == 0xf) ) { LOG(( "generate timer1 interrupt\n" )); - state->m_io[0x2e] |= 8; /* set service request */ - state->m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine, SATURN_NMI_LINE ); + m_io[0x2e] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( machine(), SATURN_NMI_LINE ); } } -static TIMER_CALLBACK( hp48_timer2_cb ) +TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer2_cb) { - hp48_state *state = machine.driver_data(); - if ( !(state->m_io[0x2f] & 1) ) return; /* timer enable */ + if ( !(m_io[0x2f] & 1) ) return; /* timer enable */ - state->m_timer2 = (state->m_timer2 - 1) & 0xffffffff; + m_timer2 = (m_timer2 - 1) & 0xffffffff; /* wake-up on carry */ - if ( (state->m_io[0x2f] & 4) && (state->m_timer2 == 0xffffffff) ) + if ( (m_io[0x2f] & 4) && (m_timer2 == 0xffffffff) ) { LOG(( "wake-up on timer2\n" )); - state->m_io[0x2f] |= 8; /* set service request */ - state->m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine, SATURN_WAKEUP_LINE ); + m_io[0x2f] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( machine(), SATURN_WAKEUP_LINE ); } /* interrupt on carry */ - if ( (state->m_io[0x2f] & 2) && (state->m_timer2 == 0xffffffff) ) + if ( (m_io[0x2f] & 2) && (m_timer2 == 0xffffffff) ) { LOG(( "generate timer2 interrupt\n" )); - state->m_io[0x2f] |= 8; /* set service request */ - state->m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine, SATURN_NMI_LINE ); + m_io[0x2f] |= 8; /* set service request */ + m_io[0x18] |= 4; /* set service request */ + hp48_pulse_irq( machine(), SATURN_NMI_LINE ); } } @@ -1171,11 +1165,11 @@ void hp48_state::hp48_machine_start( hp48_models model ) m_modules[5].data = rom; /* timers */ - machine().scheduler().timer_pulse(attotime::from_hz( 16 ), FUNC(hp48_timer1_cb)); - machine().scheduler().timer_pulse(attotime::from_hz( 8192 ), FUNC(hp48_timer2_cb)); + machine().scheduler().timer_pulse(attotime::from_hz( 16 ), timer_expired_delegate(FUNC(hp48_state::hp48_timer1_cb),this)); + machine().scheduler().timer_pulse(attotime::from_hz( 8192 ), timer_expired_delegate(FUNC(hp48_state::hp48_timer2_cb),this)); /* 1ms keyboard polling */ - machine().scheduler().timer_pulse(attotime::from_msec( 1 ), FUNC(hp48_kbd_cb)); + machine().scheduler().timer_pulse(attotime::from_msec( 1 ), timer_expired_delegate(FUNC(hp48_state::hp48_kbd_cb),this)); /* save state */ save_item(NAME(m_out) ); diff --git a/src/mess/machine/intv.c b/src/mess/machine/intv.c index a355a1fc6b4..2a455159b91 100644 --- a/src/mess/machine/intv.c +++ b/src/mess/machine/intv.c @@ -650,25 +650,23 @@ MACHINE_RESET_MEMBER(intv_state,intvecs) } -static TIMER_CALLBACK(intv_interrupt_complete) +TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt_complete) { - intv_state *state = machine.driver_data(); - machine.device("maincpu")->execute().set_input_line(CP1610_INT_INTRM, CLEAR_LINE); - state->m_bus_copy_mode = 0; + machine().device("maincpu")->execute().set_input_line(CP1610_INT_INTRM, CLEAR_LINE); + m_bus_copy_mode = 0; } -static TIMER_CALLBACK(intv_btb_fill) +TIMER_CALLBACK_MEMBER(intv_state::intv_btb_fill) { - intv_state *state = machine.driver_data(); UINT8 column; - UINT8 row = state->m_backtab_row; - //machine.device("maincpu")->execute().adjust_icount(-STIC_ROW_FETCH); + UINT8 row = m_backtab_row; + //machine().device("maincpu")->execute().adjust_icount(-STIC_ROW_FETCH); for(column=0; column < STIC_BACKTAB_WIDTH; column++) { - state->m_backtab_buffer[row][column] = state->m_ram16[column + row * STIC_BACKTAB_WIDTH]; + m_backtab_buffer[row][column] = m_ram16[column + row * STIC_BACKTAB_WIDTH]; } - state->m_backtab_row += 1; + m_backtab_row += 1; } INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt) @@ -680,11 +678,11 @@ INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt) UINT8 row; machine().device("maincpu")->execute().adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing machine().scheduler().timer_set(machine().device("maincpu") - ->cycles_to_attotime(STIC_VBLANK_END), FUNC(intv_interrupt_complete)); + ->cycles_to_attotime(STIC_VBLANK_END), timer_expired_delegate(FUNC(intv_state::intv_interrupt_complete),this)); for (row=0; row < STIC_BACKTAB_HEIGHT; row++) { machine().scheduler().timer_set(machine().device("maincpu") - ->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*m_row_delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), FUNC(intv_btb_fill)); + ->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*m_row_delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), timer_expired_delegate(FUNC(intv_state::intv_btb_fill),this)); } if (m_row_delay == 0) diff --git a/src/mess/machine/irisha.c b/src/mess/machine/irisha.c index e83e558da24..c1ad27efdf0 100644 --- a/src/mess/machine/irisha.c +++ b/src/mess/machine/irisha.c @@ -18,16 +18,15 @@ DRIVER_INIT_MEMBER(irisha_state,irisha) -static TIMER_CALLBACK( irisha_key ) +TIMER_CALLBACK_MEMBER(irisha_state::irisha_key) { - irisha_state *state = machine.driver_data(); - state->m_keypressed = 1; - state->m_keyboard_cnt = 0; + m_keypressed = 1; + m_keyboard_cnt = 0; } void irisha_state::machine_start() { - machine().scheduler().timer_pulse(attotime::from_msec(30), FUNC(irisha_key)); + machine().scheduler().timer_pulse(attotime::from_msec(30), timer_expired_delegate(FUNC(irisha_state::irisha_key),this)); } void irisha_state::machine_reset() diff --git a/src/mess/machine/kaypro.c b/src/mess/machine/kaypro.c index a60b37b77ff..4f75ec0ec8b 100644 --- a/src/mess/machine/kaypro.c +++ b/src/mess/machine/kaypro.c @@ -278,16 +278,16 @@ WRITE8_DEVICE_HANDLER( kaypro_sio_w ) *************************************************************************************/ -static TIMER_CALLBACK( kaypro_timer_callback ) +TIMER_CALLBACK_MEMBER(kaypro_state::kaypro_timer_callback) { - if (machine.device("maincpu")->state().state_int(Z80_HALT)) - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + if (machine().device("maincpu")->state().state_int(Z80_HALT)) + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } WRITE_LINE_MEMBER( kaypro_state::kaypro_fdc_intrq_w ) { if (state) - machine().scheduler().timer_set(attotime::from_usec(25), FUNC(kaypro_timer_callback)); + machine().scheduler().timer_set(attotime::from_usec(25), timer_expired_delegate(FUNC(kaypro_state::kaypro_timer_callback),this)); else machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } @@ -295,7 +295,7 @@ WRITE_LINE_MEMBER( kaypro_state::kaypro_fdc_intrq_w ) WRITE_LINE_MEMBER( kaypro_state::kaypro_fdc_drq_w ) { if (state) - machine().scheduler().timer_set(attotime::from_usec(25), FUNC(kaypro_timer_callback)); + machine().scheduler().timer_set(attotime::from_usec(25), timer_expired_delegate(FUNC(kaypro_state::kaypro_timer_callback),this)); else machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); diff --git a/src/mess/machine/kc.c b/src/mess/machine/kc.c index b683b9b8355..f2aedb7fe0d 100644 --- a/src/mess/machine/kc.c +++ b/src/mess/machine/kc.c @@ -210,30 +210,28 @@ void kc_state::update_cassette(int state) } } -static TIMER_CALLBACK(kc_cassette_oneshot_timer) +TIMER_CALLBACK_MEMBER(kc_state::kc_cassette_oneshot_timer) { - kc_state *state = machine.driver_data(); - state->update_cassette(0); + update_cassette(0); - state->m_cassette_oneshot_timer->reset(); + m_cassette_oneshot_timer->reset(); } // timer used for polling data from cassette input // enabled only when cassette motor is on -static TIMER_CALLBACK(kc_cassette_timer_callback) +TIMER_CALLBACK_MEMBER(kc_state::kc_cassette_timer_callback) { - kc_state *state = machine.driver_data(); // read cassette data - int bit = (state->m_cassette->input() > 0.0038) ? 1 : 0; + int bit = (m_cassette->input() > 0.0038) ? 1 : 0; // generates a pulse when the cassette input changes state - if (bit ^ state->m_cassette_in) + if (bit ^ m_cassette_in) { - state->update_cassette(1); - state->m_cassette_in = bit; - state->m_cassette_oneshot_timer->adjust(attotime::from_double(TIME_OF_74LS123(RES_K(10), CAP_N(1)))); + update_cassette(1); + m_cassette_in = bit; + m_cassette_oneshot_timer->adjust(attotime::from_double(TIME_OF_74LS123(RES_K(10), CAP_N(1)))); } } @@ -759,8 +757,8 @@ WRITE_LINE_MEMBER( kc_state::keyboard_cb ) void kc_state::machine_start() { - m_cassette_timer = machine().scheduler().timer_alloc(FUNC(kc_cassette_timer_callback)); - m_cassette_oneshot_timer = machine().scheduler().timer_alloc(FUNC(kc_cassette_oneshot_timer)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_timer_callback),this)); + m_cassette_oneshot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(kc_state::kc_cassette_oneshot_timer),this)); m_ram_base = m_ram->pointer(); diff --git a/src/mess/machine/lisa.c b/src/mess/machine/lisa.c index 47f93882f90..02187e9c095 100644 --- a/src/mess/machine/lisa.c +++ b/src/mess/machine/lisa.c @@ -340,24 +340,23 @@ static void scan_keyboard(running_machine &machine) /* handle mouse moves */ /* shamelessly stolen from machine/mac.c :-) */ -static TIMER_CALLBACK(handle_mouse) +TIMER_CALLBACK_MEMBER(lisa_state::handle_mouse) { - lisa_state *state = machine.driver_data(); int diff_x = 0, diff_y = 0; int new_mx, new_my; #if 0 - if (state->m_COPS_force_unplug) + if (m_COPS_force_unplug) return; /* ???? */ #endif - new_mx = machine.root_device().ioport("MOUSE_X")->read(); - new_my = machine.root_device().ioport("MOUSE_Y")->read(); + new_mx = machine().root_device().ioport("MOUSE_X")->read(); + new_my = machine().root_device().ioport("MOUSE_Y")->read(); /* see if it moved in the x coord */ - if (new_mx != state->m_last_mx) + if (new_mx != m_last_mx) { - diff_x = new_mx - state->m_last_mx; + diff_x = new_mx - m_last_mx; /* check for wrap */ if (diff_x > 0x80) @@ -365,12 +364,12 @@ static TIMER_CALLBACK(handle_mouse) if (diff_x < -0x80) diff_x = -0x100-diff_x; - state->m_last_mx = new_mx; + m_last_mx = new_mx; } /* see if it moved in the y coord */ - if (new_my != state->m_last_my) + if (new_my != m_last_my) { - diff_y = new_my - state->m_last_my; + diff_y = new_my - m_last_my; /* check for wrap */ if (diff_y > 0x80) @@ -378,43 +377,43 @@ static TIMER_CALLBACK(handle_mouse) if (diff_y < -0x80) diff_y = -0x100-diff_y; - state->m_last_my = new_my; + m_last_my = new_my; } /* update any remaining count and then return */ if (diff_x || diff_y) { - if (state->m_mouse_data_offset != -1) + if (m_mouse_data_offset != -1) { - state->m_fifo_data[state->m_mouse_data_offset] += diff_x; - state->m_fifo_data[(state->m_mouse_data_offset+1) & 0x7] += diff_y; + m_fifo_data[m_mouse_data_offset] += diff_x; + m_fifo_data[(m_mouse_data_offset+1) & 0x7] += diff_y; } else { #if 0 - if (state->m_fifo_size <= 5) + if (m_fifo_size <= 5) #else /* trash old data */ - while (state->m_fifo_size > 5) + while (m_fifo_size > 5) { - state->m_fifo_head = (state->m_fifo_head+1) & 0x7; - state->m_fifo_size--; + m_fifo_head = (m_fifo_head+1) & 0x7; + m_fifo_size--; } #endif { /*logerror("Adding 3 bytes of mouse data to FIFO\n");*/ - state->m_fifo_data[state->m_fifo_tail] = 0; - state->m_mouse_data_offset = state->m_fifo_tail = (state->m_fifo_tail+1) & 0x7; - state->m_fifo_data[state->m_fifo_tail] = diff_x; - state->m_fifo_tail = (state->m_fifo_tail+1) & 0x7; - state->m_fifo_data[state->m_fifo_tail] = diff_y; - state->m_fifo_tail = (state->m_fifo_tail+1) & 0x7; - state->m_fifo_size += 3; + m_fifo_data[m_fifo_tail] = 0; + m_mouse_data_offset = m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_data[m_fifo_tail] = diff_x; + m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_data[m_fifo_tail] = diff_y; + m_fifo_tail = (m_fifo_tail+1) & 0x7; + m_fifo_size += 3; /*logerror("handle_mouse : trying to send data to VIA\n");*/ - COPS_send_data_if_possible(machine); + COPS_send_data_if_possible(machine()); } /* else, mouse data is lost forever (correct ??) */ } @@ -422,20 +421,19 @@ static TIMER_CALLBACK(handle_mouse) } /* read command from the VIA port A */ -static TIMER_CALLBACK(read_COPS_command) +TIMER_CALLBACK_MEMBER(lisa_state::read_COPS_command) { - lisa_state *state = machine.driver_data(); int command; - via6522_device *via_0 = machine.device("via6522_0"); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + via6522_device *via_0 = machine().device("via6522_0"); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); - state->m_COPS_Ready = 0; + m_COPS_Ready = 0; /*logerror("read_COPS_command : trying to send data to VIA\n");*/ - COPS_send_data_if_possible(machine); + COPS_send_data_if_possible(machine()); /* some pull-ups allow the COPS to read 1s when the VIA port is not set as output */ - command = (state->m_COPS_command | (~ via_0->read(space, VIA_DDRA))) & 0xff; + command = (m_COPS_command | (~ via_0->read(space, VIA_DDRA))) & 0xff; // printf("Dropping Ready, command = %02x\n", command); @@ -449,9 +447,9 @@ static TIMER_CALLBACK(read_COPS_command) switch ((command & 0xF0) >> 4) { case 0x1: /* write clock data */ - if (state->m_clock_regs.clock_write_ptr != -1) + if (m_clock_regs.clock_write_ptr != -1) { - switch (state->m_clock_regs.clock_write_ptr) + switch (m_clock_regs.clock_write_ptr) { case 0: case 1: @@ -459,57 +457,57 @@ static TIMER_CALLBACK(read_COPS_command) case 3: case 4: /* alarm */ - state->m_clock_regs.alarm &= ~ (0xf << (4 * (4 - state->m_clock_regs.clock_write_ptr))); - state->m_clock_regs.alarm |= immediate << (4 * (4 - state->m_clock_regs.clock_write_ptr)); + m_clock_regs.alarm &= ~ (0xf << (4 * (4 - m_clock_regs.clock_write_ptr))); + m_clock_regs.alarm |= immediate << (4 * (4 - m_clock_regs.clock_write_ptr)); break; case 5: /* year */ - state->m_clock_regs.years = immediate; + m_clock_regs.years = immediate; break; case 6: /* day */ - state->m_clock_regs.days1 = immediate; + m_clock_regs.days1 = immediate; break; case 7: /* day */ - state->m_clock_regs.days2 = immediate; + m_clock_regs.days2 = immediate; break; case 8: /* day */ - state->m_clock_regs.days3 = immediate; + m_clock_regs.days3 = immediate; break; case 9: /* hours */ - state->m_clock_regs.hours1 = immediate; + m_clock_regs.hours1 = immediate; break; case 10: /* hours */ - state->m_clock_regs.hours2 = immediate; + m_clock_regs.hours2 = immediate; break; case 11: /* minutes */ - state->m_clock_regs.minutes1 = immediate; + m_clock_regs.minutes1 = immediate; break; case 12: /* minutes */ - state->m_clock_regs.minutes1 = immediate; + m_clock_regs.minutes1 = immediate; break; case 13: /* seconds */ - state->m_clock_regs.seconds1 = immediate; + m_clock_regs.seconds1 = immediate; break; case 14: /* seconds */ - state->m_clock_regs.seconds2 = immediate; + m_clock_regs.seconds2 = immediate; break; case 15: /* tenth */ - state->m_clock_regs.tenths = immediate; + m_clock_regs.tenths = immediate; break; } - state->m_clock_regs.clock_write_ptr++; - if (state->m_clock_regs.clock_write_ptr == 16) - state->m_clock_regs.clock_write_ptr = -1; + m_clock_regs.clock_write_ptr++; + if (m_clock_regs.clock_write_ptr == 16) + m_clock_regs.clock_write_ptr = -1; } break; @@ -517,11 +515,11 @@ static TIMER_CALLBACK(read_COPS_command) case 0x2: /* set clock mode */ if (immediate & 0x8) { /* start setting the clock */ - state->m_clock_regs.clock_write_ptr = 0; + m_clock_regs.clock_write_ptr = 0; } else { /* clock write disabled */ - state->m_clock_regs.clock_write_ptr = -1; + m_clock_regs.clock_write_ptr = -1; } if (! (immediate & 0x4)) @@ -533,7 +531,7 @@ static TIMER_CALLBACK(read_COPS_command) /* should never happen */ } - state->m_clock_regs.clock_mode = (clock_mode_t)(immediate & 0x3); + m_clock_regs.clock_mode = (clock_mode_t)(immediate & 0x3); break; #if 0 @@ -548,18 +546,18 @@ static TIMER_CALLBACK(read_COPS_command) #endif case 0x5: /* set high nibble of NMI character to nnnn */ - state->m_NMIcode = (state->m_NMIcode & 0x0f) | (immediate << 4); + m_NMIcode = (m_NMIcode & 0x0f) | (immediate << 4); break; case 0x6: /* set low nibble of NMI character to nnnn */ - state->m_NMIcode = (state->m_NMIcode & 0xf0) | immediate; + m_NMIcode = (m_NMIcode & 0xf0) | immediate; break; case 0x7: /* send mouse command */ if (immediate & 0x8) - state->m_mouse_timer->adjust(attotime::zero, 0, attotime::from_msec((immediate & 0x7)*4)); /* enable mouse */ + m_mouse_timer->adjust(attotime::zero, 0, attotime::from_msec((immediate & 0x7)*4)); /* enable mouse */ else - state->m_mouse_timer->reset(); + m_mouse_timer->reset(); break; } } @@ -582,14 +580,14 @@ static TIMER_CALLBACK(read_COPS_command) UINT8 reply[7]; reply[0] = 0x80; - reply[1] = 0xE0 | state->m_clock_regs.years; - reply[2] = (state->m_clock_regs.days1 << 4) | state->m_clock_regs.days2; - reply[3] = (state->m_clock_regs.days3 << 4) | state->m_clock_regs.hours1; - reply[4] = (state->m_clock_regs.hours2 << 4) | state->m_clock_regs.minutes1; - reply[5] = (state->m_clock_regs.minutes2 << 4) | state->m_clock_regs.seconds1; - reply[6] = (state->m_clock_regs.seconds2 << 4) | state->m_clock_regs.tenths; + reply[1] = 0xE0 | m_clock_regs.years; + reply[2] = (m_clock_regs.days1 << 4) | m_clock_regs.days2; + reply[3] = (m_clock_regs.days3 << 4) | m_clock_regs.hours1; + reply[4] = (m_clock_regs.hours2 << 4) | m_clock_regs.minutes1; + reply[5] = (m_clock_regs.minutes2 << 4) | m_clock_regs.seconds1; + reply[6] = (m_clock_regs.seconds2 << 4) | m_clock_regs.tenths; - COPS_queue_data(machine, reply, 7); + COPS_queue_data(machine(), reply, 7); } break; } @@ -597,13 +595,12 @@ static TIMER_CALLBACK(read_COPS_command) } /* this timer callback raises the COPS Ready line, which tells the COPS is about to read a command */ -static TIMER_CALLBACK(set_COPS_ready) +TIMER_CALLBACK_MEMBER(lisa_state::set_COPS_ready) { - lisa_state *state = machine.driver_data(); - state->m_COPS_Ready = 1; + m_COPS_Ready = 1; /* impulsion width : +/- 20us */ - machine.scheduler().timer_set(attotime::from_usec(20), FUNC(read_COPS_command)); + machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(lisa_state::read_COPS_command),this)); } static void reset_COPS(lisa_state *state) @@ -1031,10 +1028,10 @@ DRIVER_INIT_MEMBER(lisa_state,mac_xl) void lisa_state::machine_start() { - m_mouse_timer = machine().scheduler().timer_alloc(FUNC(handle_mouse)); + m_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lisa_state::handle_mouse),this)); /* read command every ms (don't know the real value) */ - machine().scheduler().timer_pulse(attotime::from_msec(1), FUNC(set_COPS_ready)); + machine().scheduler().timer_pulse(attotime::from_msec(1), timer_expired_delegate(FUNC(lisa_state::set_COPS_ready),this)); } void lisa_state::machine_reset() diff --git a/src/mess/machine/lviv.c b/src/mess/machine/lviv.c index 3bbb7f2f6f5..e0131555e78 100644 --- a/src/mess/machine/lviv.c +++ b/src/mess/machine/lviv.c @@ -41,15 +41,15 @@ static void lviv_update_memory (running_machine &machine) } } -static TIMER_CALLBACK( lviv_reset ) +TIMER_CALLBACK_MEMBER(lviv_state::lviv_reset) { - machine.schedule_soft_reset(); + machine().schedule_soft_reset(); } DIRECT_UPDATE_MEMBER(lviv_state::lviv_directoverride) { if (ioport("RESET")->read() & 0x01) - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(lviv_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(lviv_state::lviv_reset),this)); return address; } diff --git a/src/mess/machine/lynx.c b/src/mess/machine/lynx.c index 8c0d4d3f918..c94d1b8ea53 100644 --- a/src/mess/machine/lynx.c +++ b/src/mess/machine/lynx.c @@ -600,11 +600,10 @@ static void lynx_blit_lines(lynx_state *state) } } -static TIMER_CALLBACK(lynx_blitter_timer) +TIMER_CALLBACK_MEMBER(lynx_state::lynx_blitter_timer) { - lynx_state *state = machine.driver_data(); - state->m_blitter.busy=0; // blitter finished - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_blitter.busy=0; // blitter finished + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); } /* @@ -805,7 +804,7 @@ static void lynx_blitter(running_machine &machine) } } - machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(state->m_blitter.memory_accesses), FUNC(lynx_blitter_timer)); + machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(state->m_blitter.memory_accesses), timer_expired_delegate(FUNC(lynx_state::lynx_blitter_timer),state)); } @@ -1394,13 +1393,13 @@ TIM_BORROWOUT EQU %00000001 #define NR_LYNX_TIMERS 8 -static TIMER_CALLBACK(lynx_timer_shot); + static void lynx_timer_init(running_machine &machine, int which) { lynx_state *state = machine.driver_data(); memset( &state->m_timer[which], 0, sizeof(LYNX_TIMER) ); - state->m_timer[which].timer = machine.scheduler().timer_alloc(FUNC(lynx_timer_shot)); + state->m_timer[which].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(lynx_state::lynx_timer_shot),state)); } static void lynx_timer_signal_irq(running_machine &machine, int which) @@ -1506,19 +1505,18 @@ static UINT32 lynx_time_factor(int val) } } -static TIMER_CALLBACK(lynx_timer_shot) +TIMER_CALLBACK_MEMBER(lynx_state::lynx_timer_shot) { - lynx_state *state = machine.driver_data(); - lynx_timer_signal_irq( machine, param ); - if ( ! ( state->m_timer[param].cntrl1 & 0x10 ) ) // if reload not enabled + lynx_timer_signal_irq( machine(), param ); + if ( ! ( m_timer[param].cntrl1 & 0x10 ) ) // if reload not enabled { - state->m_timer[param].timer_active = 0; - state->m_timer[param].cntrl2 |= 8; // set timer done + m_timer[param].timer_active = 0; + m_timer[param].cntrl2 |= 8; // set timer done } else { - attotime t = (attotime::from_hz(lynx_time_factor(state->m_timer[param].cntrl1 & 0x07)) * (state->m_timer[param].bakup + 1)); - state->m_timer[param].timer->adjust(t, param); + attotime t = (attotime::from_hz(lynx_time_factor(m_timer[param].cntrl1 & 0x07)) * (m_timer[param].bakup + 1)); + m_timer[param].timer->adjust(t, param); } } @@ -1616,40 +1614,38 @@ static void lynx_uart_reset(lynx_state *state) memset(&state->m_uart, 0, sizeof(state->m_uart)); } -static TIMER_CALLBACK(lynx_uart_loopback_timer) +TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_loopback_timer) { - lynx_state *state = machine.driver_data(); - state->m_uart.received = FALSE; + m_uart.received = FALSE; } -static TIMER_CALLBACK(lynx_uart_timer) +TIMER_CALLBACK_MEMBER(lynx_state::lynx_uart_timer) { - lynx_state *state = machine.driver_data(); - if (state->m_uart.buffer_loaded) + if (m_uart.buffer_loaded) { - state->m_uart.data_to_send = state->m_uart.buffer; - state->m_uart.buffer_loaded = FALSE; - machine.scheduler().timer_set(attotime::from_usec(11*16), FUNC(lynx_uart_timer)); + m_uart.data_to_send = m_uart.buffer; + m_uart.buffer_loaded = FALSE; + machine().scheduler().timer_set(attotime::from_usec(11*16), timer_expired_delegate(FUNC(lynx_state::lynx_uart_timer),this)); } else { - state->m_uart.sending = FALSE; - state->m_uart.received = TRUE; - state->m_uart.data_received = state->m_uart.data_to_send; - machine.scheduler().timer_set(attotime::from_usec(11*16), FUNC(lynx_uart_loopback_timer)); - if (state->m_uart.serctl & 0x40) + m_uart.sending = FALSE; + m_uart.received = TRUE; + m_uart.data_received = m_uart.data_to_send; + machine().scheduler().timer_set(attotime::from_usec(11*16), timer_expired_delegate(FUNC(lynx_state::lynx_uart_loopback_timer),this)); + if (m_uart.serctl & 0x40) { - state->m_mikey.data[0x81] |= 0x10; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - machine.device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); + m_mikey.data[0x81] |= 0x10; + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); } } - if (state->m_uart.serctl & 0x80) + if (m_uart.serctl & 0x80) { - state->m_mikey.data[0x81] |= 0x10; - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - machine.device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); + m_mikey.data[0x81] |= 0x10; + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, ASSERT_LINE); } } @@ -1696,7 +1692,7 @@ WRITE8_MEMBER(lynx_state::lynx_uart_w) m_uart.sending = TRUE; m_uart.data_to_send = data; // timing not accurate, baude rate should be calculated from timer 4 backup value and clock rate - machine().scheduler().timer_set(attotime::from_usec(11*16), FUNC(lynx_uart_timer)); + machine().scheduler().timer_set(attotime::from_usec(11*16), timer_expired_delegate(FUNC(lynx_state::lynx_uart_timer),this)); } break; } diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c index c8be804ce16..10d918af75b 100644 --- a/src/mess/machine/mac.c +++ b/src/mess/machine/mac.c @@ -127,10 +127,10 @@ extern TIMER_CALLBACK(mac_adb_tick); // macadb.c extern TIMER_CALLBACK(mac_pmu_tick); // macadb.c -static TIMER_CALLBACK(mac_scanline_tick); -static TIMER_CALLBACK(mac_6015_tick); + + static int scan_keyboard(running_machine &machine); -static TIMER_CALLBACK(inquiry_timeout_func); + static void keyboard_receive(running_machine &machine, int val); static DECLARE_READ8_DEVICE_HANDLER(mac_via_in_a); static DECLARE_READ8_DEVICE_HANDLER(mac_via_in_b); @@ -695,32 +695,31 @@ static void keyboard_init(mac_state *mac) /******************* Keyboard <-> VIA communication ***********************/ -static TIMER_CALLBACK(kbd_clock) +TIMER_CALLBACK_MEMBER(mac_state::kbd_clock) { int i; - mac_state *mac = machine.driver_data(); - if (mac->m_kbd_comm == TRUE) + if (m_kbd_comm == TRUE) { for (i=0; i<8; i++) { /* Put data on CB2 if we are sending*/ - if (mac->m_kbd_receive == FALSE) - mac->m_via1->write_cb2(mac->m_kbd_shift_reg&0x80?1:0); - mac->m_kbd_shift_reg <<= 1; - mac->m_via1->write_cb1(0); - mac->m_via1->write_cb1(1); + if (m_kbd_receive == FALSE) + m_via1->write_cb2(m_kbd_shift_reg&0x80?1:0); + m_kbd_shift_reg <<= 1; + m_via1->write_cb1(0); + m_via1->write_cb1(1); } - if (mac->m_kbd_receive == TRUE) + if (m_kbd_receive == TRUE) { - mac->m_kbd_receive = FALSE; + m_kbd_receive = FALSE; /* Process the command received from mac */ - keyboard_receive(machine, mac->m_kbd_shift_reg & 0xff); + keyboard_receive(machine(), m_kbd_shift_reg & 0xff); } else { /* Communication is over */ - mac->m_kbd_comm = FALSE; + m_kbd_comm = FALSE; } } } @@ -732,7 +731,7 @@ static void kbd_shift_out(running_machine &machine, int data) if (mac->m_kbd_comm == TRUE) { mac->m_kbd_shift_reg = data; - machine.scheduler().timer_set(attotime::from_msec(1), FUNC(kbd_clock)); + machine.scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(mac_state::kbd_clock),mac)); } } @@ -745,7 +744,7 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_cb2) /* Mac pulls CB2 down to initiate communication */ mac->m_kbd_comm = TRUE; mac->m_kbd_receive = TRUE; - space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(kbd_clock)); + space.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(mac_state::kbd_clock),mac)); } if (mac->m_kbd_comm == TRUE && mac->m_kbd_receive == TRUE) { @@ -757,11 +756,11 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_cb2) /* called when inquiry times out (1/4s) */ -static TIMER_CALLBACK(inquiry_timeout_func) +TIMER_CALLBACK_MEMBER(mac_state::inquiry_timeout_func) { if (LOG_KEYBOARD) logerror("keyboard enquiry timeout\n"); - kbd_shift_out(machine, 0x7B); /* always send NULL */ + kbd_shift_out(machine(), 0x7B); /* always send NULL */ } /* @@ -1770,12 +1769,10 @@ static WRITE8_DEVICE_HANDLER(mac_via2_out_b) } // This signal is generated internally on RBV, V8, Sonora, VASP, Eagle, etc. -static TIMER_CALLBACK(mac_6015_tick) +TIMER_CALLBACK_MEMBER(mac_state::mac_6015_tick) { - mac_state *mac = machine.driver_data(); - - mac->m_via1->write_ca1(0); - mac->m_via1->write_ca1(1); + m_via1->write_ca1(0); + m_via1->write_ca1(1); } /* ************************************************************************* @@ -1798,10 +1795,10 @@ void mac_state::machine_start() } } - this->m_scanline_timer = machine().scheduler().timer_alloc(FUNC(mac_scanline_tick)); + this->m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_scanline_tick),this)); this->m_scanline_timer->adjust(machine().primary_screen->time_until_pos(0, 0)); - m_6015_timer = machine().scheduler().timer_alloc(FUNC(mac_6015_tick)); + m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::mac_6015_tick),this)); m_6015_timer->adjust(attotime::never); } @@ -2105,7 +2102,7 @@ static void mac_driver_init(running_machine &machine, model_t model) /* setup keyboard */ keyboard_init(mac); - mac->m_inquiry_timeout = machine.scheduler().timer_alloc(FUNC(inquiry_timeout_func)); + mac->m_inquiry_timeout = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::inquiry_timeout_func),mac)); /* save state stuff */ machine.save().register_postload(save_prepost_delegate(FUNC(mac_state_load), mac)); @@ -2251,39 +2248,38 @@ void mac_state::vblank_irq() } } -static TIMER_CALLBACK(mac_scanline_tick) +TIMER_CALLBACK_MEMBER(mac_state::mac_scanline_tick) { int scanline; - mac_state *mac = machine.driver_data(); - if (machine.device("custom") != NULL) + if (machine().device("custom") != NULL) { - mac_sh_updatebuffer(machine.device("custom")); + mac_sh_updatebuffer(machine().device("custom")); } - if (mac->m_rbv_vbltime > 0) + if (m_rbv_vbltime > 0) { - mac->m_rbv_vbltime--; + m_rbv_vbltime--; - if (mac->m_rbv_vbltime == 0) + if (m_rbv_vbltime == 0) { - mac->m_rbv_regs[2] |= 0x40; - mac->rbv_recalc_irqs(); + m_rbv_regs[2] |= 0x40; + rbv_recalc_irqs(); } } - scanline = machine.primary_screen->vpos(); + scanline = machine().primary_screen->vpos(); if (scanline == MAC_V_VIS) - mac->vblank_irq(); + vblank_irq(); /* check for mouse changes at 10 irqs per frame */ - if (mac->m_model <= MODEL_MAC_PLUS) + if (m_model <= MODEL_MAC_PLUS) { if (!(scanline % 10)) - mac->mouse_callback(); + mouse_callback(); } - mac->m_scanline_timer->adjust(machine.primary_screen->time_until_pos((scanline+1) % MAC_V_TOTAL, 0)); + m_scanline_timer->adjust(machine().primary_screen->time_until_pos((scanline+1) % MAC_V_TOTAL, 0)); } WRITE_LINE_MEMBER(mac_state::nubus_irq_9_w) diff --git a/src/mess/machine/macpci.c b/src/mess/machine/macpci.c index 0f2d2eaa79a..ab9073b8c24 100644 --- a/src/mess/machine/macpci.c +++ b/src/mess/machine/macpci.c @@ -22,7 +22,7 @@ #define LOG_ADB 0 #define LOG_VIA 0 -static TIMER_CALLBACK(mac_6015_tick); + /* VIA1 Handlers */ @@ -144,7 +144,7 @@ static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2) void macpci_state::machine_start() { - m_6015_timer = machine().scheduler().timer_alloc(FUNC(mac_6015_tick)); + m_6015_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(macpci_state::mac_6015_tick),this)); m_6015_timer->adjust(attotime::never); } @@ -250,7 +250,6 @@ WRITE_LINE_MEMBER(macpci_state::drq_539x_1_w) { } -static TIMER_CALLBACK(mac_6015_tick) +TIMER_CALLBACK_MEMBER(macpci_state::mac_6015_tick) { -// macpci_state *mac = machine.driver_data(); } diff --git a/src/mess/machine/mbc55x.c b/src/mess/machine/mbc55x.c index ddc01a9956f..a3764259c33 100644 --- a/src/mess/machine/mbc55x.c +++ b/src/mess/machine/mbc55x.c @@ -285,9 +285,9 @@ static void scan_keyboard(running_machine &machine) } } -static TIMER_CALLBACK(keyscan_callback) +TIMER_CALLBACK_MEMBER(mbc55x_state::keyscan_callback) { - scan_keyboard(machine); + scan_keyboard(machine()); } /* i8251 serial */ @@ -409,7 +409,7 @@ void mbc55x_state::machine_start() m_debug_machine=DEBUG_NONE; // Allocate keyscan timer - m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(FUNC(keyscan_callback)); + m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mbc55x_state::keyscan_callback),this)); } diff --git a/src/mess/machine/mbee.c b/src/mess/machine/mbee.c index 175e7663e08..ac8c69d9cf5 100644 --- a/src/mess/machine/mbee.c +++ b/src/mess/machine/mbee.c @@ -129,9 +129,8 @@ WRITE8_MEMBER( mbee_state::mbee_fdc_motor_w ) ************************************************************/ -static TIMER_CALLBACK( mbee256_kbd ) +TIMER_CALLBACK_MEMBER(mbee_state::mbee256_kbd) { - mbee_state *state = machine.driver_data(); /* Keyboard scanner is a Mostek M3870 chip. Its speed of operation is determined by a 15k resistor on pin 2 (XTL2) and is therefore unknown. If a key change is detected (up or down), the /strobe line activates, sending a high to bit 1 of port 2 (one of the pio input lines). The next read of @@ -152,31 +151,31 @@ static TIMER_CALLBACK( mbee256_kbd ) for (i = 0; i < 15; i++) { sprintf(kbdrow,"X%d",i); - pressed[i] = (machine.root_device().ioport(kbdrow)->read()); + pressed[i] = (machine().root_device().ioport(kbdrow)->read()); } /* find what has changed */ for (i = 0; i < 15; i++) { - if (pressed[i] != state->m_mbee256_was_pressed[i]) + if (pressed[i] != m_mbee256_was_pressed[i]) { /* get scankey value */ for (j = 0; j < 8; j++) { - if (BIT(pressed[i]^state->m_mbee256_was_pressed[i], j)) + if (BIT(pressed[i]^m_mbee256_was_pressed[i], j)) { /* put it in the queue */ - state->m_mbee256_q[state->m_mbee256_q_pos] = (i << 3) | j | (BIT(pressed[i], j) ? 0x80 : 0); - if (state->m_mbee256_q_pos < 19) state->m_mbee256_q_pos++; + m_mbee256_q[m_mbee256_q_pos] = (i << 3) | j | (BIT(pressed[i], j) ? 0x80 : 0); + if (m_mbee256_q_pos < 19) m_mbee256_q_pos++; } } - state->m_mbee256_was_pressed[i] = pressed[i]; + m_mbee256_was_pressed[i] = pressed[i]; } } /* if anything queued, cause an interrupt */ - if (state->m_mbee256_q_pos) - state->m_mbee256_key_available = 2; // set irq + if (m_mbee256_q_pos) + m_mbee256_key_available = 2; // set irq } READ8_MEMBER( mbee_state::mbee256_18_r ) @@ -238,12 +237,11 @@ READ8_MEMBER( mbee_state::mbee_07_r ) // read return machine().device("rtc")->read(mem, 1); } -static TIMER_CALLBACK( mbee_rtc_irq ) +TIMER_CALLBACK_MEMBER(mbee_state::mbee_rtc_irq) { - mbee_state *state = machine.driver_data(); - address_space &mem = machine.device("maincpu")->memory().space(AS_IO); - UINT8 data = machine.device("rtc")->read(mem, 12); - if (data) state->m_clock_pulse = 0x80; + address_space &mem = machine().device("maincpu")->memory().space(AS_IO); + UINT8 data = machine().device("rtc")->read(mem, 12); + if (data) m_clock_pulse = 0x80; } @@ -495,10 +493,9 @@ READ8_MEMBER( mbee_state::mbeepc_telcom_high_r ) /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( mbee_reset ) +TIMER_CALLBACK_MEMBER(mbee_state::mbee_reset) { - mbee_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } static void machine_reset_common_disk(running_machine &machine) @@ -512,14 +509,14 @@ static void machine_reset_common_disk(running_machine &machine) MACHINE_RESET_MEMBER(mbee_state,mbee) { membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset)); + machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(mbee_state::mbee_reset),this)); } MACHINE_RESET_MEMBER(mbee_state,mbee56) { machine_reset_common_disk(machine()); membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset)); + machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(mbee_state::mbee_reset),this)); } MACHINE_RESET_MEMBER(mbee_state,mbee64) @@ -547,7 +544,7 @@ MACHINE_RESET_MEMBER(mbee_state,mbee256) m_mbee256_q_pos = 0; mbee256_50_w(mem,0,0); // set banks to default membank("boot")->set_entry(8); // boot time - machine().scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset)); + machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(mbee_state::mbee_reset),this)); } MACHINE_RESET_MEMBER(mbee_state,mbeett) @@ -556,7 +553,7 @@ MACHINE_RESET_MEMBER(mbee_state,mbeett) for (i = 0; i < 15; i++) m_mbee256_was_pressed[i] = 0; m_mbee256_q_pos = 0; membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset)); + machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(mbee_state::mbee_reset),this)); } INTERRUPT_GEN_MEMBER(mbee_state::mbee_interrupt) @@ -713,8 +710,8 @@ DRIVER_INIT_MEMBER(mbee_state,mbee256) membank("bank8l")->configure_entry(0, &RAM[0x0000]); // rom membank("bank8h")->configure_entry(0, &RAM[0x0800]); // rom - machine().scheduler().timer_pulse(attotime::from_hz(1), FUNC(mbee_rtc_irq)); /* timer for rtc */ - machine().scheduler().timer_pulse(attotime::from_hz(25), FUNC(mbee256_kbd)); /* timer for kbd */ + machine().scheduler().timer_pulse(attotime::from_hz(1), timer_expired_delegate(FUNC(mbee_state::mbee_rtc_irq),this)); /* timer for rtc */ + machine().scheduler().timer_pulse(attotime::from_hz(25), timer_expired_delegate(FUNC(mbee_state::mbee256_kbd),this)); /* timer for kbd */ m_size = 0x8000; } @@ -733,8 +730,8 @@ DRIVER_INIT_MEMBER(mbee_state,mbeett) membank("pak")->set_entry(5); membank("telcom")->set_entry(0); - machine().scheduler().timer_pulse(attotime::from_hz(1), FUNC(mbee_rtc_irq)); /* timer for rtc */ - machine().scheduler().timer_pulse(attotime::from_hz(25), FUNC(mbee256_kbd)); /* timer for kbd */ + machine().scheduler().timer_pulse(attotime::from_hz(1), timer_expired_delegate(FUNC(mbee_state::mbee_rtc_irq),this)); /* timer for rtc */ + machine().scheduler().timer_pulse(attotime::from_hz(25), timer_expired_delegate(FUNC(mbee_state::mbee256_kbd),this)); /* timer for kbd */ m_size = 0x8000; } diff --git a/src/mess/machine/microtan.c b/src/mess/machine/microtan.c index afefea20f85..c0326543380 100644 --- a/src/mess/machine/microtan.c +++ b/src/mess/machine/microtan.c @@ -333,10 +333,10 @@ const via6522_interface microtan_via6522_1 = DEVCB_LINE(via_1_irq) }; -static TIMER_CALLBACK(microtan_read_cassette) +TIMER_CALLBACK_MEMBER(microtan_state::microtan_read_cassette) { - double level = (cassette_device_image(machine))->input(); - via6522_device *via_0 = machine.device("via6522_0"); + double level = (cassette_device_image(machine()))->input(); + via6522_device *via_0 = machine().device("via6522_0"); LOG(("microtan_read_cassette: %g\n", level)); if (level < -0.07) @@ -382,9 +382,9 @@ READ8_MEMBER(microtan_state::microtan_bffx_r) /* This callback is called one clock cycle after BFF2 is written (delayed nmi) */ -static TIMER_CALLBACK(microtan_pulse_nmi) +TIMER_CALLBACK_MEMBER(microtan_state::microtan_pulse_nmi) { - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } WRITE8_MEMBER(microtan_state::microtan_bffx_w) @@ -400,7 +400,7 @@ WRITE8_MEMBER(microtan_state::microtan_bffx_w) break; case 1: /* BFF1: write delayed NMI */ LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data)); - machine().scheduler().timer_set(machine().device("maincpu")->cycles_to_attotime(8), FUNC(microtan_pulse_nmi)); + machine().scheduler().timer_set(machine().device("maincpu")->cycles_to_attotime(8), timer_expired_delegate(FUNC(microtan_state::microtan_pulse_nmi),this)); break; case 2: /* BFF2: write keypad column write (what is this meant for?) */ LOG(("microtan_bff2_w: %d <- %02x (keypad column)\n", offset, data)); @@ -566,7 +566,7 @@ DRIVER_INIT_MEMBER(microtan_state,microtan) break; } - m_timer = machine().scheduler().timer_alloc(FUNC(microtan_read_cassette)); + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(microtan_state::microtan_read_cassette),this)); } void microtan_state::machine_reset() diff --git a/src/mess/machine/mikro80.c b/src/mess/machine/mikro80.c index a8321064c0f..9cf46e44016 100644 --- a/src/mess/machine/mikro80.c +++ b/src/mess/machine/mikro80.c @@ -69,15 +69,14 @@ I8255_INTERFACE( mikro80_ppi8255_interface ) }; -static TIMER_CALLBACK( mikro80_reset ) +TIMER_CALLBACK_MEMBER(mikro80_state::mikro80_reset) { - mikro80_state *state = machine.driver_data(); - state->membank("bank1")->set_entry(0); + membank("bank1")->set_entry(0); } void mikro80_state::machine_reset() { - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(mikro80_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(mikro80_state::mikro80_reset),this)); membank("bank1")->set_entry(1); m_keyboard_mask = 0; } diff --git a/src/mess/machine/nes.c b/src/mess/machine/nes.c index 3448f29430c..3b0ceb9ba15 100644 --- a/src/mess/machine/nes.c +++ b/src/mess/machine/nes.c @@ -216,11 +216,10 @@ void nes_state::machine_reset() machine().device("maincpu")->reset(); } -static TIMER_CALLBACK( nes_irq_callback ) +TIMER_CALLBACK_MEMBER(nes_state::nes_irq_callback) { - nes_state *state = machine.driver_data(); - state->m_maincpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); - state->m_irq_timer->adjust(attotime::never); + m_maincpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE); + m_irq_timer->adjust(attotime::never); } static void nes_banks_restore(nes_state *state) @@ -309,7 +308,7 @@ void nes_state::machine_start() } } - m_irq_timer = machine().scheduler().timer_alloc(FUNC(nes_irq_callback)); + m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nes_state::nes_irq_callback),this)); nes_state_register(machine()); } @@ -524,28 +523,28 @@ static void nes_read_input_device( running_machine &machine, int cfg, nes_input } -static TIMER_CALLBACK( lightgun_tick ) +TIMER_CALLBACK_MEMBER(nes_state::lightgun_tick) { - if ((machine.root_device().ioport("CTRLSEL")->read() & 0x000f) == 0x0002) + if ((machine().root_device().ioport("CTRLSEL")->read() & 0x000f) == 0x0002) { /* enable lightpen crosshair */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL); } else { /* disable lightpen crosshair */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_NONE); } - if ((machine.root_device().ioport("CTRLSEL")->read() & 0x00f0) == 0x0030) + if ((machine().root_device().ioport("CTRLSEL")->read() & 0x00f0) == 0x0030) { /* enable lightpen crosshair */ - crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_ALL); + crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_ALL); } else { /* disable lightpen crosshair */ - crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_NONE); + crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_NONE); } } @@ -554,7 +553,7 @@ WRITE8_MEMBER(nes_state::nes_IN0_w) int cfg = ioport("CTRLSEL")->read(); /* Check if lightgun has been chosen as input: if so, enable crosshair */ - machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(nes_state::lightgun_tick),this)); if ((cfg & 0x000f) >= 0x08) // for now we treat the FC keyboard separately from other inputs! { diff --git a/src/mess/machine/ondra.c b/src/mess/machine/ondra.c index 9a80117200c..f51bd814a35 100644 --- a/src/mess/machine/ondra.c +++ b/src/mess/machine/ondra.c @@ -75,11 +75,11 @@ WRITE8_MEMBER(ondra_state::ondra_port_0a_w) { } -static TIMER_CALLBACK(nmi_check_callback) +TIMER_CALLBACK_MEMBER(ondra_state::nmi_check_callback) { - if ((machine.root_device().ioport("NMI")->read() & 1) == 1) + if ((machine().root_device().ioport("NMI")->read() & 1) == 1) { - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } @@ -92,5 +92,5 @@ void ondra_state::machine_reset() void ondra_state::machine_start() { - machine().scheduler().timer_pulse(attotime::from_hz(10), FUNC(nmi_check_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(10), timer_expired_delegate(FUNC(ondra_state::nmi_check_callback),this)); } diff --git a/src/mess/machine/oric.c b/src/mess/machine/oric.c index 875dc372cf0..f694af217c9 100644 --- a/src/mess/machine/oric.c +++ b/src/mess/machine/oric.c @@ -254,15 +254,15 @@ static cassette_image_device *cassette_device_image(running_machine &machine) /* not called yet - this will update the via with the state of the tape data. This allows the via to trigger on bit changes and issue interrupts */ -static TIMER_CALLBACK(oric_refresh_tape) +TIMER_CALLBACK_MEMBER(oric_state::oric_refresh_tape) { int data; int input_port_9; - via6522_device *via_0 = machine.device("via6522_0"); + via6522_device *via_0 = machine().device("via6522_0"); data = 0; - if ((cassette_device_image(machine))->input() > 0.0038) + if ((cassette_device_image(machine()))->input() > 0.0038) data |= 1; /* "A simple cable to catch the vertical retrace signal ! @@ -270,7 +270,7 @@ static TIMER_CALLBACK(oric_refresh_tape) to the via cb1 input. Interrupts can be generated from the vertical sync, and flicker free games can be produced */ - input_port_9 = machine.root_device().ioport("FLOPPY")->read(); + input_port_9 = machine().root_device().ioport("FLOPPY")->read(); /* cable is enabled? */ if ((input_port_9 & 0x08)!=0) { @@ -1048,7 +1048,7 @@ static void oric_common_init_machine(running_machine &machine) state->m_port_314_r = 0; state->m_port_318_r = 0; state->m_port_314_w = 0; - machine.scheduler().timer_pulse(attotime::from_hz(4800), FUNC(oric_refresh_tape)); + machine.scheduler().timer_pulse(attotime::from_hz(4800), timer_expired_delegate(FUNC(oric_state::oric_refresh_tape),state)); } void oric_state::machine_start() diff --git a/src/mess/machine/osborne1.c b/src/mess/machine/osborne1.c index 2953ab25a61..b84c43ccbe8 100644 --- a/src/mess/machine/osborne1.c +++ b/src/mess/machine/osborne1.c @@ -331,10 +331,9 @@ const pia6821_interface osborne1_video_pia_config = //}; -static TIMER_CALLBACK(osborne1_video_callback) +TIMER_CALLBACK_MEMBER(osborne1_state::osborne1_video_callback) { - osborne1_state *state = machine.driver_data(); - int y = machine.primary_screen->vpos(); + int y = machine().primary_screen->vpos(); UINT8 ra=0,chr,gfx,dim; UINT16 x,ma; @@ -342,29 +341,29 @@ static TIMER_CALLBACK(osborne1_video_callback) if ( y == 0 ) { /* Clear CA1 on video PIA */ - state->m_pia1->ca1_w(0); + m_pia1->ca1_w(0); } if ( y == 240 ) { /* Set CA1 on video PIA */ - state->m_pia1->ca1_w(1); + m_pia1->ca1_w(1); } if ( y < 240 ) { ra = y % 10; /* Draw a line of the display */ - ma = (state->m_new_start_y + (y/10)) * 128 + state->m_new_start_x; - UINT16 *p = &state->m_bitmap.pix16(y); + ma = (m_new_start_y + (y/10)) * 128 + m_new_start_x; + UINT16 *p = &m_bitmap.pix16(y); for ( x = 0; x < 52; x++ ) { - chr = machine.device(RAM_TAG)->pointer()[ 0xF000 + ( (ma+x) & 0xFFF ) ]; - dim = machine.device(RAM_TAG)->pointer()[ 0x10000 + ( (ma+x) & 0xFFF ) ] & 0x80; + chr = machine().device(RAM_TAG)->pointer()[ 0xF000 + ( (ma+x) & 0xFFF ) ]; + dim = machine().device(RAM_TAG)->pointer()[ 0x10000 + ( (ma+x) & 0xFFF ) ] & 0x80; if ( (chr & 0x80) && (ra == 9) ) gfx = 0xFF; else - gfx = state->m_p_chargen[ (ra << 7) | ( chr & 0x7F ) ]; + gfx = m_p_chargen[ (ra << 7) | ( chr & 0x7F ) ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? ( dim ? 1 : 2 ) : 0; @@ -380,22 +379,21 @@ static TIMER_CALLBACK(osborne1_video_callback) if ( (ra==2) || (ra== 6) ) { - beep_set_state( state->m_beep, state->m_beep_state ); + beep_set_state( m_beep, m_beep_state ); } else { - beep_set_state( state->m_beep, 0 ); + beep_set_state( m_beep, 0 ); } - 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 )); } -static TIMER_CALLBACK( setup_osborne1 ) +TIMER_CALLBACK_MEMBER(osborne1_state::setup_osborne1) { - osborne1_state *state = machine.driver_data(); - beep_set_state( state->m_beep, 0 ); - beep_set_frequency( state->m_beep, 300 /* 60 * 240 / 2 */ ); - state->m_pia1->ca1_w(0); + beep_set_state( m_beep, 0 ); + beep_set_frequency( m_beep, 300 /* 60 * 240 / 2 */ ); + m_pia1->ca1_w(0); } static void osborne1_load_proc(device_image_interface &image) @@ -453,10 +451,10 @@ DRIVER_INIT_MEMBER(osborne1_state,osborne1) /* Configure the 6850 ACIA */ // acia6850_config( 0, &osborne1_6850_config ); - m_video_timer = machine().scheduler().timer_alloc(FUNC(osborne1_video_callback)); + m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osborne1_state::osborne1_video_callback),this)); m_video_timer->adjust(machine().primary_screen->time_until_pos(1, 0 )); - machine().scheduler().timer_set(attotime::zero, FUNC(setup_osborne1)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(osborne1_state::setup_osborne1),this)); } diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c index e98ab658f6e..ba5147e65da 100644 --- a/src/mess/machine/pc.c +++ b/src/mess/machine/pc.c @@ -291,9 +291,9 @@ const struct pic8259_interface ibm5150_pic8259_config = static emu_timer *pc_int_delay_timer; -static TIMER_CALLBACK( pcjr_delayed_pic8259_irq ) +TIMER_CALLBACK_MEMBER(pc_state::pcjr_delayed_pic8259_irq) { - machine.firstcpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE); + machine().firstcpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE); } static WRITE_LINE_DEVICE_HANDLER( pcjr_pic8259_set_int_line ) @@ -594,7 +594,7 @@ READ8_MEMBER(pc_state::pcjr_nmi_enable_r) } -static TIMER_CALLBACK( pcjr_keyb_signal_callback ) +TIMER_CALLBACK_MEMBER(pc_state::pcjr_keyb_signal_callback) { pcjr_keyb.raw_keyb_data = pcjr_keyb.raw_keyb_data >> 1; pcjr_keyb.signal_count--; @@ -922,25 +922,24 @@ static struct { /* check if any keys are pressed, raise IRQ1 if so */ -static TIMER_CALLBACK( mc1502_keyb_signal_callback ) +TIMER_CALLBACK_MEMBER(pc_state::mc1502_keyb_signal_callback) { - pc_state *st = machine.driver_data(); UINT8 key = 0; - key |= machine.root_device().ioport("Y1")->read(); - key |= machine.root_device().ioport("Y2")->read(); - key |= machine.root_device().ioport("Y3")->read(); - key |= machine.root_device().ioport("Y4")->read(); - key |= machine.root_device().ioport("Y5")->read(); - key |= machine.root_device().ioport("Y6")->read(); - key |= machine.root_device().ioport("Y7")->read(); - key |= machine.root_device().ioport("Y8")->read(); - key |= machine.root_device().ioport("Y9")->read(); - key |= machine.root_device().ioport("Y10")->read(); - key |= machine.root_device().ioport("Y11")->read(); - key |= machine.root_device().ioport("Y12")->read(); - DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, mc1502_keyb.pulsing, - (key || mc1502_keyb.pulsing) ? " will IRQ" : "")); + key |= machine().root_device().ioport("Y1")->read(); + key |= machine().root_device().ioport("Y2")->read(); + key |= machine().root_device().ioport("Y3")->read(); + key |= machine().root_device().ioport("Y4")->read(); + key |= machine().root_device().ioport("Y5")->read(); + key |= machine().root_device().ioport("Y6")->read(); + key |= machine().root_device().ioport("Y7")->read(); + key |= machine().root_device().ioport("Y8")->read(); + key |= machine().root_device().ioport("Y9")->read(); + key |= machine().root_device().ioport("Y10")->read(); + key |= machine().root_device().ioport("Y11")->read(); + key |= machine().root_device().ioport("Y12")->read(); +// DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, mc1502_keyb.pulsing, +// (key || mc1502_keyb.pulsing) ? " will IRQ" : "")); /* If a key is pressed and we're not pulsing yet, start pulsing the IRQ1; @@ -954,7 +953,7 @@ static TIMER_CALLBACK( mc1502_keyb_signal_callback ) } if (mc1502_keyb.pulsing) { - pic8259_ir1_w(st->m_pic8259, (mc1502_keyb.pulsing & 1)); + pic8259_ir1_w(m_pic8259, (mc1502_keyb.pulsing & 1)); mc1502_keyb.pulsing--; } } @@ -1486,7 +1485,7 @@ MACHINE_START_MEMBER(pc_state,mc1502) */ pic8259_ir1_w(m_pic8259, 1); memset(&mc1502_keyb, 0, sizeof(mc1502_keyb)); - mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(FUNC(mc1502_keyb_signal_callback)); + mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::mc1502_keyb_signal_callback),this)); mc1502_keyb.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) ); } @@ -1494,8 +1493,8 @@ MACHINE_START_MEMBER(pc_state,mc1502) MACHINE_START_MEMBER(pc_state,pcjr) { pc_fdc_init( machine(), &pcjr_fdc_interface_nc ); - pcjr_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(FUNC(pcjr_keyb_signal_callback)); - pc_int_delay_timer = machine().scheduler().timer_alloc(FUNC(pcjr_delayed_pic8259_irq)); + pcjr_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pcjr_keyb_signal_callback),this)); + pc_int_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pcjr_delayed_pic8259_irq),this)); m_maincpu = machine().device("maincpu" ); m_maincpu->set_irq_acknowledge_callback(pc_irq_callback); @@ -1679,7 +1678,7 @@ static struct { emu_timer *timer; } pc_rtc; -static TIMER_CALLBACK(pc_rtc_timer) +TIMER_CALLBACK_MEMBER(pc_state::pc_rtc_timer) { int year; if (++pc_rtc.data[2]>=60) { @@ -1704,8 +1703,9 @@ static TIMER_CALLBACK(pc_rtc_timer) void pc_rtc_init(running_machine &machine) { + pc_state *state = machine.driver_data(); memset(&pc_rtc,0,sizeof(pc_rtc)); - pc_rtc.timer = machine.scheduler().timer_alloc(FUNC(pc_rtc_timer)); + pc_rtc.timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pc_rtc_timer),state)); pc_rtc.timer->adjust(attotime::zero, 0, attotime(1,0)); } diff --git a/src/mess/machine/pc1251.c b/src/mess/machine/pc1251.c index 7d7841d6ec3..aa7dcace9fa 100644 --- a/src/mess/machine/pc1251.c +++ b/src/mess/machine/pc1251.c @@ -100,10 +100,9 @@ MACHINE_START( pc1251 ) machine.device("ram_nvram")->set_base(ram, 0x4800); } -static TIMER_CALLBACK(pc1251_power_up) +TIMER_CALLBACK_MEMBER(pc1251_state::pc1251_power_up) { - pc1251_state *state = machine.driver_data(); - state->m_power = 0; + m_power = 0; } DRIVER_INIT_MEMBER(pc1251_state,pc1251) @@ -113,6 +112,6 @@ DRIVER_INIT_MEMBER(pc1251_state,pc1251) for (i=0; i<128; i++) gfx[i]=i; m_power = 1; - machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1251_power_up)); + machine().scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1251_state::pc1251_power_up),this)); } diff --git a/src/mess/machine/pc1350.c b/src/mess/machine/pc1350.c index bae1d82cfa5..46e1f8e66b8 100644 --- a/src/mess/machine/pc1350.c +++ b/src/mess/machine/pc1350.c @@ -90,10 +90,9 @@ int pc1350_brk(device_t *device) return (device->machine().root_device().ioport("EXTRA")->read() & 0x01); } -static TIMER_CALLBACK(pc1350_power_up) +TIMER_CALLBACK_MEMBER(pc1350_state::pc1350_power_up) { - pc1350_state *state = machine.driver_data(); - state->m_power=0; + m_power=0; } MACHINE_START( pc1350 ) @@ -102,7 +101,7 @@ MACHINE_START( pc1350 ) address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); state->m_power = 1; - machine.scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1350_power_up)); + machine.scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1350_state::pc1350_power_up),state)); space.install_readwrite_bank(0x6000, 0x6fff, "bank1"); state->membank("bank1")->set_base(&machine.device(RAM_TAG)->pointer()[0x0000]); diff --git a/src/mess/machine/pc1401.c b/src/mess/machine/pc1401.c index f8305f56895..a230c53d3f4 100644 --- a/src/mess/machine/pc1401.c +++ b/src/mess/machine/pc1401.c @@ -124,10 +124,9 @@ MACHINE_START( pc1401 ) machine.device("ram_nvram")->set_base(ram, 0x2800); } -static TIMER_CALLBACK(pc1401_power_up) +TIMER_CALLBACK_MEMBER(pc1401_state::pc1401_power_up) { - pc1401_state *state = machine.driver_data(); - state->m_power = 0; + m_power = 0; } DRIVER_INIT_MEMBER(pc1401_state,pc1401) @@ -234,5 +233,5 @@ DRIVER_INIT_MEMBER(pc1401_state,pc1401) gfx[i]=i; m_power = 1; - machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1401_power_up)); + machine().scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1401_state::pc1401_power_up),this)); } diff --git a/src/mess/machine/pc1403.c b/src/mess/machine/pc1403.c index 0411bb50f66..afae6b76249 100644 --- a/src/mess/machine/pc1403.c +++ b/src/mess/machine/pc1403.c @@ -152,10 +152,9 @@ MACHINE_START( pc1403 ) machine.device("ram_nvram")->set_base(ram, 0x8000); } -static TIMER_CALLBACK(pc1403_power_up) +TIMER_CALLBACK_MEMBER(pc1403_state::pc1403_power_up) { - pc1403_state *state = machine.driver_data(); - state->m_power=0; + m_power=0; } DRIVER_INIT_MEMBER(pc1403_state,pc1403) @@ -166,7 +165,7 @@ DRIVER_INIT_MEMBER(pc1403_state,pc1403) for (i=0; i<128; i++) gfx[i]=i; m_power = 1; - machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1403_power_up)); + machine().scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1403_state::pc1403_power_up),this)); membank("bank1")->set_base(memregion("user1")->base()); } diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index 3232533a03f..8fa2ad0054d 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -103,11 +103,11 @@ const msm5205_interface pce_cd_msm5205_interface = { /* prototypes */ static void pce_cd_init( running_machine &machine ); static void pce_cd_set_irq_line( running_machine &machine, int num, int state ); -static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback ); -static TIMER_CALLBACK( pce_cd_cdda_fadeout_callback ); -static TIMER_CALLBACK( pce_cd_cdda_fadein_callback ); -static TIMER_CALLBACK( pce_cd_adpcm_fadeout_callback ); -static TIMER_CALLBACK( pce_cd_adpcm_fadein_callback ); + + + + + WRITE8_MEMBER(pce_state::pce_sf2_banking_w) { @@ -1118,10 +1118,9 @@ static void pce_cd_set_irq_line( running_machine &machine, int num, int state ) } } -static TIMER_CALLBACK( pce_cd_data_timer_callback ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_data_timer_callback) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; + pce_cd_t &pce_cd = m_cd; if ( pce_cd.data_buffer_index == pce_cd.data_buffer_size ) { /* Read next data sector */ @@ -1208,19 +1207,19 @@ static void pce_cd_init( running_machine &machine ) } } - pce_cd.data_timer = machine.scheduler().timer_alloc(FUNC(pce_cd_data_timer_callback)); + pce_cd.data_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_state::pce_cd_data_timer_callback),state)); pce_cd.data_timer->adjust(attotime::never); - pce_cd.adpcm_dma_timer = machine.scheduler().timer_alloc(FUNC(pce_cd_adpcm_dma_timer_callback)); + pce_cd.adpcm_dma_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_state::pce_cd_adpcm_dma_timer_callback),state)); pce_cd.adpcm_dma_timer->adjust(attotime::never); - pce_cd.cdda_fadeout_timer = machine.scheduler().timer_alloc(FUNC(pce_cd_cdda_fadeout_callback)); + pce_cd.cdda_fadeout_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_state::pce_cd_cdda_fadeout_callback),state)); pce_cd.cdda_fadeout_timer->adjust(attotime::never); - pce_cd.cdda_fadein_timer = machine.scheduler().timer_alloc(FUNC(pce_cd_cdda_fadein_callback)); + pce_cd.cdda_fadein_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_state::pce_cd_cdda_fadein_callback),state)); pce_cd.cdda_fadein_timer->adjust(attotime::never); - pce_cd.adpcm_fadeout_timer = machine.scheduler().timer_alloc(FUNC(pce_cd_adpcm_fadeout_callback)); + pce_cd.adpcm_fadeout_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_state::pce_cd_adpcm_fadeout_callback),state)); pce_cd.adpcm_fadeout_timer->adjust(attotime::never); - pce_cd.adpcm_fadein_timer = machine.scheduler().timer_alloc(FUNC(pce_cd_adpcm_fadein_callback)); + pce_cd.adpcm_fadein_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pce_state::pce_cd_adpcm_fadein_callback),state)); pce_cd.adpcm_fadein_timer->adjust(attotime::never); } @@ -1249,78 +1248,74 @@ static void pce_cd_set_adpcm_ram_byte(running_machine &machine, UINT8 val) } } -static TIMER_CALLBACK( pce_cd_cdda_fadeout_callback ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_cdda_fadeout_callback) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; + pce_cd_t &pce_cd = m_cd; pce_cd.cdda_volume-= 0.1; if(pce_cd.cdda_volume <= 0) { pce_cd.cdda_volume = 0.0; - cdda_set_volume(machine.device("cdda"), 0.0); + cdda_set_volume(machine().device("cdda"), 0.0); pce_cd.cdda_fadeout_timer->adjust(attotime::never); } else { - cdda_set_volume(machine.device("cdda"), pce_cd.cdda_volume); + cdda_set_volume(machine().device("cdda"), pce_cd.cdda_volume); pce_cd.cdda_fadeout_timer->adjust(attotime::from_usec(param), param); } } -static TIMER_CALLBACK( pce_cd_cdda_fadein_callback ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_cdda_fadein_callback) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; + pce_cd_t &pce_cd = m_cd; pce_cd.cdda_volume+= 0.1; if(pce_cd.cdda_volume >= 100.0) { pce_cd.cdda_volume = 100.0; - cdda_set_volume(machine.device("cdda"), 100.0); + cdda_set_volume(machine().device("cdda"), 100.0); pce_cd.cdda_fadein_timer->adjust(attotime::never); } else { - cdda_set_volume(machine.device("cdda"), pce_cd.cdda_volume); + cdda_set_volume(machine().device("cdda"), pce_cd.cdda_volume); pce_cd.cdda_fadein_timer->adjust(attotime::from_usec(param), param); } } -static TIMER_CALLBACK( pce_cd_adpcm_fadeout_callback ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_adpcm_fadeout_callback) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; + pce_cd_t &pce_cd = m_cd; pce_cd.adpcm_volume-= 0.1; if(pce_cd.adpcm_volume <= 0) { pce_cd.adpcm_volume = 0.0; - msm5205_set_volume(machine.device("msm5205"), 0.0); + msm5205_set_volume(machine().device("msm5205"), 0.0); pce_cd.adpcm_fadeout_timer->adjust(attotime::never); } else { - msm5205_set_volume(machine.device("msm5205"), pce_cd.adpcm_volume); + msm5205_set_volume(machine().device("msm5205"), pce_cd.adpcm_volume); pce_cd.adpcm_fadeout_timer->adjust(attotime::from_usec(param), param); } } -static TIMER_CALLBACK( pce_cd_adpcm_fadein_callback ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_adpcm_fadein_callback) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; + pce_cd_t &pce_cd = m_cd; pce_cd.adpcm_volume+= 0.1; if(pce_cd.adpcm_volume >= 100.0) { pce_cd.adpcm_volume = 100.0; - msm5205_set_volume(machine.device("msm5205"), 100.0); + msm5205_set_volume(machine().device("msm5205"), 100.0); pce_cd.adpcm_fadein_timer->adjust(attotime::never); } else { - msm5205_set_volume(machine.device("msm5205"), pce_cd.adpcm_volume); + msm5205_set_volume(machine().device("msm5205"), pce_cd.adpcm_volume); pce_cd.adpcm_fadein_timer->adjust(attotime::from_usec(param), param); } } @@ -1515,13 +1510,12 @@ WRITE8_MEMBER(pce_state::pce_cd_intf_w) pce_cd_update(machine()); } -static TIMER_CALLBACK( pce_cd_clear_ack ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_clear_ack) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; - pce_cd_update(machine); + pce_cd_t &pce_cd = m_cd; + pce_cd_update(machine()); pce_cd.scsi_ACK = 0; - pce_cd_update(machine); + pce_cd_update(machine()); if ( pce_cd.scsi_CD ) { pce_cd.regs[0x0B] &= 0xFE; @@ -1538,20 +1532,19 @@ static UINT8 pce_cd_get_cd_data_byte(running_machine &machine) if ( pce_cd.scsi_IO ) { pce_cd.scsi_ACK = 1; - machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(15), FUNC(pce_cd_clear_ack)); + machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(15), timer_expired_delegate(FUNC(pce_state::pce_cd_clear_ack),state)); } } return data; } -static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback ) +TIMER_CALLBACK_MEMBER(pce_state::pce_cd_adpcm_dma_timer_callback) { - pce_state *state = machine.driver_data(); - pce_cd_t &pce_cd = state->m_cd; + pce_cd_t &pce_cd = m_cd; if ( pce_cd.scsi_REQ && ! pce_cd.scsi_ACK && ! pce_cd.scsi_CD && pce_cd.scsi_IO ) { - pce_cd.adpcm_ram[pce_cd.adpcm_write_ptr] = pce_cd_get_cd_data_byte(machine); + pce_cd.adpcm_ram[pce_cd.adpcm_write_ptr] = pce_cd_get_cd_data_byte(machine()); pce_cd.adpcm_write_ptr = ( pce_cd.adpcm_write_ptr + 1 ) & 0xFFFF; pce_cd.regs[0x0c] &= ~4; diff --git a/src/mess/machine/pecom.c b/src/mess/machine/pecom.c index 25ec32d87c8..7bc636af9e7 100644 --- a/src/mess/machine/pecom.c +++ b/src/mess/machine/pecom.c @@ -12,16 +12,15 @@ #include "machine/ram.h" #include "includes/pecom.h" -static TIMER_CALLBACK( reset_tick ) +TIMER_CALLBACK_MEMBER(pecom_state::reset_tick) { - pecom_state *state = machine.driver_data(); - state->m_reset = 1; + m_reset = 1; } void pecom_state::machine_start() { - m_reset_timer = machine().scheduler().timer_alloc(FUNC(reset_tick)); + m_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pecom_state::reset_tick),this)); } void pecom_state::machine_reset() diff --git a/src/mess/machine/pet.c b/src/mess/machine/pet.c index 497d9045761..e263e555b49 100644 --- a/src/mess/machine/pet.c +++ b/src/mess/machine/pet.c @@ -618,29 +618,28 @@ WRITE8_HANDLER( superpet_w ) } } -static TIMER_CALLBACK( pet_interrupt ) +TIMER_CALLBACK_MEMBER(pet_state::pet_interrupt) { - pet_state *state = machine.driver_data(); - pia6821_device *pia_0 = machine.device("pia_0"); + pia6821_device *pia_0 = machine().device("pia_0"); - pia_0->cb1_w(state->m_pia_level); - state->m_pia_level = !state->m_pia_level; + pia_0->cb1_w(m_pia_level); + m_pia_level = !m_pia_level; } -static TIMER_CALLBACK( pet_tape1_timer ) +TIMER_CALLBACK_MEMBER(pet_state::pet_tape1_timer) { - pia6821_device *pia_0 = machine.device("pia_0"); + pia6821_device *pia_0 = machine().device("pia_0"); // cassette 1 - UINT8 data = (machine.device(CASSETTE_TAG)->input() > +0.0) ? 1 : 0; + UINT8 data = (machine().device(CASSETTE_TAG)->input() > +0.0) ? 1 : 0; pia_0->ca1_w(data); } -static TIMER_CALLBACK( pet_tape2_timer ) +TIMER_CALLBACK_MEMBER(pet_state::pet_tape2_timer) { - via6522_device *via_0 = machine.device("via6522_0"); + via6522_device *via_0 = machine().device("via6522_0"); // cassette 2 - UINT8 data = (machine.device(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0; + UINT8 data = (machine().device(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0; via_0->write_cb1(data); } @@ -671,11 +670,11 @@ static void pet_common_driver_init( running_machine &machine ) } /* pet clock */ - machine.scheduler().timer_pulse(attotime::from_msec(10), FUNC(pet_interrupt)); + machine.scheduler().timer_pulse(attotime::from_msec(10), timer_expired_delegate(FUNC(pet_state::pet_interrupt),state)); /* datasette */ - state->m_datasette1_timer = machine.scheduler().timer_alloc(FUNC(pet_tape1_timer)); - state->m_datasette2_timer = machine.scheduler().timer_alloc(FUNC(pet_tape2_timer)); + state->m_datasette1_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::pet_tape1_timer),state)); + state->m_datasette2_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pet_state::pet_tape2_timer),state)); } diff --git a/src/mess/machine/pmd85.c b/src/mess/machine/pmd85.c index 987f0596b87..dc85dacc954 100644 --- a/src/mess/machine/pmd85.c +++ b/src/mess/machine/pmd85.c @@ -787,39 +787,38 @@ I8255_INTERFACE( mato_ppi8255_interface ) }; -static TIMER_CALLBACK(pmd85_cassette_timer_callback) +TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback) { - pmd85_state *state = machine.driver_data(); - i8251_device *uart = machine.device("uart"); - serial_source_device *ser = machine.device("sercas"); + i8251_device *uart = machine().device("uart"); + serial_source_device *ser = machine().device("sercas"); int data; int current_level; - if (!(machine.root_device().ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ + if (!(machine().root_device().ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ { /* tape reading */ - if (machine.device(CASSETTE_TAG)->get_state()&CASSETTE_PLAY) + if (machine().device(CASSETTE_TAG)->get_state()&CASSETTE_PLAY) { - switch (state->m_model) + switch (m_model) { case PMD85_1: - if (state->m_clk_level_tape) + if (m_clk_level_tape) { - state->m_previous_level = ((machine.device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; - state->m_clk_level_tape = 0; + m_previous_level = ((machine().device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; + m_clk_level_tape = 0; } else { - current_level = ((machine.device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; + current_level = ((machine().device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; - if (state->m_previous_level!=current_level) + if (m_previous_level!=current_level) { - data = (!state->m_previous_level && current_level) ? 1 : 0; + data = (!m_previous_level && current_level) ? 1 : 0; ser->send_bit(data); uart->receive_clock(); - state->m_clk_level_tape = 1; + m_clk_level_tape = 1; } } return; @@ -834,37 +833,37 @@ static TIMER_CALLBACK(pmd85_cassette_timer_callback) } /* tape writing */ - if (machine.device(CASSETTE_TAG)->get_state()&CASSETTE_RECORD) + if (machine().device(CASSETTE_TAG)->get_state()&CASSETTE_RECORD) { data = ser->get_in_data_bit(); - data ^= state->m_clk_level_tape; - machine.device(CASSETTE_TAG)->output(data&0x01 ? 1 : -1); + data ^= m_clk_level_tape; + machine().device(CASSETTE_TAG)->output(data&0x01 ? 1 : -1); - if (!state->m_clk_level_tape) + if (!m_clk_level_tape) uart->transmit_clock(); - state->m_clk_level_tape = state->m_clk_level_tape ? 0 : 1; + m_clk_level_tape = m_clk_level_tape ? 0 : 1; return; } - state->m_clk_level_tape = 1; + m_clk_level_tape = 1; - if (!state->m_clk_level) + if (!m_clk_level) uart->transmit_clock(); - state->m_clk_level = state->m_clk_level ? 0 : 1; + m_clk_level = m_clk_level ? 0 : 1; } } -static TIMER_CALLBACK( pmd_reset ) +TIMER_CALLBACK_MEMBER(pmd85_state::pmd_reset) { - machine.schedule_soft_reset(); + machine().schedule_soft_reset(); } DIRECT_UPDATE_MEMBER(pmd85_state::pmd85_opbaseoverride) { if (ioport("RESET")->read() & 0x01) - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(pmd_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(pmd85_state::pmd_reset),this)); return address; } @@ -873,7 +872,7 @@ static void pmd85_common_driver_init (running_machine &machine) pmd85_state *state = machine.driver_data(); state->m_previous_level = 0; state->m_clk_level = state->m_clk_level_tape = 1; - state->m_cassette_timer = machine.scheduler().timer_alloc(FUNC(pmd85_cassette_timer_callback)); + state->m_cassette_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pmd85_state::pmd85_cassette_timer_callback),state)); state->m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(2400)); } @@ -918,13 +917,12 @@ DRIVER_INIT_MEMBER(pmd85_state,c2717) pmd85_common_driver_init(machine()); } -static TIMER_CALLBACK( setup_machine_state ) +TIMER_CALLBACK_MEMBER(pmd85_state::setup_machine_state) { - pmd85_state *state = machine.driver_data(); - if (state->m_model != MATO) + if (m_model != MATO) { - i8251_device *uart = machine.device("uart"); - serial_source_device *ser = machine.device("sercas"); + i8251_device *uart = machine().device("uart"); + serial_source_device *ser = machine().device("sercas"); uart->connect(ser); } } @@ -958,7 +956,7 @@ void pmd85_state::machine_reset() m_startup_mem_map = 1; update_memory(machine()); - machine().scheduler().timer_set(attotime::zero, FUNC(setup_machine_state)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(pmd85_state::setup_machine_state),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(pmd85_state::pmd85_opbaseoverride), this)); } diff --git a/src/mess/machine/pokemini.c b/src/mess/machine/pokemini.c index 49eb2a84b66..e83aadae405 100644 --- a/src/mess/machine/pokemini.c +++ b/src/mess/machine/pokemini.c @@ -189,202 +189,194 @@ static void pokemini_update_sound( running_machine &machine ) } -static TIMER_CALLBACK(pokemini_seconds_timer_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_seconds_timer_callback) { - pokemini_state *state = machine.driver_data(); - if ( state->m_pm_reg[0x08] & 0x01 ) + if ( m_pm_reg[0x08] & 0x01 ) { - state->m_pm_reg[0x09] += 1; - if ( ! state->m_pm_reg[0x09] ) + m_pm_reg[0x09] += 1; + if ( ! m_pm_reg[0x09] ) { - state->m_pm_reg[0x0A] += 1; - if ( ! state->m_pm_reg[0x0A] ) + m_pm_reg[0x0A] += 1; + if ( ! m_pm_reg[0x0A] ) { - state->m_pm_reg[0x0B] += 1; + m_pm_reg[0x0B] += 1; } } } } -static TIMER_CALLBACK(pokemini_256hz_timer_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_256hz_timer_callback) { - pokemini_state *state = machine.driver_data(); - if ( state->m_pm_reg[0x40] & 0x01 ) + if ( m_pm_reg[0x40] & 0x01 ) { - state->m_pm_reg[0x41] += 1; + m_pm_reg[0x41] += 1; /* Check if the 32Hz IRQ should be triggered */ - if ( ! ( state->m_pm_reg[0x41] & 0x07 ) ) + if ( ! ( m_pm_reg[0x41] & 0x07 ) ) { - state->m_pm_reg[0x28] |= 0x20; + m_pm_reg[0x28] |= 0x20; /* Check if the 8Hz IRQ should be triggered */ - if ( ! ( state->m_pm_reg[0x41] & 0x1F ) ) + if ( ! ( m_pm_reg[0x41] & 0x1F ) ) { - state->m_pm_reg[0x28] |= 0x10; + m_pm_reg[0x28] |= 0x10; /* Check if the 2Hz IRQ should be triggered */ - if ( ! ( state->m_pm_reg[0x41] & 0x7F ) ) + if ( ! ( m_pm_reg[0x41] & 0x7F ) ) { - state->m_pm_reg[0x28] |= 0x08; + m_pm_reg[0x28] |= 0x08; /* Check if the 1Hz IRQ should be triggered */ - if ( ! state->m_pm_reg[0x41] ) + if ( ! m_pm_reg[0x41] ) { - state->m_pm_reg[0x28] |= 0x04; + m_pm_reg[0x28] |= 0x04; } } } - pokemini_check_irqs( machine ); + pokemini_check_irqs( machine() ); } } } -static TIMER_CALLBACK(pokemini_timer1_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_timer1_callback) { - pokemini_state *state = machine.driver_data(); - state->m_pm_reg[0x36] -= 1; + m_pm_reg[0x36] -= 1; /* Check for underflow of timer */ - if ( state->m_pm_reg[0x36] == 0xFF ) + if ( m_pm_reg[0x36] == 0xFF ) { /* Check if timer1 is running in 16bit mode */ - if ( state->m_pm_reg[0x30] & 0x80 ) + if ( m_pm_reg[0x30] & 0x80 ) { - state->m_pm_reg[0x37] -= 1; - if ( state->m_pm_reg[0x37] == 0xFF ) + m_pm_reg[0x37] -= 1; + if ( m_pm_reg[0x37] == 0xFF ) { - state->m_pm_reg[0x27] |= 0x08; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x36] = state->m_pm_reg[0x32]; - state->m_pm_reg[0x37] = state->m_pm_reg[0x33]; + m_pm_reg[0x27] |= 0x08; + pokemini_check_irqs( machine() ); + m_pm_reg[0x36] = m_pm_reg[0x32]; + m_pm_reg[0x37] = m_pm_reg[0x33]; } } else { - state->m_pm_reg[0x27] |= 0x04; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x36] = state->m_pm_reg[0x32]; + m_pm_reg[0x27] |= 0x04; + pokemini_check_irqs( machine() ); + m_pm_reg[0x36] = m_pm_reg[0x32]; } } } -static TIMER_CALLBACK(pokemini_timer1_hi_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_timer1_hi_callback) { - pokemini_state *state = machine.driver_data(); - state->m_pm_reg[0x37] -= 1; + m_pm_reg[0x37] -= 1; /* Check for underflow of timer */ - if ( state->m_pm_reg[0x37] == 0xFF ) + if ( m_pm_reg[0x37] == 0xFF ) { - state->m_pm_reg[0x27] |= 0x08; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x37] = state->m_pm_reg[0x33]; + m_pm_reg[0x27] |= 0x08; + pokemini_check_irqs( machine() ); + m_pm_reg[0x37] = m_pm_reg[0x33]; } } -static TIMER_CALLBACK(pokemini_timer2_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_timer2_callback) { - pokemini_state *state = machine.driver_data(); - state->m_pm_reg[0x3E] -= 1; + m_pm_reg[0x3E] -= 1; /* Check for underflow of timer */ - if ( state->m_pm_reg[0x3E] == 0xFF ) + if ( m_pm_reg[0x3E] == 0xFF ) { /* Check if timer2 is running in 16bit mode */ - if ( state->m_pm_reg[0x38] & 0x80 ) + if ( m_pm_reg[0x38] & 0x80 ) { - state->m_pm_reg[0x3F] -= 1; - if ( state->m_pm_reg[0x3F] == 0xFF ) + m_pm_reg[0x3F] -= 1; + if ( m_pm_reg[0x3F] == 0xFF ) { - state->m_pm_reg[0x27] |= 0x20; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x3E] = state->m_pm_reg[0x3A]; - state->m_pm_reg[0x3F] = state->m_pm_reg[0x3B]; + m_pm_reg[0x27] |= 0x20; + pokemini_check_irqs( machine() ); + m_pm_reg[0x3E] = m_pm_reg[0x3A]; + m_pm_reg[0x3F] = m_pm_reg[0x3B]; } } else { - state->m_pm_reg[0x27] |= 0x10; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x3E] = state->m_pm_reg[0x3A]; + m_pm_reg[0x27] |= 0x10; + pokemini_check_irqs( machine() ); + m_pm_reg[0x3E] = m_pm_reg[0x3A]; } } } -static TIMER_CALLBACK(pokemini_timer2_hi_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_timer2_hi_callback) { - pokemini_state *state = machine.driver_data(); - state->m_pm_reg[0x3F] -= 1; + m_pm_reg[0x3F] -= 1; /* Check for underfow of timer */ - if ( state->m_pm_reg[0x3F] == 0xFF ) + if ( m_pm_reg[0x3F] == 0xFF ) { - state->m_pm_reg[0x27] |= 0x20; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x3F] = state->m_pm_reg[0x3B]; + m_pm_reg[0x27] |= 0x20; + pokemini_check_irqs( machine() ); + m_pm_reg[0x3F] = m_pm_reg[0x3B]; } } -static TIMER_CALLBACK(pokemini_timer3_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_timer3_callback) { - pokemini_state *state = machine.driver_data(); - state->m_pm_reg[0x4E] -= 1; + m_pm_reg[0x4E] -= 1; /* Check for underflow of timer */ - if ( state->m_pm_reg[0x4E] == 0xFF ) + if ( m_pm_reg[0x4E] == 0xFF ) { /* Check if timer3 is running in 16bit mode */ - if ( state->m_pm_reg[0x48] & 0x80 ) + if ( m_pm_reg[0x48] & 0x80 ) { - state->m_pm_reg[0x4F] -= 1; - if ( state->m_pm_reg[0x4F] == 0xFF ) + m_pm_reg[0x4F] -= 1; + if ( m_pm_reg[0x4F] == 0xFF ) { - state->m_pm_reg[0x27] |= 0x02; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x4E] = state->m_pm_reg[0x4A]; - state->m_pm_reg[0x4F] = state->m_pm_reg[0x4B]; + m_pm_reg[0x27] |= 0x02; + pokemini_check_irqs( machine() ); + m_pm_reg[0x4E] = m_pm_reg[0x4A]; + m_pm_reg[0x4F] = m_pm_reg[0x4B]; } } else { - state->m_pm_reg[0x4E] = state->m_pm_reg[0x4A]; + m_pm_reg[0x4E] = m_pm_reg[0x4A]; } } - if ( state->m_pm_reg[0x48] & 0x80 ) + if ( m_pm_reg[0x48] & 0x80 ) { - if ( ( state->m_pm_reg[0x4E] == state->m_pm_reg[0x4C] ) && ( state->m_pm_reg[0x4F] == state->m_pm_reg[0x4D] ) ) + if ( ( m_pm_reg[0x4E] == m_pm_reg[0x4C] ) && ( m_pm_reg[0x4F] == m_pm_reg[0x4D] ) ) { - state->m_pm_reg[0x27] |= 0x01; - pokemini_check_irqs( machine ); + m_pm_reg[0x27] |= 0x01; + pokemini_check_irqs( machine() ); } - pokemini_update_sound( machine ); + pokemini_update_sound( machine() ); } } -static TIMER_CALLBACK(pokemini_timer3_hi_callback) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_timer3_hi_callback) { - pokemini_state *state = machine.driver_data(); - state->m_pm_reg[0x4F] -= 1; + m_pm_reg[0x4F] -= 1; /* Check for underflow of timer */ - if ( state->m_pm_reg[0x4F] == 0xFF ) + if ( m_pm_reg[0x4F] == 0xFF ) { - state->m_pm_reg[0x27] |= 0x02; - pokemini_check_irqs( machine ); - state->m_pm_reg[0x4F] = state->m_pm_reg[0x4B]; + m_pm_reg[0x27] |= 0x02; + pokemini_check_irqs( machine() ); + m_pm_reg[0x4F] = m_pm_reg[0x4B]; } - if ( ! ( state->m_pm_reg[0x48] & 0x80 ) ) + if ( ! ( m_pm_reg[0x48] & 0x80 ) ) { - if( state->m_pm_reg[0x4F] == state->m_pm_reg[0x4D] ) + if( m_pm_reg[0x4F] == m_pm_reg[0x4D] ) { - state->m_pm_reg[0x27] |= 0x01; - pokemini_check_irqs( machine ); + m_pm_reg[0x27] |= 0x01; + pokemini_check_irqs( machine() ); } - pokemini_update_sound( machine ); + pokemini_update_sound( machine() ); } } @@ -1413,55 +1405,54 @@ DEVICE_IMAGE_LOAD( pokemini_cart ) } -static TIMER_CALLBACK( pokemini_prc_counter_callback ) +TIMER_CALLBACK_MEMBER(pokemini_state::pokemini_prc_counter_callback) { - pokemini_state *state = machine.driver_data(); - address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM ); - state->m_prc.count++; + address_space &space = machine().device( "maincpu")->memory().space( AS_PROGRAM ); + m_prc.count++; /* Check for overflow */ - if ( state->m_prc.count >= 0x42 ) + if ( m_prc.count >= 0x42 ) { - state->m_prc.count = 0; - state->m_prc.frame_count++; + m_prc.count = 0; + m_prc.frame_count++; } else { - if ( state->m_prc.count == 0x18 && state->m_prc.frame_count >= state->m_prc.max_frame_count ) + if ( m_prc.count == 0x18 && m_prc.frame_count >= m_prc.max_frame_count ) { - state->m_prc.frame_count = 0; + m_prc.frame_count = 0; /* Check if the background should be drawn */ - if ( state->m_prc.background_enabled ) + if ( m_prc.background_enabled ) { int x, y; for ( y = 0; y < 8; y++ ) { for ( x = 0; x < 12; x++ ) { - UINT8 tile = state->m_p_ram[ 0x360 + ( y * state->m_prc.map_size_x ) + x ]; + UINT8 tile = m_p_ram[ 0x360 + ( y * m_prc.map_size_x ) + x ]; int i; for( i = 0; i < 8; i++ ) { - state->m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( state->m_prc.bg_tiles + ( tile * 8 ) + i ); + m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( m_prc.bg_tiles + ( tile * 8 ) + i ); } } } } /* Check if the sprites should be drawn */ - if ( state->m_prc.sprites_enabled ) + if ( m_prc.sprites_enabled ) { UINT16 spr; for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) { - int spr_x = ( state->m_p_ram[ spr + 0 ] & 0x7F ) - 16; - int spr_y = ( state->m_p_ram[ spr + 1 ] & 0x7F ) - 16; - UINT8 spr_tile = state->m_p_ram[ spr + 2 ]; - UINT8 spr_flag = state->m_p_ram[ spr + 3 ]; + int spr_x = ( m_p_ram[ spr + 0 ] & 0x7F ) - 16; + int spr_y = ( m_p_ram[ spr + 1 ] & 0x7F ) - 16; + UINT8 spr_tile = m_p_ram[ spr + 2 ]; + UINT8 spr_flag = m_p_ram[ spr + 3 ]; if ( spr_flag & 0x08 ) { UINT16 gfx, mask; - UINT32 spr_base = state->m_prc.spr_tiles + spr_tile * 64; + UINT32 spr_base = m_prc.spr_tiles + spr_tile * 64; int i, j; for ( i = 0; i < 16; i++ ) @@ -1490,10 +1481,10 @@ static TIMER_CALLBACK( pokemini_prc_counter_callback ) { if ( mask & 0x8000 ) { - state->m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); + m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); if ( gfx & 0x8000 ) { - state->m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); + m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); } } mask <<= 1; @@ -1503,10 +1494,10 @@ static TIMER_CALLBACK( pokemini_prc_counter_callback ) { if ( mask & 0x0001 ) { - state->m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); + m_p_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); if ( gfx & 0x0001 ) { - state->m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); + m_p_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); } } mask >>= 1; @@ -1521,37 +1512,37 @@ static TIMER_CALLBACK( pokemini_prc_counter_callback ) } /* Set PRC Render interrupt */ - state->m_pm_reg[0x27] |= 0x40; - pokemini_check_irqs( machine ); + m_pm_reg[0x27] |= 0x40; + pokemini_check_irqs( machine() ); /* Check if the rendered data should be copied to the LCD */ - if ( state->m_prc.copy_enabled ) + if ( m_prc.copy_enabled ) { int x, y; for( y = 0; y < 64; y += 8 ) { for( x = 0; x < 96; x++ ) { - UINT8 data = state->m_p_ram[ ( y * 12 ) + x ]; + UINT8 data = m_p_ram[ ( y * 12 ) + x ]; - state->m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; - state->m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; - state->m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; - state->m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; - state->m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; - state->m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; - state->m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; - state->m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; + m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; + m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; + m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; + m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; + m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; + m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; + m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; + m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; } } /* Set PRC Copy interrupt */ - state->m_pm_reg[0x27] |= 0x80; - pokemini_check_irqs( machine ); + m_pm_reg[0x27] |= 0x80; + pokemini_check_irqs( machine() ); } } /* Set possible input irqs */ - state->m_pm_reg[0x29] |= ~ machine.root_device().ioport( "INPUTS" )->read(); + m_pm_reg[0x29] |= ~ machine().root_device().ioport( "INPUTS" )->read(); } } @@ -1564,22 +1555,22 @@ void pokemini_state::machine_start() memset( m_pm_reg, 0, sizeof(m_pm_reg) ); /* Set up timers */ - m_timers.seconds_timer = machine().scheduler().timer_alloc(FUNC(pokemini_seconds_timer_callback)); + m_timers.seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_seconds_timer_callback),this)); m_timers.seconds_timer->adjust( attotime::zero, 0, attotime::from_seconds( 1 ) ); - m_timers.hz256_timer = machine().scheduler().timer_alloc(FUNC(pokemini_256hz_timer_callback)); + m_timers.hz256_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_256hz_timer_callback),this)); m_timers.hz256_timer->adjust( attotime::zero, 0, attotime::from_hz( 256 ) ); - m_timers.timer1 = machine().scheduler().timer_alloc(FUNC(pokemini_timer1_callback)); - m_timers.timer1_hi = machine().scheduler().timer_alloc(FUNC(pokemini_timer1_hi_callback)); - m_timers.timer2 = machine().scheduler().timer_alloc(FUNC(pokemini_timer2_callback)); - m_timers.timer2_hi = machine().scheduler().timer_alloc(FUNC(pokemini_timer2_hi_callback)); - m_timers.timer3 = machine().scheduler().timer_alloc(FUNC(pokemini_timer3_callback)); - m_timers.timer3_hi = machine().scheduler().timer_alloc(FUNC(pokemini_timer3_hi_callback)); + m_timers.timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_timer1_callback),this)); + m_timers.timer1_hi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_timer1_hi_callback),this)); + m_timers.timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_timer2_callback),this)); + m_timers.timer2_hi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_timer2_hi_callback),this)); + m_timers.timer3 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_timer3_callback),this)); + m_timers.timer3_hi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_timer3_hi_callback),this)); /* Set up the PRC */ m_prc.max_frame_count = 2; - m_prc.count_timer = machine().scheduler().timer_alloc(FUNC(pokemini_prc_counter_callback)); + m_prc.count_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pokemini_state::pokemini_prc_counter_callback),this)); m_prc.count_timer->adjust( attotime::zero, 0, m_maincpu->cycles_to_attotime(55640 / 65) ); } diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c index 0c40bd43f73..251fddb70b3 100644 --- a/src/mess/machine/poly88.c +++ b/src/mess/machine/poly88.c @@ -12,17 +12,16 @@ #include "includes/poly88.h" -static TIMER_CALLBACK(poly88_usart_timer_callback) +TIMER_CALLBACK_MEMBER(poly88_state::poly88_usart_timer_callback) { - poly88_state *state = machine.driver_data(); - state->m_int_vector = 0xe7; - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_int_vector = 0xe7; + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); } WRITE8_MEMBER(poly88_state::poly88_baud_rate_w) { logerror("poly88_baud_rate_w %02x\n",data); - m_usart_timer = machine().scheduler().timer_alloc(FUNC(poly88_usart_timer_callback)); + m_usart_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(poly88_state::poly88_usart_timer_callback),this)); m_usart_timer->adjust(attotime::zero, 0, attotime::from_hz(300)); } @@ -39,21 +38,20 @@ static UINT8 row_number(UINT8 code) { return 0; } -static TIMER_CALLBACK(keyboard_callback) +TIMER_CALLBACK_MEMBER(poly88_state::keyboard_callback) { - poly88_state *state = machine.driver_data(); static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" }; int i; UINT8 code; UINT8 key_code = 0; - UINT8 shift = machine.root_device().ioport("LINEC")->read() & 0x02 ? 1 : 0; - UINT8 ctrl = machine.root_device().ioport("LINEC")->read() & 0x01 ? 1 : 0; + UINT8 shift = machine().root_device().ioport("LINEC")->read() & 0x02 ? 1 : 0; + UINT8 ctrl = machine().root_device().ioport("LINEC")->read() & 0x01 ? 1 : 0; for(i = 0; i < 7; i++) { - code = machine.root_device().ioport(keynames[i])->read(); + code = machine().root_device().ioport(keynames[i])->read(); if (code != 0) { if (i==0 && shift==0) { @@ -117,11 +115,11 @@ static TIMER_CALLBACK(keyboard_callback) } } } - if (key_code==0 && state->m_last_code !=0){ - state->m_int_vector = 0xef; - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); + if (key_code==0 && m_last_code !=0){ + m_int_vector = 0xef; + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); } else { - state->m_last_code = key_code; + m_last_code = key_code; } } @@ -131,69 +129,67 @@ static IRQ_CALLBACK (poly88_irq_callback) return state->m_int_vector; } -static TIMER_CALLBACK(poly88_cassette_timer_callback) +TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) { - poly88_state *state = machine.driver_data(); int data; int current_level; - i8251_device *uart = machine.device("uart"); - serial_source_device *ser = machine.device("sercas"); + i8251_device *uart = machine().device("uart"); + serial_source_device *ser = machine().device("sercas"); -// if (!(machine.root_device().ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ +// if (!(machine().root_device().ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ //{ /* tape reading */ - if (machine.device(CASSETTE_TAG)->get_state()&CASSETTE_PLAY) + if (machine().device(CASSETTE_TAG)->get_state()&CASSETTE_PLAY) { - if (state->m_clk_level_tape) + if (m_clk_level_tape) { - state->m_previous_level = ((machine.device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; - state->m_clk_level_tape = 0; + m_previous_level = ((machine().device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; + m_clk_level_tape = 0; } else { - current_level = ((machine.device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; + current_level = ((machine().device(CASSETTE_TAG))->input() > 0.038) ? 1 : 0; - if (state->m_previous_level!=current_level) + if (m_previous_level!=current_level) { - data = (!state->m_previous_level && current_level) ? 1 : 0; + data = (!m_previous_level && current_level) ? 1 : 0; //data = current_level; ser->send_bit(data); uart->receive_clock(); - state->m_clk_level_tape = 1; + m_clk_level_tape = 1; } } } /* tape writing */ - if (machine.device(CASSETTE_TAG)->get_state()&CASSETTE_RECORD) + if (machine().device(CASSETTE_TAG)->get_state()&CASSETTE_RECORD) { data = ser->get_in_data_bit(); - data ^= state->m_clk_level_tape; - machine.device(CASSETTE_TAG)->output(data&0x01 ? 1 : -1); + data ^= m_clk_level_tape; + machine().device(CASSETTE_TAG)->output(data&0x01 ? 1 : -1); - if (!state->m_clk_level_tape) + if (!m_clk_level_tape) uart->transmit_clock(); - state->m_clk_level_tape = state->m_clk_level_tape ? 0 : 1; + m_clk_level_tape = m_clk_level_tape ? 0 : 1; return; } - state->m_clk_level_tape = 1; + m_clk_level_tape = 1; - if (!state->m_clk_level) + if (!m_clk_level) uart->transmit_clock(); - state->m_clk_level = state->m_clk_level ? 0 : 1; + m_clk_level = m_clk_level ? 0 : 1; // } } -static TIMER_CALLBACK( setup_machine_state ) +TIMER_CALLBACK_MEMBER(poly88_state::setup_machine_state) { -// poly88_state *state = machine.driver_data(); - i8251_device *uart = machine.device("uart"); - serial_source_device *ser = machine.device("sercas"); + i8251_device *uart = machine().device("uart"); + serial_source_device *ser = machine().device("sercas"); uart->connect(ser); } @@ -201,10 +197,10 @@ DRIVER_INIT_MEMBER(poly88_state,poly88) { m_previous_level = 0; m_clk_level = m_clk_level_tape = 1; - m_cassette_timer = machine().scheduler().timer_alloc(FUNC(poly88_cassette_timer_callback)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(poly88_state::poly88_cassette_timer_callback),this)); m_cassette_timer->adjust(attotime::zero, 0, attotime::from_hz(600)); - machine().scheduler().timer_pulse(attotime::from_hz(24000), FUNC(keyboard_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(24000), timer_expired_delegate(FUNC(poly88_state::keyboard_callback),this)); } void poly88_state::machine_reset() @@ -213,7 +209,7 @@ void poly88_state::machine_reset() m_intr = 0; m_last_code = 0; - machine().scheduler().timer_set(attotime::zero, FUNC(setup_machine_state)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(poly88_state::setup_machine_state),this)); } INTERRUPT_GEN_MEMBER(poly88_state::poly88_interrupt) diff --git a/src/mess/machine/radio86.c b/src/mess/machine/radio86.c index 0e7e9c7d65b..3fdcb6b5fdc 100644 --- a/src/mess/machine/radio86.c +++ b/src/mess/machine/radio86.c @@ -154,10 +154,9 @@ I8257_INTERFACE( radio86_dma ) { DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_HANDLER("i8275", i8275_dack_w), DEVCB_NULL } }; -static TIMER_CALLBACK( radio86_reset ) +TIMER_CALLBACK_MEMBER(radio86_state::radio86_reset) { - radio86_state *state = machine.driver_data(); - state->membank("bank1")->set_entry(0); + membank("bank1")->set_entry(0); } @@ -178,7 +177,7 @@ WRITE8_MEMBER(radio86_state::radio_io_w) MACHINE_RESET_MEMBER(radio86_state,radio86) { - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(radio86_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(radio86_state::radio86_reset),this)); membank("bank1")->set_entry(1); m_keyboard_mask = 0; diff --git a/src/mess/machine/rm380z.c b/src/mess/machine/rm380z.c index a936f713f35..79c0157b4e6 100644 --- a/src/mess/machine/rm380z.c +++ b/src/mess/machine/rm380z.c @@ -158,33 +158,32 @@ WRITE8_MEMBER( rm380z_state::rm380z_porthi_w ) // for about 4.5 milliseconds every 20 milliseconds" // -static TIMER_CALLBACK(static_vblank_timer) +TIMER_CALLBACK_MEMBER(rm380z_state::static_vblank_timer) { - //printf("timer callback called at [%f]\n",machine.time().as_double()); + //printf("timer callback called at [%f]\n",machine().time().as_double()); - rm380z_state *state = machine.driver_data(); - state->m_rasterlineCtr++; - state->m_rasterlineCtr%=(HORZ_LINES*LINE_SUBDIVISION); + m_rasterlineCtr++; + m_rasterlineCtr%=(HORZ_LINES*LINE_SUBDIVISION); // frame blanking - if (state->m_rasterlineCtr>=((HORZ_LINES-22)*LINE_SUBDIVISION)) + if (m_rasterlineCtr>=((HORZ_LINES-22)*LINE_SUBDIVISION)) { - state->m_port1|=0x40; + m_port1|=0x40; } else { - state->m_port1&=~0x40; + m_port1&=~0x40; } // line blanking - if ((state->m_rasterlineCtr%LINE_SUBDIVISION)>80) + if ((m_rasterlineCtr%LINE_SUBDIVISION)>80) { - state->m_port1|=0x80; + m_port1|=0x80; } else { - state->m_port1&=~0x80; + m_port1&=~0x80; } } @@ -249,7 +248,7 @@ WRITE8_MEMBER( rm380z_state::disk_0_control ) void rm380z_state::machine_start() { - machine().scheduler().timer_pulse(attotime::from_hz(TIMER_SPEED), FUNC(static_vblank_timer)); + machine().scheduler().timer_pulse(attotime::from_hz(TIMER_SPEED), timer_expired_delegate(FUNC(rm380z_state::static_vblank_timer),this)); } void rm380z_state::machine_reset() diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c index 94aca444667..7121b415a28 100644 --- a/src/mess/machine/rmnimbus.c +++ b/src/mess/machine/rmnimbus.c @@ -177,14 +177,14 @@ static void hdc_post_rw(running_machine &machine); static void hdc_drq(running_machine &machine); static void keyboard_reset(running_machine &machine); -static TIMER_CALLBACK(keyscan_callback); + static void pc8031_reset(running_machine &machine); static void iou_reset(running_machine &machine); static void rmni_sound_reset(running_machine &machine); static void mouse_js_reset(running_machine &machine); -static TIMER_CALLBACK(mouse_callback); + /************************************* @@ -458,11 +458,10 @@ static void nimbus_recalculate_ints(running_machine &machine) * *************************************/ -static TIMER_CALLBACK(internal_timer_int) +TIMER_CALLBACK_MEMBER(rmnimbus_state::internal_timer_int) { - rmnimbus_state *state = machine.driver_data(); int which = param; - struct timer_state *t = &state->m_i186.timer[which]; + struct timer_state *t = &m_i186.timer[which]; if (LOG_TIMER) logerror("Hit interrupt callback for timer %d\n", which); @@ -472,8 +471,8 @@ static TIMER_CALLBACK(internal_timer_int) /* request an interrupt */ if (t->control & 0x2000) { - state->m_i186.intr.status |= 0x01 << which; - update_interrupt_state(machine); + m_i186.intr.status |= 0x01 << which; + update_interrupt_state(machine()); if (LOG_TIMER) logerror(" Generating timer interrupt\n"); } @@ -654,11 +653,10 @@ static void internal_timer_update(running_machine &machine, * *************************************/ -static TIMER_CALLBACK(dma_timer_callback) +TIMER_CALLBACK_MEMBER(rmnimbus_state::dma_timer_callback) { - rmnimbus_state *state = machine.driver_data(); int which = param; - struct dma_state *d = &state->m_i186.dma[which]; + struct dma_state *d = &m_i186.dma[which]; /* complete the status update */ d->control &= ~0x0002; @@ -669,8 +667,8 @@ static TIMER_CALLBACK(dma_timer_callback) if (d->control & 0x0100) { if (LOG_DMA>1) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source); - state->m_i186.intr.request |= 0x04 << which; - update_interrupt_state(machine); + m_i186.intr.request |= 0x04 << which; + update_interrupt_state(machine()); } } @@ -806,14 +804,14 @@ static void nimbus_cpu_init(running_machine &machine) logerror("Machine reset\n"); /* create timers here so they stick around */ - state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int)); - state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int)); - state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int)); + state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::internal_timer_int),state)); + state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::internal_timer_int),state)); + state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::internal_timer_int),state)); state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback)); - state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(FUNC(dma_timer_callback)); + state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::dma_timer_callback),state)); + state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::dma_timer_callback),state)); } static void nimbus_cpu_reset(running_machine &machine) @@ -1262,8 +1260,8 @@ void rmnimbus_state::machine_start() /* init cpu */ nimbus_cpu_init(machine()); - m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(FUNC(keyscan_callback)); - m_nimbus_mouse.m_mouse_timer=machine().scheduler().timer_alloc(FUNC(mouse_callback)); + m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::keyscan_callback),this)); + m_nimbus_mouse.m_mouse_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rmnimbus_state::mouse_callback),this)); /* setup debug commands */ if (machine().debug_flags & DEBUG_FLAG_ENABLED) @@ -2171,9 +2169,9 @@ static void scan_keyboard(running_machine &machine) } } -static TIMER_CALLBACK(keyscan_callback) +TIMER_CALLBACK_MEMBER(rmnimbus_state::keyscan_callback) { - scan_keyboard(machine); + scan_keyboard(machine()); } /* @@ -2836,24 +2834,23 @@ static void mouse_js_reset(running_machine &machine) state->m_mouse_timer->adjust(attotime::zero, 0, attotime::from_hz(1000)); } -static TIMER_CALLBACK(mouse_callback) +TIMER_CALLBACK_MEMBER(rmnimbus_state::mouse_callback) { - rmnimbus_state *drvstate = machine.driver_data(); UINT8 x = 0; UINT8 y = 0; -// int pc=machine.device(MAINCPU_TAG)->safe_pc(); +// int pc=machine().device(MAINCPU_TAG)->safe_pc(); UINT8 intstate_x; UINT8 intstate_y; int xint; int yint; - mouse_joy_state *state = &drvstate->m_nimbus_mouse; + mouse_joy_state *state = &m_nimbus_mouse; - state->m_reg0a4 = machine.root_device().ioport(MOUSE_BUTTON_TAG)->read() | 0xC0; - x = machine.root_device().ioport(MOUSEX_TAG)->read(); - y = machine.root_device().ioport(MOUSEY_TAG)->read(); + state->m_reg0a4 = machine().root_device().ioport(MOUSE_BUTTON_TAG)->read() | 0xC0; + x = machine().root_device().ioport(MOUSEX_TAG)->read(); + y = machine().root_device().ioport(MOUSEY_TAG)->read(); UINT8 mxa; UINT8 mxb; @@ -2923,10 +2920,10 @@ static TIMER_CALLBACK(mouse_callback) // mxb,mxa, (mxb ^ mxa) , (state->m_ay8910_a & 0xC0), (mxb ^ mxa) ^ ((state->m_ay8910_a & 0x40) >> 6)); } - intstate_x = (mxb ^ mxa) ^ ((drvstate->m_ay8910_a & 0x40) >> 6); - intstate_y = (myb ^ mya) ^ ((drvstate->m_ay8910_a & 0x80) >> 7); + intstate_x = (mxb ^ mxa) ^ ((m_ay8910_a & 0x40) >> 6); + intstate_y = (myb ^ mya) ^ ((m_ay8910_a & 0x80) >> 7); - if (MOUSE_INT_ENABLED(drvstate)) + if (MOUSE_INT_ENABLED(this)) { if ((intstate_x==1) && (state->m_intstate_x==0)) // if (intstate_x!=state->m_intstate_x) @@ -2934,7 +2931,7 @@ static TIMER_CALLBACK(mouse_callback) xint=mxa ? EXTERNAL_INT_MOUSE_XR : EXTERNAL_INT_MOUSE_XL; - external_int(machine,0,xint); + external_int(machine(),0,xint); // logerror("Xint:%02X, mxb=%02X\n",xint,mxb); } @@ -2944,7 +2941,7 @@ static TIMER_CALLBACK(mouse_callback) { yint=myb ? EXTERNAL_INT_MOUSE_YU : EXTERNAL_INT_MOUSE_YD; - external_int(machine,0,yint); + external_int(machine(),0,yint); // logerror("Yint:%02X, myb=%02X\n",yint,myb); } } diff --git a/src/mess/machine/samcoupe.c b/src/mess/machine/samcoupe.c index da60cfcf0c0..19ecabf6a09 100644 --- a/src/mess/machine/samcoupe.c +++ b/src/mess/machine/samcoupe.c @@ -178,10 +178,9 @@ static WRITE8_DEVICE_HANDLER( samcoupe_rtc_w ) MOUSE ***************************************************************************/ -static TIMER_CALLBACK( samcoupe_mouse_reset ) +TIMER_CALLBACK_MEMBER(samcoupe_state::samcoupe_mouse_reset) { - samcoupe_state *state = machine.driver_data(); - state->m_mouse_index = 0; + m_mouse_index = 0; } UINT8 samcoupe_mouse_r(running_machine &machine) @@ -231,10 +230,10 @@ UINT8 samcoupe_mouse_r(running_machine &machine) void samcoupe_state::machine_start() { - m_mouse_reset = machine().scheduler().timer_alloc(FUNC(samcoupe_mouse_reset)); + m_mouse_reset = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(samcoupe_state::samcoupe_mouse_reset),this)); /* schedule our video updates */ - m_video_update_timer = machine().scheduler().timer_alloc(FUNC(sam_video_update_callback)); + m_video_update_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(samcoupe_state::sam_video_update_callback),this)); m_video_update_timer->adjust(machine().primary_screen->time_until_pos(0, 0)); } diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c index 9a2dd235466..7c8f40aed6e 100644 --- a/src/mess/machine/sms.c +++ b/src/mess/machine/sms.c @@ -30,11 +30,10 @@ static void setup_rom(address_space &space); -static TIMER_CALLBACK( rapid_fire_callback ) +TIMER_CALLBACK_MEMBER(sms_state::rapid_fire_callback) { - sms_state *state = machine.driver_data(); - state->m_rapid_fire_state_1 ^= 0xff; - state->m_rapid_fire_state_2 ^= 0xff; + m_rapid_fire_state_1 ^= 0xff; + m_rapid_fire_state_2 ^= 0xff; } @@ -487,49 +486,48 @@ static void lphaser2_sensor_check( running_machine &machine ) // at each input port read we check if lightguns are enabled in one of the ports: // if so, we turn on crosshair and the lightgun timer -static TIMER_CALLBACK( lightgun_tick ) +TIMER_CALLBACK_MEMBER(sms_state::lightgun_tick) { - sms_state *state = machine.driver_data(); - if ((state->ioport("CTRLSEL")->read_safe(0x00) & 0x0f) == 0x01) + if ((ioport("CTRLSEL")->read_safe(0x00) & 0x0f) == 0x01) { /* enable crosshair */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); - if (!state->m_lphaser_1_timer->enabled()) - lphaser1_sensor_check(machine); + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_ALL); + if (!m_lphaser_1_timer->enabled()) + lphaser1_sensor_check(machine()); } else { /* disable crosshair */ - crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); - state->m_lphaser_1_timer->enable(0); + crosshair_set_screen(machine(), 0, CROSSHAIR_SCREEN_NONE); + m_lphaser_1_timer->enable(0); } - if ((state->ioport("CTRLSEL")->read_safe(0x00) & 0xf0) == 0x10) + if ((ioport("CTRLSEL")->read_safe(0x00) & 0xf0) == 0x10) { /* enable crosshair */ - crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_ALL); - if (!state->m_lphaser_2_timer->enabled()) - lphaser2_sensor_check(machine); + crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_ALL); + if (!m_lphaser_2_timer->enabled()) + lphaser2_sensor_check(machine()); } else { /* disable crosshair */ - crosshair_set_screen(machine, 1, CROSSHAIR_SCREEN_NONE); - state->m_lphaser_2_timer->enable(0); + crosshair_set_screen(machine(), 1, CROSSHAIR_SCREEN_NONE); + m_lphaser_2_timer->enable(0); } } -static TIMER_CALLBACK( lphaser_1_callback ) +TIMER_CALLBACK_MEMBER(sms_state::lphaser_1_callback) { - lphaser1_sensor_check(machine); + lphaser1_sensor_check(machine()); } -static TIMER_CALLBACK( lphaser_2_callback ) +TIMER_CALLBACK_MEMBER(sms_state::lphaser_2_callback) { - lphaser2_sensor_check(machine); + lphaser2_sensor_check(machine()); } @@ -571,7 +569,7 @@ static void sms_get_inputs( address_space &space ) } /* Check if lightgun has been chosen as input: if so, enable crosshair */ - machine.scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); + machine.scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sms_state::lightgun_tick),state)); /* Player 1 */ switch (machine.root_device().ioport("CTRLSEL")->read_safe(0x00) & 0x0f) @@ -1926,11 +1924,11 @@ MACHINE_START_MEMBER(sms_state,sms) { machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_machine_stop),&machine())); - m_rapid_fire_timer = machine().scheduler().timer_alloc(FUNC(rapid_fire_callback)); + m_rapid_fire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::rapid_fire_callback),this)); m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10)); - m_lphaser_1_timer = machine().scheduler().timer_alloc(FUNC(lphaser_1_callback)); - m_lphaser_2_timer = machine().scheduler().timer_alloc(FUNC(lphaser_2_callback)); + m_lphaser_1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::lphaser_1_callback),this)); + m_lphaser_2_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::lphaser_2_callback),this)); m_main_cpu = machine().device("maincpu"); m_control_cpu = machine().device("control"); @@ -1943,7 +1941,7 @@ MACHINE_START_MEMBER(sms_state,sms) m_space = &machine().device("maincpu")->memory().space(AS_PROGRAM); /* Check if lightgun has been chosen as input: if so, enable crosshair */ - machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(sms_state::lightgun_tick),this)); } MACHINE_RESET_MEMBER(sms_state,sms) diff --git a/src/mess/machine/sorcerer.c b/src/mess/machine/sorcerer.c index b9398db100d..61c5741bf56 100644 --- a/src/mess/machine/sorcerer.c +++ b/src/mess/machine/sorcerer.c @@ -12,14 +12,13 @@ /* timer for sorcerer serial chip transmit and receive */ -static TIMER_CALLBACK(sorcerer_serial_tc) +TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_serial_tc) { - sorcerer_state *state = machine.driver_data(); /* if rs232 is enabled, uart is connected to clock defined by bit6 of port fe. Transmit and receive clocks are connected to the same clock */ /* if rs232 is disabled, receive clock is linked to cassette hardware */ - if (state->m_fe & 0x80) + if (m_fe & 0x80) { /* connect to rs232 */ } @@ -41,89 +40,88 @@ static cassette_image_device *cassette_device_image(running_machine &machine) -static TIMER_CALLBACK(sorcerer_cassette_tc) +TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_cassette_tc) { - sorcerer_state *state = machine.driver_data(); UINT8 cass_ws = 0; - switch (state->m_fe & 0xc0) /*/ bit 7 low indicates cassette */ + switch (m_fe & 0xc0) /*/ bit 7 low indicates cassette */ { case 0x00: /* 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 0x40: /* 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; @@ -132,10 +130,9 @@ static TIMER_CALLBACK(sorcerer_cassette_tc) /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( sorcerer_reset ) +TIMER_CALLBACK_MEMBER(sorcerer_state::sorcerer_reset) { - sorcerer_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } WRITE8_MEMBER(sorcerer_state::sorcerer_fc_w) @@ -353,9 +350,9 @@ SNAPSHOT_LOAD(sorcerer) void sorcerer_state::machine_start() { - m_cassette_timer = machine().scheduler().timer_alloc(FUNC(sorcerer_cassette_tc)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_cassette_tc),this)); #if SORCERER_USING_RS232 - m_serial_timer = machine().scheduler().timer_alloc(FUNC(sorcerer_serial_tc)); + m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_serial_tc),this)); #endif UINT16 endmem = 0xbfff; @@ -380,9 +377,9 @@ void sorcerer_state::machine_start() MACHINE_START_MEMBER(sorcerer_state,sorcererd) { - m_cassette_timer = machine().scheduler().timer_alloc(FUNC(sorcerer_cassette_tc)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_cassette_tc),this)); #if SORCERER_USING_RS232 - m_serial_timer = machine().scheduler().timer_alloc(FUNC(sorcerer_serial_tc)); + m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sorcerer_state::sorcerer_serial_tc),this)); #endif UINT16 endmem = 0xbbff; @@ -419,5 +416,5 @@ void sorcerer_state::machine_reset() sorcerer_fe_w(space, 0, 0, 0xff); membank("boot")->set_entry(1); - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(sorcerer_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(sorcerer_state::sorcerer_reset),this)); } diff --git a/src/mess/machine/special.c b/src/mess/machine/special.c index 49b238e34d3..c4a31e700f7 100644 --- a/src/mess/machine/special.c +++ b/src/mess/machine/special.c @@ -101,16 +101,15 @@ I8255_INTERFACE( specialist_ppi8255_interface ) DEVCB_DRIVER_MEMBER(special_state, specialist_8255_portc_w) }; -static TIMER_CALLBACK( special_reset ) +TIMER_CALLBACK_MEMBER(special_state::special_reset) { - special_state *state = machine.driver_data(); - state->membank("bank1")->set_entry(0); + membank("bank1")->set_entry(0); } MACHINE_RESET_MEMBER(special_state,special) { - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(special_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(special_state::special_reset),this)); membank("bank1")->set_entry(1); } @@ -224,9 +223,9 @@ MACHINE_START_MEMBER(special_state,specimx) m_specimx_audio = machine().device("custom"); } -static TIMER_CALLBACK( setup_pit8253_gates ) +TIMER_CALLBACK_MEMBER(special_state::setup_pit8253_gates) { - device_t *pit8253 = machine.device("pit8253"); + device_t *pit8253 = machine().device("pit8253"); pit8253_gate0_w(pit8253, 0); pit8253_gate1_w(pit8253, 0); @@ -237,7 +236,7 @@ MACHINE_RESET_MEMBER(special_state,specimx) { specimx_set_bank(2, 0); // Initiali load ROM disk m_specimx_color = 0x70; - machine().scheduler().timer_set(attotime::zero, FUNC(setup_pit8253_gates)); + machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(special_state::setup_pit8253_gates),this)); device_t *fdc = machine().device("wd1793"); wd17xx_set_pause_time(fdc,12); wd17xx_dden_w(fdc, 0); diff --git a/src/mess/machine/super80.c b/src/mess/machine/super80.c index 4992be0b30d..15b6a41284f 100644 --- a/src/mess/machine/super80.c +++ b/src/mess/machine/super80.c @@ -78,58 +78,55 @@ static void super80_cassette_motor( running_machine &machine, UINT8 data ) bit 1 = MDS fast system bit 2 = CA3140 */ -static TIMER_CALLBACK( super80_timer ) +TIMER_CALLBACK_MEMBER(super80_state::super80_timer) { - super80_state *state = machine.driver_data(); UINT8 cass_ws=0; - state->m_cass_data[1]++; - cass_ws = ((state->m_cass)->input() > +0.03) ? 4 : 0; + m_cass_data[1]++; + cass_ws = ((m_cass)->input() > +0.03) ? 4 : 0; - if (cass_ws != state->m_cass_data[0]) + if (cass_ws != m_cass_data[0]) { - if (cass_ws) state->m_cass_data[3] ^= 2; // the MDS flipflop - state->m_cass_data[0] = cass_ws; - state->m_cass_data[2] = ((state->m_cass_data[1] < 0x40) ? 1 : 0) | cass_ws | state->m_cass_data[3]; - state->m_cass_data[1] = 0; + if (cass_ws) m_cass_data[3] ^= 2; // the MDS flipflop + m_cass_data[0] = cass_ws; + m_cass_data[2] = ((m_cass_data[1] < 0x40) ? 1 : 0) | cass_ws | m_cass_data[3]; + m_cass_data[1] = 0; } - state->m_pio->port_b_write(pio_port_b_r(state->m_pio,state->generic_space(),0,0xff)); + m_pio->port_b_write(pio_port_b_r(m_pio,generic_space(),0,0xff)); } /* after the first 4 bytes have been read from ROM, switch the ram back in */ -static TIMER_CALLBACK( super80_reset ) +TIMER_CALLBACK_MEMBER(super80_state::super80_reset) { - super80_state *state = machine.driver_data(); - state->membank("boot")->set_entry(0); + membank("boot")->set_entry(0); } -static TIMER_CALLBACK( super80_halfspeed ) +TIMER_CALLBACK_MEMBER(super80_state::super80_halfspeed) { UINT8 go_fast = 0; - super80_state *state = machine.driver_data(); - if ( (!BIT(state->m_shared, 2)) | (!BIT(machine.root_device().ioport("CONFIG")->read(), 1)) ) /* bit 2 of port F0 is low, OR user turned on config switch */ + if ( (!BIT(m_shared, 2)) | (!BIT(machine().root_device().ioport("CONFIG")->read(), 1)) ) /* bit 2 of port F0 is low, OR user turned on config switch */ go_fast++; /* code to slow down computer to 1 MHz by halting cpu on every second frame */ if (!go_fast) { - if (!state->m_int_sw) - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it + if (!m_int_sw) + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it - state->m_int_sw++; - if (state->m_int_sw > 1) + m_int_sw++; + if (m_int_sw > 1) { - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it - state->m_int_sw = 0; + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it + m_int_sw = 0; } } else { - if (state->m_int_sw < 8) // @2MHz, reset just once + if (m_int_sw < 8) // @2MHz, reset just once { - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - state->m_int_sw = 8; // ...not every time + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + m_int_sw = 8; // ...not every time } } } @@ -202,7 +199,7 @@ WRITE8_MEMBER( super80_state::super80r_f0_w ) void super80_state::machine_reset() { m_shared=0xff; - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(super80_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(super80_state::super80_reset),this)); membank("boot")->set_entry(1); } @@ -211,12 +208,12 @@ static void driver_init_common( running_machine &machine ) super80_state *state = machine.driver_data(); UINT8 *RAM = state->memregion("maincpu")->base(); state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); - machine.scheduler().timer_pulse(attotime::from_hz(200000), FUNC(super80_timer)); /* timer for keyboard and cassette */ + machine.scheduler().timer_pulse(attotime::from_hz(200000), timer_expired_delegate(FUNC(super80_state::super80_timer),state)); /* timer for keyboard and cassette */ } DRIVER_INIT_MEMBER(super80_state,super80) { - machine().scheduler().timer_pulse(attotime::from_hz(100), FUNC(super80_halfspeed)); /* timer for 1MHz slowdown */ + machine().scheduler().timer_pulse(attotime::from_hz(100), timer_expired_delegate(FUNC(super80_state::super80_halfspeed),this)); /* timer for 1MHz slowdown */ driver_init_common(machine()); } diff --git a/src/mess/machine/sym1.c b/src/mess/machine/sym1.c index a9ea947507b..ea5b1fae1d2 100644 --- a/src/mess/machine/sym1.c +++ b/src/mess/machine/sym1.c @@ -73,10 +73,9 @@ static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_5_w ) } -static TIMER_CALLBACK( led_refresh ) +TIMER_CALLBACK_MEMBER(sym1_state::led_refresh) { - sym1_state *state = machine.driver_data(); - output_set_digit_value(param, state->m_riot_port_a); + output_set_digit_value(param, m_riot_port_a); } @@ -294,7 +293,7 @@ DRIVER_INIT_MEMBER(sym1_state,sym1) } /* allocate a timer to refresh the led display */ - m_led_update = machine().scheduler().timer_alloc(FUNC(led_refresh)); + m_led_update = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sym1_state::led_refresh),this)); } diff --git a/src/mess/machine/ti85.c b/src/mess/machine/ti85.c index e8e25839cb0..9277bf584f2 100644 --- a/src/mess/machine/ti85.c +++ b/src/mess/machine/ti85.c @@ -15,26 +15,25 @@ #define TI86_SNAPSHOT_SIZE 131284 -static TIMER_CALLBACK(ti85_timer_callback) +TIMER_CALLBACK_MEMBER(ti85_state::ti85_timer_callback) { - ti85_state *state = machine.driver_data(); - if (machine.root_device().ioport("ON")->read() & 0x01) + if (machine().root_device().ioport("ON")->read() & 0x01) { - if (state->m_ON_interrupt_mask && !state->m_ON_pressed) + if (m_ON_interrupt_mask && !m_ON_pressed) { - state->m_maincpu->set_input_line(0, HOLD_LINE); - state->m_ON_interrupt_status = 1; - if (!state->m_timer_interrupt_mask) state->m_timer_interrupt_mask = 1; + m_maincpu->set_input_line(0, HOLD_LINE); + m_ON_interrupt_status = 1; + if (!m_timer_interrupt_mask) m_timer_interrupt_mask = 1; } - state->m_ON_pressed = 1; + m_ON_pressed = 1; return; } else - state->m_ON_pressed = 0; - if (state->m_timer_interrupt_mask) + m_ON_pressed = 0; + if (m_timer_interrupt_mask) { - state->m_maincpu->set_input_line(0, HOLD_LINE); - state->m_timer_interrupt_status = 1; + m_maincpu->set_input_line(0, HOLD_LINE); + m_timer_interrupt_status = 1; } } @@ -131,7 +130,7 @@ void ti85_state::machine_start() m_port4_bit0 = 0; m_ti81_port_7_data = 0; - machine().scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(200), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); space.unmap_write(0x0000, 0x3fff); space.unmap_write(0x4000, 0x7fff); @@ -180,7 +179,7 @@ MACHINE_START_MEMBER(ti85_state,ti83p) membank("bank3")->set_base(m_bios); membank("bank4")->set_base(m_ti8x_ram); - machine().scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(200), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); } @@ -216,7 +215,7 @@ MACHINE_START_MEMBER(ti85_state,ti86) membank("bank4")->set_base(m_ti8x_ram); - machine().scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(200), timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback),this)); } diff --git a/src/mess/machine/trs80.c b/src/mess/machine/trs80.c index c0e17389c14..cf8cba92e0a 100644 --- a/src/mess/machine/trs80.c +++ b/src/mess/machine/trs80.c @@ -22,37 +22,36 @@ MAX_SECTORS 5 and granules of sectors #define MODEL4_MASTER_CLOCK 20275200 -static TIMER_CALLBACK( cassette_data_callback ) +TIMER_CALLBACK_MEMBER(trs80_state::cassette_data_callback) { - trs80_state *state = machine.driver_data(); /* This does all baud rates. 250 baud (trs80), and 500 baud (all others) set bit 7 of "cassette_data". 1500 baud (trs80m3, trs80m4) is interrupt-driven and uses bit 0 of "cassette_data" */ - double new_val = (state->m_cass->input()); + double new_val = (m_cass->input()); /* Check for HI-LO transition */ - if ( state->m_old_cassette_val > -0.2 && new_val < -0.2 ) + if ( m_old_cassette_val > -0.2 && new_val < -0.2 ) { - state->m_cassette_data |= 0x80; /* 500 baud */ - if (state->m_mask & CASS_FALL) /* see if 1500 baud */ + m_cassette_data |= 0x80; /* 500 baud */ + if (m_mask & CASS_FALL) /* see if 1500 baud */ { - state->m_cassette_data = 0; - state->m_irq |= CASS_FALL; - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_cassette_data = 0; + m_irq |= CASS_FALL; + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); } } else - if ( state->m_old_cassette_val < -0.2 && new_val > -0.2 ) + if ( m_old_cassette_val < -0.2 && new_val > -0.2 ) { - if (state->m_mask & CASS_RISE) /* 1500 baud */ + if (m_mask & CASS_RISE) /* 1500 baud */ { - state->m_cassette_data = 1; - state->m_irq |= CASS_RISE; - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_cassette_data = 1; + m_irq |= CASS_RISE; + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); } } - state->m_old_cassette_val = new_val; + m_old_cassette_val = new_val; } @@ -852,7 +851,7 @@ void trs80_state::machine_start() m_reg_load=1; m_nmi_data=0xff; - m_cassette_data_timer = machine().scheduler().timer_alloc(FUNC(cassette_data_callback)); + m_cassette_data_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(trs80_state::cassette_data_callback),this)); m_cassette_data_timer->adjust( attotime::zero, 0, attotime::from_hz(11025) ); } diff --git a/src/mess/machine/ut88.c b/src/mess/machine/ut88.c index 0e258b9b326..b9d4628a0cc 100644 --- a/src/mess/machine/ut88.c +++ b/src/mess/machine/ut88.c @@ -60,15 +60,14 @@ I8255A_INTERFACE( ut88_ppi8255_interface ) DEVCB_NULL, }; -static TIMER_CALLBACK( ut88_reset ) +TIMER_CALLBACK_MEMBER(ut88_state::ut88_reset) { - ut88_state *state = machine.driver_data(); - state->membank("bank1")->set_entry(0); + membank("bank1")->set_entry(0); } MACHINE_RESET_MEMBER(ut88_state,ut88) { - machine().scheduler().timer_set(attotime::from_usec(10), FUNC(ut88_reset)); + machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(ut88_state::ut88_reset),this)); membank("bank1")->set_entry(1); m_keyboard_mask = 0; } @@ -148,12 +147,11 @@ static const UINT8 hex_to_7seg[16] = 0x39, 0x5e, 0x79, 0x71 }; -static TIMER_CALLBACK( update_display ) +TIMER_CALLBACK_MEMBER(ut88_state::update_display) { - ut88_state *state = machine.driver_data(); int i; for (i=0;i<6;i++) - output_set_digit_value(i, hex_to_7seg[state->m_lcd_digit[i]]); + output_set_digit_value(i, hex_to_7seg[m_lcd_digit[i]]); } @@ -163,7 +161,7 @@ DRIVER_INIT_MEMBER(ut88_state,ut88mini) MACHINE_START_MEMBER(ut88_state,ut88mini) { - machine().scheduler().timer_pulse(attotime::from_hz(60), FUNC(update_display)); + machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(ut88_state::update_display),this)); } MACHINE_RESET_MEMBER(ut88_state,ut88mini) diff --git a/src/mess/machine/vector06.c b/src/mess/machine/vector06.c index d798137f848..f2e2fb17cc9 100644 --- a/src/mess/machine/vector06.c +++ b/src/mess/machine/vector06.c @@ -136,21 +136,20 @@ static IRQ_CALLBACK( vector06_irq_callback ) return 0xff; } -static TIMER_CALLBACK( reset_check_callback ) +TIMER_CALLBACK_MEMBER(vector06_state::reset_check_callback) { - vector06_state *state = machine.driver_data(); - UINT8 val = machine.root_device().ioport("RESET")->read(); + UINT8 val = machine().root_device().ioport("RESET")->read(); if (BIT(val, 0)) { - state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x10000); - machine.device("maincpu")->reset(); + membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000); + machine().device("maincpu")->reset(); } if (BIT(val, 1)) { - state->membank("bank1")->set_base(machine.device(RAM_TAG)->pointer() + 0x0000); - machine.device("maincpu")->reset(); + membank("bank1")->set_base(machine().device(RAM_TAG)->pointer() + 0x0000); + machine().device("maincpu")->reset(); } } @@ -164,7 +163,7 @@ WRITE8_MEMBER( vector06_state::vector06_disc_w ) void vector06_state::machine_start() { - machine().scheduler().timer_pulse(attotime::from_hz(50), FUNC(reset_check_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(50), timer_expired_delegate(FUNC(vector06_state::reset_check_callback),this)); } void vector06_state::machine_reset() diff --git a/src/mess/machine/wswan.c b/src/mess/machine/wswan.c index c5ec6785771..27736cfa0bd 100644 --- a/src/mess/machine/wswan.c +++ b/src/mess/machine/wswan.c @@ -24,7 +24,7 @@ enum enum_sram { SRAM_NONE=0, SRAM_64K, SRAM_256K, SRAM_512K, SRAM_1M, SRAM_2M, static const char *const wswan_sram_str[] = { "none", "64Kbit SRAM", "256Kbit SRAM", "512Kbit SRAM", "1Mbit SRAM", "2Mbit SRAM", "1Kbit EEPROM", "16Kbit EEPROM", "8Kbit EEPROM", "Unknown" }; static const int wswan_sram_size[] = { 0, 64*1024/8, 256*1024/8, 512*1024/8, 1024*1024/8, 2*1024*1024/8, 1024/8, 16*1024/8, 8*1024/8, 0 }; -static TIMER_CALLBACK(wswan_scanline_interrupt); + static const UINT8 ws_portram_init[256] = @@ -123,47 +123,46 @@ void wswan_state::wswan_clear_irq_line(int irq) wswan_handle_irqs( machine() ); } -static TIMER_CALLBACK(wswan_rtc_callback) +TIMER_CALLBACK_MEMBER(wswan_state::wswan_rtc_callback) { - wswan_state *state = machine.driver_data(); /* A second passed */ - state->m_rtc.second = state->m_rtc.second + 1; - if ( ( state->m_rtc.second & 0x0F ) > 9 ) + m_rtc.second = m_rtc.second + 1; + if ( ( m_rtc.second & 0x0F ) > 9 ) { - state->m_rtc.second = ( state->m_rtc.second & 0xF0 ) + 0x10; + m_rtc.second = ( m_rtc.second & 0xF0 ) + 0x10; } /* Check for minute passed */ - if ( state->m_rtc.second >= 0x60 ) + if ( m_rtc.second >= 0x60 ) { - state->m_rtc.second = 0; - state->m_rtc.minute = state->m_rtc.minute + 1; - if ( ( state->m_rtc.minute & 0x0F ) > 9 ) + m_rtc.second = 0; + m_rtc.minute = m_rtc.minute + 1; + if ( ( m_rtc.minute & 0x0F ) > 9 ) { - state->m_rtc.minute = ( state->m_rtc.minute & 0xF0 ) + 0x10; + m_rtc.minute = ( m_rtc.minute & 0xF0 ) + 0x10; } } /* Check for hour passed */ - if ( state->m_rtc.minute >= 0x60 ) + if ( m_rtc.minute >= 0x60 ) { - state->m_rtc.minute = 0; - state->m_rtc.hour = state->m_rtc.hour + 1; - if ( ( state->m_rtc.hour & 0x0F ) > 9 ) + m_rtc.minute = 0; + m_rtc.hour = m_rtc.hour + 1; + if ( ( m_rtc.hour & 0x0F ) > 9 ) { - state->m_rtc.hour = ( state->m_rtc.hour & 0xF0 ) + 0x10; + m_rtc.hour = ( m_rtc.hour & 0xF0 ) + 0x10; } - if ( state->m_rtc.hour == 0x12 ) + if ( m_rtc.hour == 0x12 ) { - state->m_rtc.hour |= 0x80; + m_rtc.hour |= 0x80; } } /* Check for day passed */ - if ( state->m_rtc.hour >= 0x24 ) + if ( m_rtc.hour >= 0x24 ) { - state->m_rtc.hour = 0; - state->m_rtc.day = state->m_rtc.day + 1; + m_rtc.hour = 0; + m_rtc.day = m_rtc.day + 1; } } @@ -192,14 +191,14 @@ void wswan_state::machine_start() m_ws_bios_bank = NULL; m_system_type = TYPE_WSWAN; machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine())); - m_vdp.timer = machine().scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &m_vdp ); + m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp ); m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) ); wswan_setup_bios(machine()); /* Set up RTC timer */ if ( m_rtc.present ) - machine().scheduler().timer_pulse(attotime::from_seconds(1), FUNC(wswan_rtc_callback)); + machine().scheduler().timer_pulse(attotime::from_seconds(1), timer_expired_delegate(FUNC(wswan_state::wswan_rtc_callback),this)); machine().device("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE); } @@ -209,14 +208,14 @@ MACHINE_START_MEMBER(wswan_state,wscolor) m_ws_bios_bank = NULL; m_system_type = TYPE_WSC; machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine())); - m_vdp.timer = machine().scheduler().timer_alloc(FUNC(wswan_scanline_interrupt), &m_vdp ); + m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp ); m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) ); wswan_setup_bios(machine()); /* Set up RTC timer */ if ( m_rtc.present ) - machine().scheduler().timer_pulse(attotime::from_seconds(1), FUNC(wswan_rtc_callback)); + machine().scheduler().timer_pulse(attotime::from_seconds(1), timer_expired_delegate(FUNC(wswan_state::wswan_rtc_callback),this)); machine().device("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE); } @@ -1428,88 +1427,87 @@ DEVICE_IMAGE_LOAD(wswan_cart) return IMAGE_INIT_PASS; } -static TIMER_CALLBACK(wswan_scanline_interrupt) +TIMER_CALLBACK_MEMBER(wswan_state::wswan_scanline_interrupt) { - wswan_state *state = machine.driver_data(); - if( state->m_vdp.current_line < 144 ) + if( m_vdp.current_line < 144 ) { - wswan_refresh_scanline(machine); + wswan_refresh_scanline(machine()); } /* Decrement 12kHz (HBlank) counter */ - if ( state->m_vdp.timer_hblank_enable && state->m_vdp.timer_hblank_reload != 0 ) + if ( m_vdp.timer_hblank_enable && m_vdp.timer_hblank_reload != 0 ) { - state->m_vdp.timer_hblank_count--; - logerror( "timer_hblank_count: %X\n", state->m_vdp.timer_hblank_count ); - if ( state->m_vdp.timer_hblank_count == 0 ) + m_vdp.timer_hblank_count--; + logerror( "timer_hblank_count: %X\n", m_vdp.timer_hblank_count ); + if ( m_vdp.timer_hblank_count == 0 ) { - if ( state->m_vdp.timer_hblank_mode ) + if ( m_vdp.timer_hblank_mode ) { - state->m_vdp.timer_hblank_count = state->m_vdp.timer_hblank_reload; + m_vdp.timer_hblank_count = m_vdp.timer_hblank_reload; } else { - state->m_vdp.timer_hblank_reload = 0; + m_vdp.timer_hblank_reload = 0; } logerror( "trigerring hbltmr interrupt\n" ); - wswan_set_irq_line( machine, WSWAN_IFLAG_HBLTMR ); + wswan_set_irq_line( machine(), WSWAN_IFLAG_HBLTMR ); } } /* Handle Sound DMA */ - if ( ( state->m_sound_dma.enable & 0x88 ) == 0x80 ) + if ( ( m_sound_dma.enable & 0x88 ) == 0x80 ) { - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM ); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM ); /* TODO: Output sound DMA byte */ - state->wswan_port_w( space, 0x89, space.read_byte(state->m_sound_dma.source ) ); - state->m_sound_dma.size--; - state->m_sound_dma.source = ( state->m_sound_dma.source + 1 ) & 0x0FFFFF; - if ( state->m_sound_dma.size == 0 ) + wswan_port_w( space, 0x89, space.read_byte(m_sound_dma.source ) ); + m_sound_dma.size--; + m_sound_dma.source = ( m_sound_dma.source + 1 ) & 0x0FFFFF; + if ( m_sound_dma.size == 0 ) { - state->m_sound_dma.enable &= 0x7F; + m_sound_dma.enable &= 0x7F; } } -// state->m_vdp.current_line = (state->m_vdp.current_line + 1) % 159; +// m_vdp.current_line = (m_vdp.current_line + 1) % 159; - if( state->m_vdp.current_line == 144 ) // buffer sprite table + if( m_vdp.current_line == 144 ) // buffer sprite table { - memcpy(state->m_vdp.sprite_table_buffer, &state->m_vdp.vram[state->m_vdp.sprite_table_address], 512); - state->m_vdp.sprite_count = state->m_ws_portram[0x06]; - state->m_vdp.sprite_first = state->m_ws_portram[0x05]; // always zero? + memcpy(m_vdp.sprite_table_buffer, &m_vdp.vram[m_vdp.sprite_table_address], 512); + m_vdp.sprite_count = m_ws_portram[0x06]; + m_vdp.sprite_first = m_ws_portram[0x05]; // always zero? } - if( state->m_vdp.current_line == 144 ) + if( m_vdp.current_line == 144 ) { - wswan_set_irq_line( machine, WSWAN_IFLAG_VBL ); + wswan_set_irq_line( machine(), WSWAN_IFLAG_VBL ); /* Decrement 75Hz (VBlank) counter */ - if ( state->m_vdp.timer_vblank_enable && state->m_vdp.timer_vblank_reload != 0 ) + if ( m_vdp.timer_vblank_enable && m_vdp.timer_vblank_reload != 0 ) { - state->m_vdp.timer_vblank_count--; - logerror( "timer_vblank_count: %X\n", state->m_vdp.timer_vblank_count ); - if ( state->m_vdp.timer_vblank_count == 0 ) + m_vdp.timer_vblank_count--; + logerror( "timer_vblank_count: %X\n", m_vdp.timer_vblank_count ); + if ( m_vdp.timer_vblank_count == 0 ) { - if ( state->m_vdp.timer_vblank_mode ) + if ( m_vdp.timer_vblank_mode ) { - state->m_vdp.timer_vblank_count = state->m_vdp.timer_vblank_reload; + m_vdp.timer_vblank_count = m_vdp.timer_vblank_reload; } else { - state->m_vdp.timer_vblank_reload = 0; + m_vdp.timer_vblank_reload = 0; } logerror( "triggering vbltmr interrupt\n" ); - wswan_set_irq_line( machine, WSWAN_IFLAG_VBLTMR ); + wswan_set_irq_line( machine(), WSWAN_IFLAG_VBLTMR ); } } } -// state->m_vdp.current_line = (state->m_vdp.current_line + 1) % 159; +// m_vdp.current_line = (m_vdp.current_line + 1) % 159; - if ( state->m_vdp.current_line == state->m_vdp.line_compare ) + if ( m_vdp.current_line == m_vdp.line_compare ) { - wswan_set_irq_line( machine, WSWAN_IFLAG_LCMP ); + wswan_set_irq_line( machine(), WSWAN_IFLAG_LCMP ); } - state->m_vdp.current_line = (state->m_vdp.current_line + 1) % 159; + m_vdp.current_line = (m_vdp.current_line + 1) % 159; } diff --git a/src/mess/machine/z80ne.c b/src/mess/machine/z80ne.c index fb81ed5fd9e..ae52d4d2089 100644 --- a/src/mess/machine/z80ne.c +++ b/src/mess/machine/z80ne.c @@ -39,39 +39,38 @@ static cassette_image_device *cassette_device_image(running_machine &machine) return machine.device(CASSETTE_TAG); } -static TIMER_CALLBACK(z80ne_cassette_tc) +TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_cassette_tc) { - z80ne_state *state = machine.driver_data(); UINT8 cass_ws = 0; - 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) & cass_ws) + if ((cass_ws ^ m_cass_data.input.level) & cass_ws) { - state->m_cass_data.input.level = cass_ws; - state->m_cass_data.input.bit = ((state->m_cass_data.input.length < state->m_cass_data.wave_filter) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0; - state->m_cass_data.input.length = 0; - ay31015_set_input_pin( state->m_ay31015, 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 < m_cass_data.wave_filter) || (m_cass_data.input.length > 0x20)) ? 1 : 0; + m_cass_data.input.length = 0; + ay31015_set_input_pin( m_ay31015, AY31015_SI, m_cass_data.input.bit ); } - state->m_cass_data.input.level = cass_ws; + m_cass_data.input.level = cass_ws; /* saving a tape - convert the serial stream from the uart */ - state->m_cass_data.output.length--; + m_cass_data.output.length--; - if (!(state->m_cass_data.output.length)) + if (!(m_cass_data.output.length)) { - if (state->m_cass_data.output.level) - state->m_cass_data.output.level = 0; + if (m_cass_data.output.level) + m_cass_data.output.level = 0; else { - state->m_cass_data.output.level=1; - cass_ws = ay31015_get_output_pin( state->m_ay31015, AY31015_SO ); - state->m_cass_data.wave_length = cass_ws ? state->m_cass_data.wave_short : state->m_cass_data.wave_long; + m_cass_data.output.level=1; + cass_ws = ay31015_get_output_pin( m_ay31015, AY31015_SO ); + m_cass_data.wave_length = cass_ws ? m_cass_data.wave_short : m_cass_data.wave_long; } - cassette_device_image(machine)->output(state->m_cass_data.output.level ? -1.0 : +1.0); - state->m_cass_data.output.length = state->m_cass_data.wave_length; + cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0); + m_cass_data.output.length = m_cass_data.wave_length; } } @@ -114,9 +113,8 @@ DRIVER_INIT_MEMBER(z80ne_state,z80netf) } -static TIMER_CALLBACK( z80ne_kbd_scan ) +TIMER_CALLBACK_MEMBER(z80ne_state::z80ne_kbd_scan) { - z80ne_state *state = machine.driver_data(); /* * NE555 is connected to a 74LS93 binary counter * 74LS93 output: @@ -141,19 +139,19 @@ static TIMER_CALLBACK( z80ne_kbd_scan ) UINT8 i; /* 4-bit counter */ - --state->m_lx383_scan_counter; - state->m_lx383_scan_counter &= 0x0f; + --m_lx383_scan_counter; + m_lx383_scan_counter &= 0x0f; - if ( --state->m_lx383_downsampler == 0 ) + if ( --m_lx383_downsampler == 0 ) { - state->m_lx383_downsampler = LX383_DOWNSAMPLING; - key_bits = (machine.root_device().ioport("ROW1")->read() << 8) | machine.root_device().ioport("ROW0")->read(); -// rst = machine.root_device().ioport("RST")->read(); - ctrl = machine.root_device().ioport("CTRL")->read(); + m_lx383_downsampler = LX383_DOWNSAMPLING; + key_bits = (machine().root_device().ioport("ROW1")->read() << 8) | machine().root_device().ioport("ROW0")->read(); +// rst = machine().root_device().ioport("RST")->read(); + ctrl = machine().root_device().ioport("CTRL")->read(); for ( i = 0; im_lx383_key[i] = ( i | (key_bits & 0x01 ? 0x80 : 0x00) | ~ctrl); + m_lx383_key[i] = ( i | (key_bits & 0x01 ? 0x80 : 0x00) | ~ctrl); key_bits >>= 1; } } @@ -399,8 +397,8 @@ MACHINE_START_MEMBER(z80ne_state,z80ne) state_save_register_item( machine(), "z80ne", NULL, 0, m_lx383_downsampler ); state_save_register_item_array( machine(), "z80ne", NULL, 0, m_lx383_key ); state_save_register_item( machine(), "z80ne", NULL, 0, m_nmi_delay_counter ); - m_cassette_timer = machine().scheduler().timer_alloc(FUNC(z80ne_cassette_tc)); - machine().scheduler().timer_pulse( attotime::from_hz(1000), FUNC(z80ne_kbd_scan)); + m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ne_state::z80ne_cassette_tc),this)); + machine().scheduler().timer_pulse( attotime::from_hz(1000), timer_expired_delegate(FUNC(z80ne_state::z80ne_kbd_scan),this)); } MACHINE_START_MEMBER(z80ne_state,z80net) diff --git a/src/mess/machine/zx.c b/src/mess/machine/zx.c index c4246ad570b..8bbe45459e8 100644 --- a/src/mess/machine/zx.c +++ b/src/mess/machine/zx.c @@ -90,10 +90,9 @@ MACHINE_RESET_MEMBER(zx_state,pc8300) m_tape_bit = 0x80; } -static TIMER_CALLBACK(zx_tape_pulse) +TIMER_CALLBACK_MEMBER(zx_state::zx_tape_pulse) { - zx_state *state = machine.driver_data(); - state->m_tape_bit = 0x80; + m_tape_bit = 0x80; } READ8_MEMBER( zx_state::zx80_io_r ) @@ -138,7 +137,7 @@ READ8_MEMBER( zx_state::zx80_io_r ) if (((machine().device(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) { m_tape_bit = 0x00; - machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse)); + machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); } data &= ~m_tape_bit; @@ -195,7 +194,7 @@ READ8_MEMBER( zx_state::zx81_io_r ) if (((machine().device(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) { m_tape_bit = 0x00; - machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse)); + machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); } data &= ~m_tape_bit; @@ -259,7 +258,7 @@ READ8_MEMBER( zx_state::pc8300_io_r ) if (((machine().device(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) { m_tape_bit = 0x00; - machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse)); + machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); } data &= ~m_tape_bit; @@ -328,7 +327,7 @@ READ8_MEMBER( zx_state::pow3000_io_r ) if (((machine().device(CASSETTE_TAG))->input() < -0.75) && m_tape_bit) { m_tape_bit = 0x00; - machine().scheduler().timer_set(attotime::from_usec(362), FUNC(zx_tape_pulse)); + machine().scheduler().timer_set(attotime::from_usec(362), timer_expired_delegate(FUNC(zx_state::zx_tape_pulse),this)); } data &= ~m_tape_bit; diff --git a/src/mess/video/atarist.c b/src/mess/video/atarist.c index 13904018fb5..a0e23769fb8 100644 --- a/src/mess/video/atarist.c +++ b/src/mess/video/atarist.c @@ -166,11 +166,10 @@ void st_state::shifter_tick() // TIMER_CALLBACK( atarist_shifter_tick ) //------------------------------------------------- -static TIMER_CALLBACK( atarist_shifter_tick ) +TIMER_CALLBACK_MEMBER(st_state::atarist_shifter_tick) { - st_state *state = machine.driver_data(); - state->shifter_tick(); + shifter_tick(); } @@ -298,11 +297,10 @@ void st_state::glue_tick() // TIMER_CALLBACK( atarist_glue_tick ) //------------------------------------------------- -static TIMER_CALLBACK( atarist_glue_tick ) +TIMER_CALLBACK_MEMBER(st_state::atarist_glue_tick) { - st_state *state = machine.driver_data(); - state->glue_tick(); + glue_tick(); } @@ -752,11 +750,10 @@ void st_state::blitter_tick() // TIMER_CALLBACK( atarist_blitter_tick ) //------------------------------------------------- -static TIMER_CALLBACK( atarist_blitter_tick ) +TIMER_CALLBACK_MEMBER(st_state::atarist_blitter_tick) { - st_state *state = machine.driver_data(); - state->blitter_tick(); + blitter_tick(); } @@ -1086,7 +1083,7 @@ WRITE16_MEMBER( st_state::blitter_ctrl_w ) m_mfp->i3_w(m_blitter_done); int nops = BLITTER_NOPS[m_blitter_op][m_blitter_hop]; // each NOP takes 4 cycles - machine().scheduler().timer_set(attotime::from_hz((Y2/4)/(4*nops)), FUNC(atarist_blitter_tick)); + machine().scheduler().timer_set(attotime::from_hz((Y2/4)/(4*nops)), timer_expired_delegate(FUNC(st_state::atarist_blitter_tick),this)); } } } @@ -1108,8 +1105,8 @@ WRITE16_MEMBER( st_state::blitter_ctrl_w ) void st_state::video_start() { - m_shifter_timer = machine().scheduler().timer_alloc(FUNC(atarist_shifter_tick)); - m_glue_timer = machine().scheduler().timer_alloc(FUNC(atarist_glue_tick)); + m_shifter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_state::atarist_shifter_tick),this)); + m_glue_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(st_state::atarist_glue_tick),this)); // m_shifter_timer->adjust(machine().primary_screen->time_until_pos(0), 0, attotime::from_hz(Y2/4)); // 125 ns m_glue_timer->adjust(machine().primary_screen->time_until_pos(0), 0, attotime::from_hz(Y2/16)); // 500 ns diff --git a/src/mess/video/electron.c b/src/mess/video/electron.c index c29ff0eb2b6..b9724dcb9bd 100644 --- a/src/mess/video/electron.c +++ b/src/mess/video/electron.c @@ -35,7 +35,7 @@ Mode changes are 'immediate', so any change in RAM access timing occurs exactly */ -static TIMER_CALLBACK( electron_scanline_interrupt ); + void electron_state::video_start() @@ -45,7 +45,7 @@ void electron_state::video_start() m_map4[i] = ( ( i & 0x10 ) >> 3 ) | ( i & 0x01 ); m_map16[i] = ( ( i & 0x40 ) >> 3 ) | ( ( i & 0x10 ) >> 2 ) | ( ( i & 0x04 ) >> 1 ) | ( i & 0x01 ); } - m_scanline_timer = machine().scheduler().timer_alloc(FUNC(electron_scanline_interrupt)); + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_scanline_interrupt),this)); m_scanline_timer->adjust( machine().primary_screen->time_until_pos(0), 0, machine().primary_screen->scan_period() ); } @@ -254,19 +254,18 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 return 0; } -static TIMER_CALLBACK( electron_scanline_interrupt ) +TIMER_CALLBACK_MEMBER(electron_state::electron_scanline_interrupt) { - electron_state *state = machine.driver_data(); - switch (machine.primary_screen->vpos()) + switch (machine().primary_screen->vpos()) { case 43: - electron_interrupt_handler( machine, INT_SET, INT_RTC ); + electron_interrupt_handler( machine(), INT_SET, INT_RTC ); break; case 199: - electron_interrupt_handler( machine, INT_SET, INT_DISPLAY_END ); + electron_interrupt_handler( machine(), INT_SET, INT_DISPLAY_END ); break; case 0: - state->m_ula.screen_addr = state->m_ula.screen_start - state->m_ula.screen_base; + m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base; break; } } diff --git a/src/mess/video/fm7.c b/src/mess/video/fm7.c index c52ba43a7eb..0abb22eb525 100644 --- a/src/mess/video/fm7.c +++ b/src/mess/video/fm7.c @@ -94,10 +94,9 @@ WRITE8_MEMBER(fm7_state::fm7_vram_access_w) m_video.vram_access = 0; } -static TIMER_CALLBACK( fm77av_alu_task_end ) +TIMER_CALLBACK_MEMBER(fm7_state::fm77av_alu_task_end) { - fm7_state *state = machine.driver_data(); - state->m_alu.busy = 0; + m_alu.busy = 0; } static void fm7_alu_mask_write(fm7_state *state, UINT32 offset, int bank, UINT8 dat) @@ -628,7 +627,7 @@ static void fm77av_line_draw(running_machine &machine) // set timer to disable busy flag // 1/16 us for each byte changed - machine.scheduler().timer_set(attotime::from_usec(byte_count/16), FUNC(fm77av_alu_task_end)); + machine.scheduler().timer_set(attotime::from_usec(byte_count/16), timer_expired_delegate(FUNC(fm7_state::fm77av_alu_task_end),state)); } READ8_MEMBER(fm7_state::fm7_vram_r) @@ -1350,18 +1349,17 @@ WRITE8_MEMBER(fm7_state::fm77av_alu_w) } } -TIMER_CALLBACK( fm77av_vsync ) +TIMER_CALLBACK_MEMBER(fm7_state::fm77av_vsync) { - fm7_state *state = machine.driver_data(); if(param == 0) // start of vsync { - state->m_video.vsync_flag = 1; - state->m_fm77av_vsync_timer->adjust(attotime::from_usec(510),1); // VSync length for 200 line modes = 0.51ms + m_video.vsync_flag = 1; + m_fm77av_vsync_timer->adjust(attotime::from_usec(510),1); // VSync length for 200 line modes = 0.51ms } else { - state->m_video.vsync_flag = 0; - state->m_fm77av_vsync_timer->adjust(machine.primary_screen->time_until_vblank_end()); + m_video.vsync_flag = 0; + m_fm77av_vsync_timer->adjust(machine().primary_screen->time_until_vblank_end()); } } diff --git a/src/mess/video/fmtowns.c b/src/mess/video/fmtowns.c index 185541080c6..1e84be030d7 100644 --- a/src/mess/video/fmtowns.c +++ b/src/mess/video/fmtowns.c @@ -1766,25 +1766,23 @@ static void draw_text_layer(running_machine &machine) } } -static TIMER_CALLBACK( towns_sprite_done ) +TIMER_CALLBACK_MEMBER(towns_state::towns_sprite_done) { // sprite drawing is complete, lower flag - towns_state* state = machine.driver_data(); - state->m_video.towns_sprite_flag = 0; - if(state->m_video.towns_sprite_page != 0) - state->m_video.towns_crtc_reg[21] |= 0x8000; + m_video.towns_sprite_flag = 0; + if(m_video.towns_sprite_page != 0) + m_video.towns_crtc_reg[21] |= 0x8000; else - state->m_video.towns_crtc_reg[21] &= ~0x8000; + m_video.towns_crtc_reg[21] &= ~0x8000; } -static TIMER_CALLBACK( towns_vblank_end ) +TIMER_CALLBACK_MEMBER(towns_state::towns_vblank_end) { // here we'll clear the vsync signal, I presume it goes low on it's own eventually - towns_state* state = machine.driver_data(); device_t* dev = (device_t*)ptr; pic8259_ir3_w(dev, 0); // IRQ11 = VSync if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n"); - state->m_video.towns_vblank_flag = 0; + m_video.towns_vblank_flag = 0; } INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq) @@ -1793,7 +1791,7 @@ INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq) pic8259_ir3_w(dev, 1); // IRQ11 = VSync if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set high\n"); m_video.towns_vblank_flag = 1; - machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_end(), FUNC(towns_vblank_end), 0, (void*)dev); + machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this), 0, (void*)dev); if(m_video.towns_tvram_enable) draw_text_layer(dev->machine()); if(m_video.towns_sprite_reg[1] & 0x80) @@ -1804,7 +1802,7 @@ void towns_state::video_start() { m_video.towns_vram_wplane = 0x00; m_video.towns_sprite_page = 0; - m_video.sprite_timer = machine().scheduler().timer_alloc(FUNC(towns_sprite_done)); + m_video.sprite_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(towns_state::towns_sprite_done),this)); } UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mess/video/galaxy.c b/src/mess/video/galaxy.c index f3add79782c..4c8e049b30b 100644 --- a/src/mess/video/galaxy.c +++ b/src/mess/video/galaxy.c @@ -13,93 +13,92 @@ #include "cpu/z80/z80.h" -static TIMER_CALLBACK( gal_video ) +TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) { - galaxy_state *state = machine.driver_data(); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int y, x; - if (state->m_interrupts_enabled == TRUE) + if (m_interrupts_enabled == TRUE) { - UINT8 *gfx = state->memregion("gfx1")->base(); - UINT8 dat = (state->m_latch_value & 0x3c) >> 2; - if ((state->m_gal_cnt >= 48 * 2) && (state->m_gal_cnt < 48 * 210)) // display on screen just state->m_first 208 lines + UINT8 *gfx = memregion("gfx1")->base(); + UINT8 dat = (m_latch_value & 0x3c) >> 2; + if ((m_gal_cnt >= 48 * 2) && (m_gal_cnt < 48 * 210)) // display on screen just m_first 208 lines { - UINT8 mode = (state->m_latch_value >> 1) & 1; // bit 2 latch represents mode - UINT16 addr = (machine.device("maincpu")->state().state_int(Z80_I) << 8) | machine.device("maincpu")->state().state_int(Z80_R) | ((state->m_latch_value & 0x80) ^ 0x80); + UINT8 mode = (m_latch_value >> 1) & 1; // bit 2 latch represents mode + UINT16 addr = (machine().device("maincpu")->state().state_int(Z80_I) << 8) | machine().device("maincpu")->state().state_int(Z80_R) | ((m_latch_value & 0x80) ^ 0x80); if (mode == 0) { // Text mode - if (state->m_first == 0 && (machine.device("maincpu")->state().state_int(Z80_R) & 0x1f) == 0) + if (m_first == 0 && (machine().device("maincpu")->state().state_int(Z80_R) & 0x1f) == 0) { // Due to a fact that on real processor latch value is set at // the end of last cycle we need to skip dusplay of double - // state->m_first char in each row - state->m_code = 0x00; - state->m_first = 1; + // m_first char in each row + m_code = 0x00; + m_first = 1; } else { - state->m_code = space.read_byte(addr) & 0xbf; - state->m_code += (state->m_code & 0x80) >> 1; - state->m_code = gfx[(state->m_code & 0x7f) +(dat << 7 )] ^ 0xff; - state->m_first = 0; + m_code = space.read_byte(addr) & 0xbf; + m_code += (m_code & 0x80) >> 1; + m_code = gfx[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; + m_first = 0; } - y = state->m_gal_cnt / 48 - 2; - x = (state->m_gal_cnt % 48) * 8; + y = m_gal_cnt / 48 - 2; + x = (m_gal_cnt % 48) * 8; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 0) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 1) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 2) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 3) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 4) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 5) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 6) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 7) & 1; + m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; } else { // Graphics mode - if (state->m_first < 4 && (machine.device("maincpu")->state().state_int(Z80_R) & 0x1f) == 0) + if (m_first < 4 && (machine().device("maincpu")->state().state_int(Z80_R) & 0x1f) == 0) { // Due to a fact that on real processor latch value is set at // the end of last cycle we need to skip dusplay of 4 times - // state->m_first char in each row - state->m_code = 0x00; - state->m_first++; + // m_first char in each row + m_code = 0x00; + m_first++; } else { - state->m_code = space.read_byte(addr) ^ 0xff; - state->m_first = 0; + m_code = space.read_byte(addr) ^ 0xff; + m_first = 0; } - y = state->m_gal_cnt / 48 - 2; - x = (state->m_gal_cnt % 48) * 8; + y = m_gal_cnt / 48 - 2; + x = (m_gal_cnt % 48) * 8; /* hack - until calc of R is fixed in Z80 */ if (x == 11 * 8 && y == 0) { - state->m_start_addr = addr; + m_start_addr = addr; } if ((x / 8 >= 11) && (x / 8 < 44)) { - state->m_code = space.read_byte(state->m_start_addr + y * 32 + (state->m_gal_cnt % 48) - 11) ^ 0xff; + m_code = space.read_byte(m_start_addr + y * 32 + (m_gal_cnt % 48) - 11) ^ 0xff; } else { - state->m_code = 0x00; + m_code = 0x00; } /* end of hack */ - state->m_bitmap.pix16(y, x ) = (state->m_code >> 0) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 1) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 2) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 3) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 4) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 5) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 6) & 1; x++; - state->m_bitmap.pix16(y, x ) = (state->m_code >> 7) & 1; + m_bitmap.pix16(y, x ) = (m_code >> 0) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 1) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 2) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 3) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 4) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 5) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 6) & 1; x++; + m_bitmap.pix16(y, x ) = (m_code >> 7) & 1; } } - state->m_gal_cnt++; + m_gal_cnt++; } } @@ -114,7 +113,7 @@ void galaxy_state::video_start() { m_gal_cnt = 0; - m_gal_video_timer = machine().scheduler().timer_alloc(FUNC(gal_video)); + m_gal_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(galaxy_state::gal_video),this)); m_gal_video_timer->adjust(attotime::zero, 0, attotime::never); machine().primary_screen->register_screen_bitmap(m_bitmap); diff --git a/src/mess/video/gamecom.c b/src/mess/video/gamecom.c index 1f5420e7305..b514b59e8d5 100644 --- a/src/mess/video/gamecom.c +++ b/src/mess/video/gamecom.c @@ -4,26 +4,25 @@ #define Y_PIXELS 200 -static TIMER_CALLBACK( gamecom_scanline ) +TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) { - gamecom_state *state = machine.driver_data(); // draw line - if ( state->m_scanline == 0 ) - state->m_base_address = ( state->m_p_ram[SM8521_LCDC] & 0x40 ) ? 0x2000 : 0x0000; + if ( m_scanline == 0 ) + m_base_address = ( m_p_ram[SM8521_LCDC] & 0x40 ) ? 0x2000 : 0x0000; - if ( ~state->m_p_ram[SM8521_LCDC] & 0x80 ) + if ( ~m_p_ram[SM8521_LCDC] & 0x80 ) { - rectangle rec(0, Y_PIXELS - 1, state->m_scanline, state->m_scanline); - state->m_bitmap.fill(0, rec ); + rectangle rec(0, Y_PIXELS - 1, m_scanline, m_scanline); + m_bitmap.fill(0, rec ); return; } else { - UINT8 *line = &state->m_p_videoram[ state->m_base_address + 40 * state->m_scanline ]; + UINT8 *line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; int pal[4]; int i; - switch( state->m_p_ram[SM8521_LCDC] & 0x30 ) + switch( m_p_ram[SM8521_LCDC] & 0x30 ) { case 0x00: pal[0] = 4; @@ -53,19 +52,19 @@ static TIMER_CALLBACK( gamecom_scanline ) for( i = 0; i < 40; i++ ) { UINT8 p = line[i]; - state->m_bitmap.pix16(i * 4 + 0, state->m_scanline) = pal[ ( p >> 6 ) & 3 ]; - state->m_bitmap.pix16(i * 4 + 1, state->m_scanline) = pal[ ( p >> 4 ) & 3 ]; - state->m_bitmap.pix16(i * 4 + 2, state->m_scanline) = pal[ ( p >> 2 ) & 3 ]; - state->m_bitmap.pix16(i * 4 + 3, state->m_scanline) = pal[ ( p ) & 3 ]; + m_bitmap.pix16(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; + m_bitmap.pix16(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; + m_bitmap.pix16(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; + m_bitmap.pix16(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; } } - state->m_scanline = ( state->m_scanline + 1 ) % Y_PIXELS; + m_scanline = ( m_scanline + 1 ) % Y_PIXELS; } void gamecom_state::video_start() { - m_scanline_timer = machine().scheduler().timer_alloc(FUNC(gamecom_scanline)); + m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_scanline),this)); m_scanline_timer->adjust( machine().primary_screen->time_until_pos(0 ), 0, machine().primary_screen->scan_period() ); machine().primary_screen->register_screen_bitmap(m_bitmap); } diff --git a/src/mess/video/gb.c b/src/mess/video/gb.c index 0cfc406e6d5..98c93047aa4 100644 --- a/src/mess/video/gb.c +++ b/src/mess/video/gb.c @@ -47,8 +47,8 @@ enum { /* Prototypes */ -static TIMER_CALLBACK(gb_lcd_timer_proc); -static TIMER_CALLBACK(gbc_lcd_timer_proc); + + static void gb_lcd_switch_on( running_machine &machine ); static const unsigned char palette[] = @@ -1194,20 +1194,20 @@ enum { GB_LCD_STATE_LY00_M0 }; -static TIMER_CALLBACK( gb_video_init_vbl ) +TIMER_CALLBACK_MEMBER(gb_state::gb_video_init_vbl) { - machine.device("maincpu")->execute().set_input_line(VBL_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(VBL_INT, ASSERT_LINE ); } MACHINE_START_MEMBER(gb_state,gb_video) { - m_lcd.lcd_timer = machine().scheduler().timer_alloc(FUNC(gb_lcd_timer_proc)); + m_lcd.lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_lcd_timer_proc),this)); machine().primary_screen->register_screen_bitmap(m_bitmap); } MACHINE_START_MEMBER(gb_state,gbc_video) { - m_lcd.lcd_timer = machine().scheduler().timer_alloc(FUNC(gbc_lcd_timer_proc)); + m_lcd.lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gbc_lcd_timer_proc),this)); machine().primary_screen->register_screen_bitmap(m_bitmap); } @@ -1288,7 +1288,7 @@ void gb_video_reset( running_machine &machine, int mode ) memcpy( state->m_lcd.gb_oam->base(), mgb_oam_fingerprint, 0x100 ); /* Make sure the VBlank interrupt is set when the first instruction gets executed */ - machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(1), FUNC(gb_video_init_vbl)); + machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(1), timer_expired_delegate(FUNC(gb_state::gb_video_init_vbl),state)); /* Initialize some video registers */ state->gb_video_w( space, 0x0, 0x91 ); /* LCDCONT */ @@ -1367,50 +1367,50 @@ static void gb_increment_scanline( gb_state *state ) } } -static TIMER_CALLBACK(gb_lcd_timer_proc) +TIMER_CALLBACK_MEMBER(gb_state::gb_lcd_timer_proc) { - gb_state *state = machine.driver_data(); + gb_state *state = machine().driver_data(); static const int sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 }; - state->m_lcd.state = param; + m_lcd.state = param; if ( LCDCONT & 0x80 ) { - switch( state->m_lcd.state ) + switch( m_lcd.state ) { case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ - state->m_lcd.mode = 0; + m_lcd.mode = 0; if ( LCDSTAT & 0x08 ) { - if ( ! state->m_lcd.mode_irq ) + if ( ! m_lcd.mode_irq ) { - if ( ! state->m_lcd.line_irq && ! state->m_lcd.delayed_line_irq ) + if ( ! m_lcd.line_irq && ! m_lcd.delayed_line_irq ) { - state->m_lcd.mode_irq = 1; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.mode_irq = 1; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } else { - state->m_lcd.mode_irq = 0; + m_lcd.mode_irq = 0; } } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); break; case GB_LCD_STATE_LYXX_M0: /* Switch to mode 0 */ /* update current scanline */ - (*state->update_scanline)( machine ); + (*update_scanline)( machine() ); /* Increment the number of window lines drawn if enabled */ - if ( state->m_lcd.layer[1].enabled ) + if ( m_lcd.layer[1].enabled ) { - state->m_lcd.window_lines_drawn++; + m_lcd.window_lines_drawn++; } - state->m_lcd.previous_line = state->m_lcd.current_line; + m_lcd.previous_line = m_lcd.current_line; /* Set Mode 0 lcdstate */ - state->m_lcd.mode = 0; + m_lcd.mode = 0; LCDSTAT &= 0xFC; - state->m_lcd.oam_locked = UNLOCKED; - state->m_lcd.vram_locked = UNLOCKED; + m_lcd.oam_locked = UNLOCKED; + m_lcd.vram_locked = UNLOCKED; /* There seems to a kind of feature in the Game Boy hardware when the lowest bits of the SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later @@ -1419,134 +1419,134 @@ static TIMER_CALLBACK(gb_lcd_timer_proc) */ if ( ( SCROLLX & 0x03 ) == 0x03 ) { - state->m_lcd.scrollx_adjust += 4; - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); + m_lcd.scrollx_adjust += 4; + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); break; } case GB_LCD_STATE_LYXX_M0_SCX3: /* Generate lcd interrupt if requested */ - if ( ! state->m_lcd.mode_irq && ( LCDSTAT & 0x08 ) && - ( ( ! state->m_lcd.line_irq && state->m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) + if ( ! m_lcd.mode_irq && ( LCDSTAT & 0x08 ) && + ( ( ! m_lcd.line_irq && m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(196 - state->m_lcd.scrollx_adjust - state->m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(196 - m_lcd.scrollx_adjust - m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); break; case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ if ( CURLINE < 143 ) { - state->m_lcd.mode = 2; - state->m_lcd.triggering_mode_irq = ( LCDSTAT & 0x20 ) ? 1 : 0; - if ( state->m_lcd.triggering_mode_irq ) + m_lcd.mode = 2; + m_lcd.triggering_mode_irq = ( LCDSTAT & 0x20 ) ? 1 : 0; + if ( m_lcd.triggering_mode_irq ) { - if ( ! state->m_lcd.mode_irq ) + if ( ! m_lcd.mode_irq ) { - if ( ! state->m_lcd.line_irq && ! state->m_lcd.delayed_line_irq ) + if ( ! m_lcd.line_irq && ! m_lcd.delayed_line_irq ) { - state->m_lcd.mode_irq = 1; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.mode_irq = 1; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } else { - state->m_lcd.mode_irq = 0; + m_lcd.mode_irq = 0; } } } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); break; case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ - gb_increment_scanline(state); - state->m_lcd.delayed_line_irq = state->m_lcd.line_irq; - state->m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; - state->m_lcd.line_irq = 0; - if ( ! state->m_lcd.mode_irq && ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq && ! state->m_lcd.triggering_mode_irq ) + gb_increment_scanline(this); + m_lcd.delayed_line_irq = m_lcd.line_irq; + m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; + m_lcd.line_irq = 0; + if ( ! m_lcd.mode_irq && ! m_lcd.delayed_line_irq && m_lcd.triggering_line_irq && ! m_lcd.triggering_mode_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } /* Reset LY==LYC STAT bit */ LCDSTAT &= 0xFB; /* Check if we're going into VBlank next */ if ( CURLINE == 144 ) { - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); } else { /* Internally switch to mode 2 */ - state->m_lcd.mode = 2; + m_lcd.mode = 2; /* Generate lcd interrupt if requested */ - if ( ! state->m_lcd.mode_irq && state->m_lcd.triggering_mode_irq && - ( ( ! state->m_lcd.triggering_line_irq && ! state->m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) + if ( ! m_lcd.mode_irq && m_lcd.triggering_mode_irq && + ( ( ! m_lcd.triggering_line_irq && ! m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { - state->m_lcd.mode_irq = 1; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.mode_irq = 1; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); } break; case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ /* Set Mode 2 lcdstate */ - state->m_lcd.mode = 2; + m_lcd.mode = 2; LCDSTAT = ( LCDSTAT & 0xFC ) | 0x02; - state->m_lcd.oam_locked = LOCKED; + m_lcd.oam_locked = LOCKED; /* Generate lcd interrupt if requested */ - if ( ( LCDSTAT & 0x20 ) && ! state->m_lcd.line_irq ) + if ( ( LCDSTAT & 0x20 ) && ! m_lcd.line_irq ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } /* Check for regular compensation of x-scroll register */ - state->m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; + m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; /* Mode 2 lasts approximately 80 clock cycles */ - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); break; case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ /* Update STAT register to the correct state */ LCDSTAT = (LCDSTAT & 0xFC) | 0x02; - state->m_lcd.oam_locked = LOCKED; + m_lcd.oam_locked = LOCKED; /* Generate lcd interrupt if requested */ - if ( ( state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || - ( ! state->m_lcd.mode_irq && ! state->m_lcd.line_irq && ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_mode_irq ) ) + if ( ( m_lcd.delayed_line_irq && m_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || + ( ! m_lcd.mode_irq && ! m_lcd.line_irq && ! m_lcd.delayed_line_irq && m_lcd.triggering_mode_irq ) ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - state->m_lcd.triggering_mode_irq = 0; + m_lcd.line_irq = m_lcd.triggering_line_irq; + m_lcd.triggering_mode_irq = 0; /* Check if LY==LYC STAT bit should be set */ if ( CURLINE == CMPLINE ) { LCDSTAT |= 0x04; } /* Check for regular compensation of x-scroll register */ - state->m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; + m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; /* Mode 2 last for approximately 80 clock cycles */ - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); break; case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ - gb_select_sprites(state); - state->m_lcd.sprite_cycles = sprite_cycles[ state->m_lcd.sprCount ]; + gb_select_sprites(this); + m_lcd.sprite_cycles = sprite_cycles[ m_lcd.sprCount ]; /* Set Mode 3 lcdstate */ - state->m_lcd.mode = 3; + m_lcd.mode = 3; LCDSTAT = (LCDSTAT & 0xFC) | 0x03; - state->m_lcd.vram_locked = LOCKED; + m_lcd.vram_locked = LOCKED; /* Check for compensations of x-scroll register */ /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(168 + state->m_lcd.scrollx_adjust + state->m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); - state->m_lcd.start_x = -1; + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(168 + m_lcd.scrollx_adjust + m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); + m_lcd.start_x = -1; break; case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ if ( CURLINE == 144 ) { /* Trigger VBlank interrupt */ - machine.device("maincpu")->execute().set_input_line(VBL_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(VBL_INT, ASSERT_LINE ); /* Set VBlank lcdstate */ - state->m_lcd.mode = 1; + m_lcd.mode = 1; LCDSTAT = (LCDSTAT & 0xFC) | 0x01; /* Trigger LCD interrupt if requested */ if ( LCDSTAT & 0x10 ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } /* Check if LY==LYC STAT bit should be set */ @@ -1554,256 +1554,256 @@ static TIMER_CALLBACK(gb_lcd_timer_proc) { LCDSTAT |= 0x04; } - if ( state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + if ( m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); break; case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ - gb_increment_scanline(state); - state->m_lcd.delayed_line_irq = state->m_lcd.line_irq; - state->m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; - state->m_lcd.line_irq = 0; - if ( ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + gb_increment_scanline(this); + m_lcd.delayed_line_irq = m_lcd.line_irq; + m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; + m_lcd.line_irq = 0; + if ( ! m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } /* Reset LY==LYC STAT bit */ LCDSTAT &= 0xFB; - if ( state->m_lcd.current_line == 153 ) + if ( m_lcd.current_line == 153 ) { - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); } else { - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); } break; case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ /* Check LY=LYC for line #153 */ - if ( state->m_lcd.delayed_line_irq ) + if ( m_lcd.delayed_line_irq ) { - if ( state->m_lcd.triggering_line_irq ) + if ( m_lcd.triggering_line_irq ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } - state->m_lcd.delayed_line_irq = state->m_lcd.delayed_line_irq | state->m_lcd.line_irq; + m_lcd.delayed_line_irq = m_lcd.delayed_line_irq | m_lcd.line_irq; if ( CURLINE == CMPLINE ) { LCDSTAT |= 0x04; } - gb_increment_scanline(state); - state->m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; - state->m_lcd.line_irq = 0; + gb_increment_scanline(this); + m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; + m_lcd.line_irq = 0; LCDSTAT &= 0xFB; - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4/*8*/), GB_LCD_STATE_LY00_M1_1); break; case GB_LCD_STATE_LY00_M1_1: - if ( ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + if ( ! m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); break; case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ - if ( state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + if ( m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } if ( CURLINE == CMPLINE ) { LCDSTAT |= 0x04; } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); break; case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ /* Set Mode 0 lcdstat */ - state->m_lcd.mode = 0; + m_lcd.mode = 0; LCDSTAT = ( LCDSTAT & 0xFC ); - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); break; } } else { - gb_increment_scanline(state); - if ( state->m_lcd.current_line < 144 ) + gb_increment_scanline(this); + if ( m_lcd.current_line < 144 ) { - (*state->update_scanline)( machine ); + (*update_scanline)( machine() ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(456)); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(456)); } } -static TIMER_CALLBACK(gbc_lcd_timer_proc) +TIMER_CALLBACK_MEMBER(gb_state::gbc_lcd_timer_proc) { - gb_state *state = machine.driver_data(); + gb_state *state = machine().driver_data(); static const int sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 }; - state->m_lcd.state = param; + m_lcd.state = param; if ( LCDCONT & 0x80 ) { - switch( state->m_lcd.state ) + switch( m_lcd.state ) { case GB_LCD_STATE_LYXX_PRE_M0: /* Just before switching to mode 0 */ - state->m_lcd.mode = 0; + m_lcd.mode = 0; if ( LCDSTAT & 0x08 ) { - if ( ! state->m_lcd.mode_irq ) + if ( ! m_lcd.mode_irq ) { - if ( ! state->m_lcd.line_irq && ! state->m_lcd.delayed_line_irq ) + if ( ! m_lcd.line_irq && ! m_lcd.delayed_line_irq ) { - state->m_lcd.mode_irq = 1; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.mode_irq = 1; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } else { - state->m_lcd.mode_irq = 0; + m_lcd.mode_irq = 0; } } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0); break; case GB_LCD_STATE_LYXX_M0: /* Switch to mode 0 */ /* update current scanline */ - (*state->update_scanline)( machine ); + (*update_scanline)( machine() ); /* Increment the number of window lines drawn if enabled */ - if ( state->m_lcd.layer[1].enabled ) + if ( m_lcd.layer[1].enabled ) { - state->m_lcd.window_lines_drawn++; + m_lcd.window_lines_drawn++; } - state->m_lcd.previous_line = state->m_lcd.current_line; + m_lcd.previous_line = m_lcd.current_line; /* Set Mode 0 lcdstate */ - state->m_lcd.mode = 0; + m_lcd.mode = 0; LCDSTAT &= 0xFC; - state->m_lcd.oam_locked = UNLOCKED; - state->m_lcd.vram_locked = UNLOCKED; + m_lcd.oam_locked = UNLOCKED; + m_lcd.vram_locked = UNLOCKED; /* There seems to a kind of feature in the Game Boy hardware when the lowest bits of the SCROLLX register equals 3 or 7, then the delayed M0 irq is triggered 4 cycles later than usual. The SGB probably has the same bug. */ - state->m_lcd.triggering_mode_irq = ( LCDSTAT & 0x08 ) ? 1 : 0; + m_lcd.triggering_mode_irq = ( LCDSTAT & 0x08 ) ? 1 : 0; if ( ( SCROLLX & 0x03 ) == 0x03 ) { - state->m_lcd.scrollx_adjust += 4; - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); + m_lcd.scrollx_adjust += 4; + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_SCX3); break; } case GB_LCD_STATE_LYXX_M0_SCX3: /* Generate lcd interrupt if requested */ - if ( ! state->m_lcd.mode_irq && state->m_lcd.triggering_mode_irq && - ( ( ! state->m_lcd.line_irq && state->m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) + if ( ! m_lcd.mode_irq && m_lcd.triggering_mode_irq && + ( ( ! m_lcd.line_irq && m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); - state->m_lcd.triggering_mode_irq = 0; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.triggering_mode_irq = 0; } if ( ( SCROLLX & 0x03 ) == 0x03 ) { - state->m_lcd.pal_locked = UNLOCKED; + m_lcd.pal_locked = UNLOCKED; } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_GBC_PAL); break; case GB_LCD_STATE_LYXX_M0_GBC_PAL: - state->m_lcd.pal_locked = UNLOCKED; + m_lcd.pal_locked = UNLOCKED; /* Check for HBLANK DMA */ - if( state->m_lcd.hdma_enabled ) + if( m_lcd.hdma_enabled ) { - gbc_hdma(machine, 0x10); + gbc_hdma(machine(), 0x10); // cpunum_set_reg( 0, LR35902_DMA_CYCLES, 36 ); } else { - state->m_lcd.hdma_possible = 1; + m_lcd.hdma_possible = 1; } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(192 - state->m_lcd.scrollx_adjust - state->m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(192 - m_lcd.scrollx_adjust - m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_M0_PRE_INC); break; case GB_LCD_STATE_LYXX_M0_PRE_INC: /* Just before incrementing the line counter go to mode 2 internally */ - state->m_lcd.cmp_line = CMPLINE; + m_lcd.cmp_line = CMPLINE; if ( CURLINE < 143 ) { - state->m_lcd.mode = 2; + m_lcd.mode = 2; if ( LCDSTAT & 0x20 ) { - if ( ! state->m_lcd.mode_irq ) + if ( ! m_lcd.mode_irq ) { - if ( ! state->m_lcd.line_irq && ! state->m_lcd.delayed_line_irq ) + if ( ! m_lcd.line_irq && ! m_lcd.delayed_line_irq ) { - state->m_lcd.mode_irq = 1; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.mode_irq = 1; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } else { - state->m_lcd.mode_irq = 0; + m_lcd.mode_irq = 0; } } } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M0_INC); break; case GB_LCD_STATE_LYXX_M0_INC: /* Increment LY, stay in M0 for 4 more cycles */ - gb_increment_scanline(state); - state->m_lcd.delayed_line_irq = state->m_lcd.line_irq; - state->m_lcd.triggering_line_irq = ( ( state->m_lcd.cmp_line == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; - state->m_lcd.line_irq = 0; - if ( ! state->m_lcd.mode_irq && ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) + gb_increment_scanline(this); + m_lcd.delayed_line_irq = m_lcd.line_irq; + m_lcd.triggering_line_irq = ( ( m_lcd.cmp_line == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; + m_lcd.line_irq = 0; + if ( ! m_lcd.mode_irq && ! m_lcd.delayed_line_irq && m_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.hdma_possible = 0; + m_lcd.hdma_possible = 0; /* Check if we're going into VBlank next */ if ( CURLINE == 144 ) { - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); } else { /* Internally switch to mode 2 */ - state->m_lcd.mode = 2; + m_lcd.mode = 2; /* Generate lcd interrupt if requested */ - if ( ! state->m_lcd.mode_irq && ( LCDSTAT & 0x20 ) && - ( ( ! state->m_lcd.triggering_line_irq && ! state->m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) + if ( ! m_lcd.mode_irq && ( LCDSTAT & 0x20 ) && + ( ( ! m_lcd.triggering_line_irq && ! m_lcd.delayed_line_irq ) || ! ( LCDSTAT & 0x40 ) ) ) { - state->m_lcd.mode_irq = 1; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.mode_irq = 1; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LYXX_M2); } break; case GB_LCD_STATE_LY00_M2: /* Switch to mode 2 on line #0 */ /* Set Mode 2 lcdstate */ - state->m_lcd.mode = 2; + m_lcd.mode = 2; LCDSTAT = ( LCDSTAT & 0xFC ) | 0x02; - state->m_lcd.oam_locked = LOCKED; + m_lcd.oam_locked = LOCKED; /* Generate lcd interrupt if requested */ - if ( ( LCDSTAT & 0x20 ) && ! state->m_lcd.line_irq ) + if ( ( LCDSTAT & 0x20 ) && ! m_lcd.line_irq ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } /* Check for regular compensation of x-scroll register */ - state->m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; + m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; /* Mode 2 lasts approximately 80 clock cycles */ - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); break; case GB_LCD_STATE_LYXX_M2: /* Switch to mode 2 */ /* Update STAT register to the correct state */ LCDSTAT = (LCDSTAT & 0xFC) | 0x02; - state->m_lcd.oam_locked = LOCKED; + m_lcd.oam_locked = LOCKED; /* Generate lcd interrupt if requested */ - if ( ( state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || - ( !state->m_lcd.mode_irq && ! state->m_lcd.line_irq && ! state->m_lcd.delayed_line_irq && ( LCDSTAT & 0x20 ) ) ) + if ( ( m_lcd.delayed_line_irq && m_lcd.triggering_line_irq && ! ( LCDSTAT & 0x20 ) ) || + ( !m_lcd.mode_irq && ! m_lcd.line_irq && ! m_lcd.delayed_line_irq && ( LCDSTAT & 0x20 ) ) ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; + m_lcd.line_irq = m_lcd.triggering_line_irq; /* Check if LY==LYC STAT bit should be set */ if ( CURLINE == CMPLINE ) { @@ -1814,35 +1814,35 @@ static TIMER_CALLBACK(gbc_lcd_timer_proc) LCDSTAT &= ~0x04; } /* Check for regular compensation of x-scroll register */ - state->m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; + m_lcd.scrollx_adjust = ( SCROLLX & 0x04 ) ? 4 : 0; /* Mode 2 last for approximately 80 clock cycles */ - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(80), GB_LCD_STATE_LYXX_M3); break; case GB_LCD_STATE_LYXX_M3: /* Switch to mode 3 */ - gb_select_sprites(state); - state->m_lcd.sprite_cycles = sprite_cycles[ state->m_lcd.sprCount ]; + gb_select_sprites(this); + m_lcd.sprite_cycles = sprite_cycles[ m_lcd.sprCount ]; /* Set Mode 3 lcdstate */ - state->m_lcd.mode = 3; + m_lcd.mode = 3; LCDSTAT = (LCDSTAT & 0xFC) | 0x03; - state->m_lcd.vram_locked = LOCKED; - state->m_lcd.pal_locked = LOCKED; + m_lcd.vram_locked = LOCKED; + m_lcd.pal_locked = LOCKED; /* Check for compensations of x-scroll register */ /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */ - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(168 + state->m_lcd.scrollx_adjust + state->m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); - state->m_lcd.start_x = -1; + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(168 + m_lcd.scrollx_adjust + m_lcd.sprite_cycles), GB_LCD_STATE_LYXX_PRE_M0); + m_lcd.start_x = -1; break; case GB_LCD_STATE_LY9X_M1: /* Switch to or stay in mode 1 */ if ( CURLINE == 144 ) { /* Trigger VBlank interrupt */ - machine.device("maincpu")->execute().set_input_line(VBL_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(VBL_INT, ASSERT_LINE ); /* Set VBlank lcdstate */ - state->m_lcd.mode = 1; + m_lcd.mode = 1; LCDSTAT = (LCDSTAT & 0xFC) | 0x01; /* Trigger LCD interrupt if requested */ if ( LCDSTAT & 0x10 ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } /* Check if LY==LYC STAT bit should be set */ @@ -1854,41 +1854,41 @@ static TIMER_CALLBACK(gbc_lcd_timer_proc) { LCDSTAT &= ~0x04; } - if ( state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + if ( m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(452), GB_LCD_STATE_LY9X_M1_INC); break; case GB_LCD_STATE_LY9X_M1_INC: /* Increment scanline counter */ - gb_increment_scanline(state); - state->m_lcd.delayed_line_irq = state->m_lcd.line_irq; - state->m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; - state->m_lcd.line_irq = 0; - if ( ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + gb_increment_scanline(this); + m_lcd.delayed_line_irq = m_lcd.line_irq; + m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; + m_lcd.line_irq = 0; + if ( ! m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - if ( state->m_lcd.current_line == 153 ) + if ( m_lcd.current_line == 153 ) { - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1); } else { - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY9X_M1); } break; case GB_LCD_STATE_LY00_M1: /* we stay in VBlank but current line counter should already be incremented */ /* Check LY=LYC for line #153 */ - if ( state->m_lcd.delayed_line_irq ) + if ( m_lcd.delayed_line_irq ) { - if ( state->m_lcd.triggering_line_irq ) + if ( m_lcd.triggering_line_irq ) { - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } } - state->m_lcd.delayed_line_irq = state->m_lcd.delayed_line_irq | state->m_lcd.line_irq; + m_lcd.delayed_line_irq = m_lcd.delayed_line_irq | m_lcd.line_irq; if ( CURLINE == CMPLINE ) { LCDSTAT |= 0x04; @@ -1897,25 +1897,25 @@ static TIMER_CALLBACK(gbc_lcd_timer_proc) { LCDSTAT &= ~0x04; } - gb_increment_scanline(state); - state->m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; - state->m_lcd.line_irq = 0; + gb_increment_scanline(this); + m_lcd.triggering_line_irq = ( ( CMPLINE == CURLINE ) && ( LCDSTAT & 0x40 ) ) ? 1 : 0; + m_lcd.line_irq = 0; LCDSTAT &= 0xFB; - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_1); break; case GB_LCD_STATE_LY00_M1_1: - if ( ! state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + if ( ! m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M1_2); break; case GB_LCD_STATE_LY00_M1_2: /* Rest of line #0 during VBlank */ - if ( state->m_lcd.delayed_line_irq && state->m_lcd.triggering_line_irq ) + if ( m_lcd.delayed_line_irq && m_lcd.triggering_line_irq ) { - state->m_lcd.line_irq = state->m_lcd.triggering_line_irq; - machine.device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); + m_lcd.line_irq = m_lcd.triggering_line_irq; + machine().device("maincpu")->execute().set_input_line(LCD_INT, ASSERT_LINE ); } if ( CURLINE == CMPLINE ) { @@ -1925,23 +1925,23 @@ static TIMER_CALLBACK(gbc_lcd_timer_proc) { LCDSTAT &= ~0x04; } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(444), GB_LCD_STATE_LY00_M0); break; case GB_LCD_STATE_LY00_M0: /* The STAT register seems to go to 0 for about 4 cycles */ /* Set Mode 0 lcdstat */ - state->m_lcd.mode = 0; - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); + m_lcd.mode = 0; + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(4), GB_LCD_STATE_LY00_M2); break; } } else { - gb_increment_scanline(state); - if ( state->m_lcd.current_line < 144 ) + gb_increment_scanline(this); + if ( m_lcd.current_line < 144 ) { - (*state->update_scanline)( machine ); + (*update_scanline)( machine() ); } - state->m_lcd.lcd_timer->adjust(machine.device("maincpu")->cycles_to_attotime(456)); + m_lcd.lcd_timer->adjust(machine().device("maincpu")->cycles_to_attotime(456)); } } diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c index 67d860e7890..0a85303f8b6 100644 --- a/src/mess/video/mac.c +++ b/src/mess/video/mac.c @@ -651,30 +651,28 @@ static void dafb_recalc_ints(mac_state *mac) } } -static TIMER_CALLBACK(dafb_vbl_tick) +TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick) { - mac_state *mac = machine.driver_data(); - mac->m_dafb_int_status |= 1; - dafb_recalc_ints(mac); + m_dafb_int_status |= 1; + dafb_recalc_ints(this); - mac->m_vbl_timer->adjust(mac->m_screen->time_until_pos(480, 0), 0); + m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); } -static TIMER_CALLBACK(dafb_cursor_tick) +TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick) { - mac_state *mac = machine.driver_data(); - mac->m_dafb_int_status |= 4; - dafb_recalc_ints(mac); + m_dafb_int_status |= 4; + dafb_recalc_ints(this); - mac->m_cursor_timer->adjust(mac->m_screen->time_until_pos(mac->m_cursor_line, 0), 0); + m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); } VIDEO_START_MEMBER(mac_state,macdafb) { - m_vbl_timer = machine().scheduler().timer_alloc(FUNC(dafb_vbl_tick)); - m_cursor_timer = machine().scheduler().timer_alloc(FUNC(dafb_cursor_tick)); + m_vbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_vbl_tick),this)); + m_cursor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::dafb_cursor_tick),this)); m_vbl_timer->adjust(attotime::never); m_cursor_timer->adjust(attotime::never); diff --git a/src/mess/video/odyssey2.c b/src/mess/video/odyssey2.c index 2c54b026c26..3d68076b62c 100644 --- a/src/mess/video/odyssey2.c +++ b/src/mess/video/odyssey2.c @@ -249,60 +249,59 @@ READ8_MEMBER(odyssey2_state::odyssey2_t1_r) return 0; } -static TIMER_CALLBACK( i824x_scanline_callback ) +TIMER_CALLBACK_MEMBER(odyssey2_state::i824x_scanline_callback) { - odyssey2_state *state = machine.driver_data(); UINT8 collision_map[160]; - int vpos = machine.primary_screen->vpos(); + int vpos = machine().primary_screen->vpos(); - if ( vpos < state->m_start_vpos ) + if ( vpos < m_start_vpos ) return; - if ( vpos == state->m_start_vpos ) + if ( vpos == m_start_vpos ) { - state->m_control_status &= ~0x08; + m_control_status &= ~0x08; } - if ( vpos < state->m_start_vblank ) + if ( vpos < m_start_vblank ) { rectangle rect; //static const int sprite_width[4] = { 8, 8, 8, 8 }; int i; - state->m_control_status &= ~ 0x01; + m_control_status &= ~ 0x01; /* Draw a line */ rect.set(I824X_START_ACTIVE_SCAN, I824X_END_ACTIVE_SCAN - 1, vpos, vpos); - state->m_tmp_bitmap.fill(( (state->m_o2_vdc.s.color >> 3) & 0x7 ) | ( ( state->m_lum << 3 ) ^ 0x08 ), rect ); + m_tmp_bitmap.fill(( (m_o2_vdc.s.color >> 3) & 0x7 ) | ( ( m_lum << 3 ) ^ 0x08 ), rect ); /* Clear collision map */ memset( collision_map, 0, sizeof( collision_map ) ); /* Display grid if enabled */ - if ( state->m_o2_vdc.s.control & 0x08 ) + if ( m_o2_vdc.s.control & 0x08 ) { - UINT16 color = ( state->m_o2_vdc.s.color & 7 ) | ( ( state->m_o2_vdc.s.color >> 3 ) & 0x08 ) | ( ( state->m_lum << 3 ) ^ 0x08 ); + UINT16 color = ( m_o2_vdc.s.color & 7 ) | ( ( m_o2_vdc.s.color >> 3 ) & 0x08 ) | ( ( m_lum << 3 ) ^ 0x08 ); int x_grid_offset = 8; int y_grid_offset = 24; int width = 16; int height = 24; - int w = ( state->m_o2_vdc.s.control & 0x80 ) ? width : 2; + int w = ( m_o2_vdc.s.control & 0x80 ) ? width : 2; int j, k, y; /* Draw horizontal part of grid */ for ( j = 1, y = 0; y < 9; y++, j <<= 1 ) { - if ( y_grid_offset + y * height <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y_grid_offset + y * height + 3 ) + if ( y_grid_offset + y * height <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y_grid_offset + y * height + 3 ) { for ( i = 0; i < 9; i++ ) { - if ( ( state->m_o2_vdc.s.hgrid[0][i] & j ) || ( state->m_o2_vdc.s.hgrid[1][i] & ( j >> 8 ) ) ) + if ( ( m_o2_vdc.s.hgrid[0][i] & j ) || ( m_o2_vdc.s.hgrid[1][i] & ( j >> 8 ) ) ) { for ( k = 0; k < width + 2; k++ ) { int px = x_grid_offset + i * width + k; collision_map[ px ] |= COLLISION_HORIZ_GRID_DOTS; - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + px ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + px ) = color; } } } @@ -312,28 +311,28 @@ static TIMER_CALLBACK( i824x_scanline_callback ) /* Draw vertical part of grid */ for( j = 1, y = 0; y < 8; y++, j <<= 1 ) { - if ( y_grid_offset + y * height <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y_grid_offset + ( y + 1 ) * height ) + if ( y_grid_offset + y * height <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y_grid_offset + ( y + 1 ) * height ) { for ( i = 0; i < 10; i++ ) { - if ( state->m_o2_vdc.s.vgrid[i] & j ) + if ( m_o2_vdc.s.vgrid[i] & j ) { for ( k = 0; k < w; k++ ) { int px = x_grid_offset + i * width + k; /* Check if we collide with an already drawn source object */ - if ( collision_map[ px ] & state->m_o2_vdc.s.collision ) + if ( collision_map[ px ] & m_o2_vdc.s.collision ) { - state->m_collision_status |= COLLISION_VERTICAL_GRID; + m_collision_status |= COLLISION_VERTICAL_GRID; } /* Check if an already drawn object would collide with us */ - if ( COLLISION_VERTICAL_GRID & state->m_o2_vdc.s.collision && collision_map[ px ] ) + if ( COLLISION_VERTICAL_GRID & m_o2_vdc.s.collision && collision_map[ px ] ) { - state->m_collision_status |= collision_map[ px ]; + m_collision_status |= collision_map[ px ]; } collision_map[ px ] |= COLLISION_VERTICAL_GRID; - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + px ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + px ) = color; } } } @@ -342,20 +341,20 @@ static TIMER_CALLBACK( i824x_scanline_callback ) } /* Display objects if enabled */ - if ( state->m_o2_vdc.s.control & 0x20 ) + if ( m_o2_vdc.s.control & 0x20 ) { /* Regular foreground objects */ - for ( i = 0; i < ARRAY_LENGTH( state->m_o2_vdc.s.foreground ); i++ ) + for ( i = 0; i < ARRAY_LENGTH( m_o2_vdc.s.foreground ); i++ ) { - int y = state->m_o2_vdc.s.foreground[i].y; - int height = 8 - ( ( ( y >> 1 ) + state->m_o2_vdc.s.foreground[i].ptr ) & 7 ); + int y = m_o2_vdc.s.foreground[i].y; + int height = 8 - ( ( ( y >> 1 ) + m_o2_vdc.s.foreground[i].ptr ) & 7 ); - if ( y <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y + height * 2 ) + if ( y <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y + height * 2 ) { - UINT16 color = 16 + ( ( state->m_o2_vdc.s.foreground[i].color & 0x0E ) >> 1 ); - int offset = ( state->m_o2_vdc.s.foreground[i].ptr | ( ( state->m_o2_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - state->m_start_vpos - y ) >> 1 ); + UINT16 color = 16 + ( ( m_o2_vdc.s.foreground[i].color & 0x0E ) >> 1 ); + int offset = ( m_o2_vdc.s.foreground[i].ptr | ( ( m_o2_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - m_start_vpos - y ) >> 1 ); UINT8 chr = ((char*)o2_shape)[ offset & 0x1FF ]; - int x = state->m_o2_vdc.s.foreground[i].x; + int x = m_o2_vdc.s.foreground[i].x; UINT8 m; for ( m = 0x80; m > 0; m >>= 1, x++ ) @@ -365,17 +364,17 @@ static TIMER_CALLBACK( i824x_scanline_callback ) if ( x >= 0 && x < 160 ) { /* Check if we collide with an already drawn source object */ - if ( collision_map[ x ] & state->m_o2_vdc.s.collision ) + if ( collision_map[ x ] & m_o2_vdc.s.collision ) { - state->m_collision_status |= COLLISION_CHARACTERS; + m_collision_status |= COLLISION_CHARACTERS; } /* Check if an already drawn object would collide with us */ - if ( COLLISION_CHARACTERS & state->m_o2_vdc.s.collision && collision_map[ x ] ) + if ( COLLISION_CHARACTERS & m_o2_vdc.s.collision && collision_map[ x ] ) { - state->m_collision_status |= collision_map[ x ]; + m_collision_status |= collision_map[ x ]; } collision_map[ x ] |= COLLISION_CHARACTERS; - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; } } } @@ -383,30 +382,30 @@ static TIMER_CALLBACK( i824x_scanline_callback ) } /* Quad objects */ - for ( i = 0; i < ARRAY_LENGTH( state->m_o2_vdc.s.quad ); i++ ) + for ( i = 0; i < ARRAY_LENGTH( m_o2_vdc.s.quad ); i++ ) { - int y = state->m_o2_vdc.s.quad[i].single[0].y; + int y = m_o2_vdc.s.quad[i].single[0].y; int height = 8; - if ( y <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y + height * 2 ) + if ( y <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y + height * 2 ) { - int x = state->m_o2_vdc.s.quad[i].single[0].x; + int x = m_o2_vdc.s.quad[i].single[0].x; int j; // Charaecter height is always determined by the height of the 4th character - int char_height = 8 - ( ( ( y >> 1 ) + state->m_o2_vdc.s.quad[i].single[3].ptr ) & 7 ); + int char_height = 8 - ( ( ( y >> 1 ) + m_o2_vdc.s.quad[i].single[3].ptr ) & 7 ); - for ( j = 0; j < ARRAY_LENGTH( state->m_o2_vdc.s.quad[0].single ); j++, x += 8 ) + for ( j = 0; j < ARRAY_LENGTH( m_o2_vdc.s.quad[0].single ); j++, x += 8 ) { - if ( y <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y + char_height * 2 ) + if ( y <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y + char_height * 2 ) { - UINT16 color = 16 + ( ( state->m_o2_vdc.s.quad[i].single[j].color & 0x0E ) >> 1 ); + UINT16 color = 16 + ( ( m_o2_vdc.s.quad[i].single[j].color & 0x0E ) >> 1 ); - int offset = ( state->m_o2_vdc.s.quad[i].single[j].ptr | ( ( state->m_o2_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - state->m_start_vpos - y ) >> 1 ); + int offset = ( m_o2_vdc.s.quad[i].single[j].ptr | ( ( m_o2_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( vpos - m_start_vpos - y ) >> 1 ); UINT8 chr = ((char*)o2_shape)[ offset & 0x1FF ]; @@ -418,17 +417,17 @@ static TIMER_CALLBACK( i824x_scanline_callback ) if ( x >= 0 && x < 160 ) { /* Check if we collide with an already drawn source object */ - if ( collision_map[ x ] & state->m_o2_vdc.s.collision ) + if ( collision_map[ x ] & m_o2_vdc.s.collision ) { - state->m_collision_status |= COLLISION_CHARACTERS; + m_collision_status |= COLLISION_CHARACTERS; } /* Check if an already drawn object would collide with us */ - if ( COLLISION_CHARACTERS & state->m_o2_vdc.s.collision && collision_map[ x ] ) + if ( COLLISION_CHARACTERS & m_o2_vdc.s.collision && collision_map[ x ] ) { - state->m_collision_status |= collision_map[ x ]; + m_collision_status |= collision_map[ x ]; } collision_map[ x ] |= COLLISION_CHARACTERS; - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; } } } @@ -442,19 +441,19 @@ static TIMER_CALLBACK( i824x_scanline_callback ) } /* Sprites */ - for ( i = 0; i < ARRAY_LENGTH( state->m_o2_vdc.s.sprites ); i++ ) + for ( i = 0; i < ARRAY_LENGTH( m_o2_vdc.s.sprites ); i++ ) { - int y = state->m_o2_vdc.s.sprites[i].y; + int y = m_o2_vdc.s.sprites[i].y; int height = 8; - if ( state->m_o2_vdc.s.sprites[i].color & 4 ) + if ( m_o2_vdc.s.sprites[i].color & 4 ) { /* Zoomed sprite */ //sprite_width[i] = 16; - if ( y <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y + height * 4 ) + if ( y <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y + height * 4 ) { - UINT16 color = 16 + ( ( state->m_o2_vdc.s.sprites[i].color >> 3 ) & 0x07 ); - UINT8 chr = state->m_o2_vdc.s.shape[i][ ( ( vpos - state->m_start_vpos - y ) >> 2 ) ]; - int x = state->m_o2_vdc.s.sprites[i].x; + UINT16 color = 16 + ( ( m_o2_vdc.s.sprites[i].color >> 3 ) & 0x07 ); + UINT8 chr = m_o2_vdc.s.shape[i][ ( ( vpos - m_start_vpos - y ) >> 2 ) ]; + int x = m_o2_vdc.s.sprites[i].x; UINT8 m; for ( m = 0x01; m > 0; m <<= 1, x += 2 ) @@ -464,32 +463,32 @@ static TIMER_CALLBACK( i824x_scanline_callback ) if ( x >= 0 && x < 160 ) { /* Check if we collide with an already drawn source object */ - if ( collision_map[ x ] & state->m_o2_vdc.s.collision ) + if ( collision_map[ x ] & m_o2_vdc.s.collision ) { - state->m_collision_status |= ( 1 << i ); + m_collision_status |= ( 1 << i ); } /* Check if an already drawn object would collide with us */ - if ( ( 1 << i ) & state->m_o2_vdc.s.collision && collision_map[ x ] ) + if ( ( 1 << i ) & m_o2_vdc.s.collision && collision_map[ x ] ) { - state->m_collision_status |= collision_map[ x ]; + m_collision_status |= collision_map[ x ]; } collision_map[ x ] |= ( 1 << i ); - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; } if ( x >= -1 && x < 159 ) { /* Check if we collide with an already drawn source object */ - if ( collision_map[ x ] & state->m_o2_vdc.s.collision ) + if ( collision_map[ x ] & m_o2_vdc.s.collision ) { - state->m_collision_status |= ( 1 << i ); + m_collision_status |= ( 1 << i ); } /* Check if an already drawn object would collide with us */ - if ( ( 1 << i ) & state->m_o2_vdc.s.collision && collision_map[ x ] ) + if ( ( 1 << i ) & m_o2_vdc.s.collision && collision_map[ x ] ) { - state->m_collision_status |= collision_map[ x ]; + m_collision_status |= collision_map[ x ]; } collision_map[ x ] |= ( 1 << i ); - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x + 1 ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x + 1 ) = color; } } } @@ -498,11 +497,11 @@ static TIMER_CALLBACK( i824x_scanline_callback ) else { /* Regular sprite */ - if ( y <= ( vpos - state->m_start_vpos ) && ( vpos - state->m_start_vpos ) < y + height * 2 ) + if ( y <= ( vpos - m_start_vpos ) && ( vpos - m_start_vpos ) < y + height * 2 ) { - UINT16 color = 16 + ( ( state->m_o2_vdc.s.sprites[i].color >> 3 ) & 0x07 ); - UINT8 chr = state->m_o2_vdc.s.shape[i][ ( ( vpos - state->m_start_vpos - y ) >> 1 ) ]; - int x = state->m_o2_vdc.s.sprites[i].x; + UINT16 color = 16 + ( ( m_o2_vdc.s.sprites[i].color >> 3 ) & 0x07 ); + UINT8 chr = m_o2_vdc.s.shape[i][ ( ( vpos - m_start_vpos - y ) >> 1 ) ]; + int x = m_o2_vdc.s.sprites[i].x; UINT8 m; for ( m = 0x01; m > 0; m <<= 1, x++ ) @@ -512,17 +511,17 @@ static TIMER_CALLBACK( i824x_scanline_callback ) if ( x >= 0 && x < 160 ) { /* Check if we collide with an already drawn source object */ - if ( collision_map[ x ] & state->m_o2_vdc.s.collision ) + if ( collision_map[ x ] & m_o2_vdc.s.collision ) { - state->m_collision_status |= ( 1 << i ); + m_collision_status |= ( 1 << i ); } /* Check if an already drawn object would collide with us */ - if ( ( 1 << i ) & state->m_o2_vdc.s.collision && collision_map[ x ] ) + if ( ( 1 << i ) & m_o2_vdc.s.collision && collision_map[ x ] ) { - state->m_collision_status |= collision_map[ x ]; + m_collision_status |= collision_map[ x ]; } collision_map[ x ] |= ( 1 << i ); - state->m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; + m_tmp_bitmap.pix16(vpos, I824X_START_ACTIVE_SCAN + x ) = color; } } } @@ -533,28 +532,27 @@ static TIMER_CALLBACK( i824x_scanline_callback ) } /* Check for start of VBlank */ - if ( vpos == state->m_start_vblank ) + if ( vpos == m_start_vblank ) { - state->m_control_status |= 0x08; - if ( ! state->m_iff ) + m_control_status |= 0x08; + if ( ! m_iff ) { - machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); - state->m_iff = 1; + machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); + m_iff = 1; } } } -static TIMER_CALLBACK( i824x_hblank_callback ) +TIMER_CALLBACK_MEMBER(odyssey2_state::i824x_hblank_callback) { - odyssey2_state *state = machine.driver_data(); - int vpos = machine.primary_screen->vpos(); + int vpos = machine().primary_screen->vpos(); - if ( vpos < state->m_start_vpos - 1 ) + if ( vpos < m_start_vpos - 1 ) return; - if ( vpos < state->m_start_vblank - 1 ) + if ( vpos < m_start_vblank - 1 ) { - state->m_control_status |= 0x01; + m_control_status |= 0x01; } } @@ -590,10 +588,10 @@ void odyssey2_state::video_start() screen->register_screen_bitmap(m_tmp_bitmap); - m_i824x_line_timer = machine().scheduler().timer_alloc(FUNC(i824x_scanline_callback)); + m_i824x_line_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(odyssey2_state::i824x_scanline_callback),this)); m_i824x_line_timer->adjust( machine().primary_screen->time_until_pos(1, I824X_START_ACTIVE_SCAN ), 0, machine().primary_screen->scan_period() ); - m_i824x_hblank_timer = machine().scheduler().timer_alloc(FUNC(i824x_hblank_callback)); + m_i824x_hblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(odyssey2_state::i824x_hblank_callback),this)); m_i824x_hblank_timer->adjust( machine().primary_screen->time_until_pos(1, I824X_END_ACTIVE_SCAN + 18 ), 0, machine().primary_screen->scan_period() ); } diff --git a/src/mess/video/oric.c b/src/mess/video/oric.c index 4211b3e4e79..a7a4f479173 100644 --- a/src/mess/video/oric.c +++ b/src/mess/video/oric.c @@ -12,11 +12,10 @@ #include "includes/oric.h" -static TIMER_CALLBACK(oric_vh_timer_callback) +TIMER_CALLBACK_MEMBER(oric_state::oric_vh_timer_callback) { - oric_state *state = machine.driver_data(); /* update flash count */ - state->m_vh_state.flash_count++; + m_vh_state.flash_count++; } static void oric_vh_update_flash(oric_state *state) @@ -299,7 +298,7 @@ void oric_state::video_start() m_vh_state.char_base = 0; /* initialise flash timer */ m_vh_state.flash_count = 0; - machine().scheduler().timer_pulse(attotime::from_hz(50), FUNC(oric_vh_timer_callback)); + machine().scheduler().timer_pulse(attotime::from_hz(50), timer_expired_delegate(FUNC(oric_state::oric_vh_timer_callback),this)); /* mode */ oric_vh_update_attribute(machine(),(1<<3)|(1<<4)); } diff --git a/src/mess/video/samcoupe.c b/src/mess/video/samcoupe.c index 4f8c05e25e9..091a5c44b42 100644 --- a/src/mess/video/samcoupe.c +++ b/src/mess/video/samcoupe.c @@ -125,11 +125,10 @@ static void draw_mode1_line(running_machine &machine, int y, int hpos) draw_mode12_block(state, state->m_bitmap, y, hpos, mask); } -TIMER_CALLBACK( sam_video_update_callback ) +TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback) { - samcoupe_state *state = machine.driver_data(); - int vpos = machine.primary_screen->vpos(); - int hpos = machine.primary_screen->hpos(); + int vpos = machine().primary_screen->vpos(); + int hpos = machine().primary_screen->hpos(); int next_vpos = vpos; int next_hpos = hpos + SAM_BLOCK*2; @@ -142,35 +141,35 @@ TIMER_CALLBACK( sam_video_update_callback ) } /* display disabled? (only in mode 3 or 4) */ - if (BIT(state->m_vmpr, 6) && BIT(state->m_border, 7)) + if (BIT(m_vmpr, 6) && BIT(m_border, 7)) { - state->m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, 0); + m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, 0); } else { /* border area? */ if (vpos < SAM_BORDER_TOP || vpos >= SAM_BORDER_TOP + SAM_SCREEN_HEIGHT || hpos < SAM_BORDER_LEFT || hpos >= SAM_BORDER_LEFT + SAM_SCREEN_WIDTH) { - state->m_attribute = 0xff; - state->m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, state->m_clut[BORDER_COLOR(state->m_border)]); + m_attribute = 0xff; + m_bitmap.plot_box(hpos, vpos, SAM_BLOCK*2, 1, m_clut[BORDER_COLOR(m_border)]); } else { /* main screen area */ - switch ((state->m_vmpr & 0x60) >> 5) + switch ((m_vmpr & 0x60) >> 5) { - case 0: draw_mode1_line(machine, vpos, hpos); break; - case 1: draw_mode2_line(machine, vpos, hpos); break; - case 2: draw_mode3_line(machine, vpos, hpos); break; - case 3: draw_mode4_line(machine, vpos, hpos); break; + case 0: draw_mode1_line(machine(), vpos, hpos); break; + case 1: draw_mode2_line(machine(), vpos, hpos); break; + case 2: draw_mode3_line(machine(), vpos, hpos); break; + case 3: draw_mode4_line(machine(), vpos, hpos); break; } } } /* do we need to trigger the scanline interrupt (interrupt happens at the start of the right border before the specified line)? */ - if (state->m_line_int < SAM_SCREEN_HEIGHT && hpos == SAM_BORDER_LEFT + SAM_SCREEN_WIDTH && vpos == (state->m_line_int + SAM_BORDER_TOP - 1)) - samcoupe_irq(machine.firstcpu, SAM_LINE_INT); + if (m_line_int < SAM_SCREEN_HEIGHT && hpos == SAM_BORDER_LEFT + SAM_SCREEN_WIDTH && vpos == (m_line_int + SAM_BORDER_TOP - 1)) + samcoupe_irq(machine().firstcpu, SAM_LINE_INT); /* schedule next update */ - state->m_video_update_timer->adjust(machine.primary_screen->time_until_pos(next_vpos, next_hpos)); + m_video_update_timer->adjust(machine().primary_screen->time_until_pos(next_vpos, next_hpos)); } diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c index 0ec6cca5da6..56b285c0eed 100644 --- a/src/mess/video/x68k.c +++ b/src/mess/video/x68k.c @@ -108,11 +108,10 @@ static void x68k_crtc_text_copy(x68k_state *state, int src, int dest) } -static TIMER_CALLBACK(x68k_crtc_operation_end) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_operation_end) { - x68k_state *state = machine.driver_data(); int bit = param; - state->m_crtc.operation &= ~bit; + m_crtc.operation &= ~bit; } static void x68k_crtc_refresh_mode(running_machine &machine) @@ -174,67 +173,66 @@ static void x68k_crtc_refresh_mode(running_machine &machine) machine.primary_screen->configure(scr.max_x,scr.max_y,visiblescr,HZ_TO_ATTOSECONDS(55.45)); } -TIMER_CALLBACK(x68k_hsync) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_hsync) { - x68k_state *state = machine.driver_data(); int hstate = param; attotime hsync_time; - state->m_crtc.hblank = hstate; - state->m_mfpdev->i7_w(!state->m_crtc.hblank); - if(state->m_crtc.vmultiple == 2) // 256-line (doublescan) + m_crtc.hblank = hstate; + m_mfpdev->i7_w(!m_crtc.hblank); + if(m_crtc.vmultiple == 2) // 256-line (doublescan) { if(hstate == 1) { - if(state->m_oddscanline == 1) + if(m_oddscanline == 1) { - int scan = machine.primary_screen->vpos(); - if(scan > state->m_crtc.vend) - scan = state->m_crtc.vbegin; - hsync_time = machine.primary_screen->time_until_pos(scan,(state->m_crtc.htotal + state->m_crtc.hend) / 2); - state->m_scanline_timer->adjust(hsync_time); + int scan = machine().primary_screen->vpos(); + if(scan > m_crtc.vend) + scan = m_crtc.vbegin; + hsync_time = machine().primary_screen->time_until_pos(scan,(m_crtc.htotal + m_crtc.hend) / 2); + m_scanline_timer->adjust(hsync_time); if(scan != 0) { - if((machine.root_device().ioport("options")->read() & 0x04)) + if((machine().root_device().ioport("options")->read() & 0x04)) { - machine.primary_screen->update_partial(scan); + machine().primary_screen->update_partial(scan); } } } else { - int scan = machine.primary_screen->vpos(); - if(scan > state->m_crtc.vend) - scan = state->m_crtc.vbegin; - hsync_time = machine.primary_screen->time_until_pos(scan,state->m_crtc.hend / 2); - state->m_scanline_timer->adjust(hsync_time); + int scan = machine().primary_screen->vpos(); + if(scan > m_crtc.vend) + scan = m_crtc.vbegin; + hsync_time = machine().primary_screen->time_until_pos(scan,m_crtc.hend / 2); + m_scanline_timer->adjust(hsync_time); if(scan != 0) { - if((machine.root_device().ioport("options")->read() & 0x04)) + if((machine().root_device().ioport("options")->read() & 0x04)) { - machine.primary_screen->update_partial(scan); + machine().primary_screen->update_partial(scan); } } } } if(hstate == 0) { - if(state->m_oddscanline == 1) + if(m_oddscanline == 1) { - int scan = machine.primary_screen->vpos(); - if(scan > state->m_crtc.vend) - scan = state->m_crtc.vbegin; + int scan = machine().primary_screen->vpos(); + if(scan > m_crtc.vend) + scan = m_crtc.vbegin; else scan++; - hsync_time = machine.primary_screen->time_until_pos(scan,state->m_crtc.hbegin / 2); - state->m_scanline_timer->adjust(hsync_time, 1); - state->m_oddscanline = 0; + hsync_time = machine().primary_screen->time_until_pos(scan,m_crtc.hbegin / 2); + m_scanline_timer->adjust(hsync_time, 1); + m_oddscanline = 0; } else { - hsync_time = machine.primary_screen->time_until_pos(machine.primary_screen->vpos(),(state->m_crtc.htotal + state->m_crtc.hbegin) / 2); - state->m_scanline_timer->adjust(hsync_time, 1); - state->m_oddscanline = 1; + hsync_time = machine().primary_screen->time_until_pos(machine().primary_screen->vpos(),(m_crtc.htotal + m_crtc.hbegin) / 2); + m_scanline_timer->adjust(hsync_time, 1); + m_oddscanline = 1; } } } @@ -242,88 +240,85 @@ TIMER_CALLBACK(x68k_hsync) { if(hstate == 1) { - int scan = machine.primary_screen->vpos(); - if(scan > state->m_crtc.vend) + int scan = machine().primary_screen->vpos(); + if(scan > m_crtc.vend) scan = 0; - hsync_time = machine.primary_screen->time_until_pos(scan,state->m_crtc.hend); - state->m_scanline_timer->adjust(hsync_time); + hsync_time = machine().primary_screen->time_until_pos(scan,m_crtc.hend); + m_scanline_timer->adjust(hsync_time); if(scan != 0) { - if((machine.root_device().ioport("options")->read() & 0x04)) + if((machine().root_device().ioport("options")->read() & 0x04)) { - machine.primary_screen->update_partial(scan); + machine().primary_screen->update_partial(scan); } } } if(hstate == 0) { - hsync_time = machine.primary_screen->time_until_pos(machine.primary_screen->vpos()+1,state->m_crtc.hbegin); - state->m_scanline_timer->adjust(hsync_time, 1); - // if(!(state->m_mfp.gpio & 0x40)) // if GPIP6 is active, clear it - // state->m_mfp.gpio |= 0x40; + hsync_time = machine().primary_screen->time_until_pos(machine().primary_screen->vpos()+1,m_crtc.hbegin); + m_scanline_timer->adjust(hsync_time, 1); + // if(!(m_mfp.gpio & 0x40)) // if GPIP6 is active, clear it + // m_mfp.gpio |= 0x40; } } } -static TIMER_CALLBACK(x68k_crtc_raster_end) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_end) { - x68k_state *state = machine.driver_data(); - state->m_mfp.gpio |= 0x40; - state->m_mfpdev->i6_w(1); + m_mfp.gpio |= 0x40; + m_mfpdev->i6_w(1); } -TIMER_CALLBACK(x68k_crtc_raster_irq) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_raster_irq) { - x68k_state *state = machine.driver_data(); int scan = param; attotime irq_time; attotime end_time; - if(scan <= state->m_crtc.vtotal) + if(scan <= m_crtc.vtotal) { - state->m_mfp.gpio &= ~0x40; // GPIP6 - state->m_mfpdev->i6_w(0); - machine.primary_screen->update_partial(scan); - irq_time = machine.primary_screen->time_until_pos(scan,state->m_crtc.hbegin); + m_mfp.gpio &= ~0x40; // GPIP6 + m_mfpdev->i6_w(0); + machine().primary_screen->update_partial(scan); + irq_time = machine().primary_screen->time_until_pos(scan,m_crtc.hbegin); // end of HBlank period clears GPIP6 also? - end_time = machine.primary_screen->time_until_pos(scan,state->m_crtc.hend); - state->m_raster_irq->adjust(irq_time, scan); - machine.scheduler().timer_set(end_time, FUNC(x68k_crtc_raster_end)); - logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,machine.primary_screen->vpos()); + end_time = machine().primary_screen->time_until_pos(scan,m_crtc.hend); + m_raster_irq->adjust(irq_time, scan); + machine().scheduler().timer_set(end_time, timer_expired_delegate(FUNC(x68k_state::x68k_crtc_raster_end),this)); + logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,machine().primary_screen->vpos()); } } -TIMER_CALLBACK(x68k_crtc_vblank_irq) +TIMER_CALLBACK_MEMBER(x68k_state::x68k_crtc_vblank_irq) { - x68k_state *state = machine.driver_data(); - device_t *x68k_mfp = machine.device(MC68901_TAG); + device_t *x68k_mfp = machine().device(MC68901_TAG); int val = param; attotime irq_time; int vblank_line; if(val == 1) // V-DISP on { - state->m_crtc.vblank = 1; - vblank_line = state->m_crtc.vbegin; - irq_time = machine.primary_screen->time_until_pos(vblank_line,2); - state->m_vblank_irq->adjust(irq_time); + m_crtc.vblank = 1; + vblank_line = m_crtc.vbegin; + irq_time = machine().primary_screen->time_until_pos(vblank_line,2); + m_vblank_irq->adjust(irq_time); logerror("CRTC: VBlank on\n"); } if(val == 0) // V-DISP off { - state->m_crtc.vblank = 0; - vblank_line = state->m_crtc.vend; - if(vblank_line > state->m_crtc.vtotal) - vblank_line = state->m_crtc.vtotal; - irq_time = machine.primary_screen->time_until_pos(vblank_line,2); - state->m_vblank_irq->adjust(irq_time, 1); + m_crtc.vblank = 0; + vblank_line = m_crtc.vend; + if(vblank_line > m_crtc.vtotal) + vblank_line = m_crtc.vtotal; + irq_time = machine().primary_screen->time_until_pos(vblank_line,2); + m_vblank_irq->adjust(irq_time, 1); logerror("CRTC: VBlank off\n"); } if (x68k_mfp != NULL) { - state->m_mfpdev->tai_w(!state->m_crtc.vblank); - state->m_mfpdev->i4_w(!state->m_crtc.vblank); + m_mfpdev->tai_w(!m_crtc.vblank); + m_mfpdev->i4_w(!m_crtc.vblank); } } @@ -449,7 +444,7 @@ WRITE16_HANDLER( x68k_crtc_w ) if(data & 0x08) // text screen raster copy { x68k_crtc_text_copy(state, (state->m_crtc.reg[22] & 0xff00) >> 8,(state->m_crtc.reg[22] & 0x00ff)); - space.machine().scheduler().timer_set(attotime::from_msec(1), FUNC(x68k_crtc_operation_end), 0x02); // time taken to do operation is a complete guess. + space.machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(x68k_state::x68k_crtc_operation_end),state), 0x02); // time taken to do operation is a complete guess. } if(data & 0x02) // high-speed graphic screen clear { @@ -457,7 +452,7 @@ WRITE16_HANDLER( x68k_crtc_w ) memset(state->m_gvram32,0,0x40000); else memset(state->m_gvram16,0,0x40000); - space.machine().scheduler().timer_set(attotime::from_msec(10), FUNC(x68k_crtc_operation_end), 0x02); // time taken to do operation is a complete guess. + space.machine().scheduler().timer_set(attotime::from_msec(10), timer_expired_delegate(FUNC(x68k_state::x68k_crtc_operation_end),state), 0x02); // time taken to do operation is a complete guess. } break; } diff --git a/src/mess/video/zx.c b/src/mess/video/zx.c index 2547e6f6ed3..77e95489de2 100644 --- a/src/mess/video/zx.c +++ b/src/mess/video/zx.c @@ -84,42 +84,40 @@ void zx_state::zx_ula_bkgnd(UINT8 color) * 32..223 192 visible lines * 224..233 vblank */ -static TIMER_CALLBACK(zx_ula_nmi) +TIMER_CALLBACK_MEMBER(zx_state::zx_ula_nmi) { - zx_state *state = machine.driver_data(); /* * An NMI is issued on the ZX81 every 64us for the blanked * scanlines at the top and bottom of the display. */ - screen_device *screen = machine.first_screen(); + screen_device *screen = machine().first_screen(); int height = screen->height(); const rectangle& r1 = screen->visible_area(); rectangle r; - bitmap_ind16 &bitmap = state->m_bitmap; - r.set(r1.min_x, r1.max_x, state->m_ula_scanline_count, state->m_ula_scanline_count); + bitmap_ind16 &bitmap = m_bitmap; + r.set(r1.min_x, r1.max_x, m_ula_scanline_count, m_ula_scanline_count); bitmap.fill(1, r); -// logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) machine.device("maincpu")->state().state_int(Z80_R), (unsigned) machine.device("maincpu")->state().state_int(Z80_PC)); - machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); - if (++state->m_ula_scanline_count == height) - state->m_ula_scanline_count = 0; +// logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine().primary_screen->vpos(), ula_scancode_count, (unsigned) machine().device("maincpu")->state().state_int(Z80_R), (unsigned) machine().device("maincpu")->state().state_int(Z80_PC)); + machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + if (++m_ula_scanline_count == height) + m_ula_scanline_count = 0; } -static TIMER_CALLBACK(zx_ula_irq) +TIMER_CALLBACK_MEMBER(zx_state::zx_ula_irq) { - zx_state *state = machine.driver_data(); /* * An IRQ is issued on the ZX80/81 whenever the R registers * bit 6 goes low. In MESS this IRQ timed from the first read * from the copy of the DFILE in the upper 32K in zx_ula_r(). */ - if (state->m_ula_irq_active) + if (m_ula_irq_active) { -// logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) machine.device("maincpu")->state().state_int(Z80_R), (unsigned) machine.device("maincpu")->state().state_int(Z80_PC)); +// logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", machine().primary_screen->vpos(), ula_scancode_count, (unsigned) machine().device("maincpu")->state().state_int(Z80_R), (unsigned) machine().device("maincpu")->state().state_int(Z80_PC)); - state->m_ula_irq_active = 0; - machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_ula_irq_active = 0; + machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); } } @@ -163,7 +161,7 @@ void zx_ula_r(running_machine &machine, int offs, const char *region, const UINT for (y = state->m_charline_ptr; y < ARRAY_LENGTH(state->m_charline); y++) state->m_charline[y] = 0; - machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(((32 - state->m_charline_ptr) << 2)), FUNC(zx_ula_irq)); + machine.scheduler().timer_set(machine.device("maincpu")->cycles_to_attotime(((32 - state->m_charline_ptr) << 2)), timer_expired_delegate(FUNC(zx_state::zx_ula_irq),state)); state->m_ula_irq_active++; scanline = &bitmap.pix16(state->m_ula_scanline_count); @@ -192,7 +190,7 @@ void zx_ula_r(running_machine &machine, int offs, const char *region, const UINT void zx_state::video_start() { - m_ula_nmi = machine().scheduler().timer_alloc(FUNC(zx_ula_nmi)); + m_ula_nmi = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zx_state::zx_ula_nmi),this)); m_ula_irq_active = 0; machine().primary_screen->register_screen_bitmap(m_bitmap); }