void psxrcnt_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { int n_counter = id; psx_root *root = &root_counter[ n_counter ]; verboselog( machine(), 2, "root_finished( %d ) %04x\n", n_counter, root_current( n_counter ) ); //if( ( root->n_mode & PSX_RC_COUNTTARGET ) != 0 ) { /* TODO: wrap should be handled differently as PSX_RC_COUNTTARGET & PSX_RC_IRQTARGET don't have to be the same. */ root->n_count = 0; root->n_start = gettotalcycles(); } if( ( root->n_mode & PSX_RC_REPEAT ) != 0 ) { root_timer_adjust( n_counter ); } if( ( root->n_mode & PSX_RC_IRQOVERFLOW ) != 0 || ( root->n_mode & PSX_RC_IRQTARGET ) != 0 ) { switch( n_counter ) { case 0: m_irq0_handler(1); break; case 1: m_irq1_handler(1); break; case 2: m_irq2_handler(1); break; } } }
void psxrcnt_device::device_post_load() { int n; for( n = 0; n < 3; n++ ) { root_timer_adjust( n ); } }
void psxrcnt_device::root_finished( void *ptr, int param ) { int n_counter = param; psx_root *root = &root_counter[ n_counter ]; verboselog( machine(), 2, "root_finished( %d ) %04x\n", n_counter, root_current( n_counter ) ); //if( ( root->n_mode & PSX_RC_COUNTTARGET ) != 0 ) { /* TODO: wrap should be handled differently as PSX_RC_COUNTTARGET & PSX_RC_IRQTARGET don't have to be the same. */ root->n_count = 0; root->n_start = gettotalcycles(); } if( ( root->n_mode & PSX_RC_REPEAT ) != 0 ) { root_timer_adjust( n_counter ); } if( ( root->n_mode & PSX_RC_IRQOVERFLOW ) != 0 || ( root->n_mode & PSX_RC_IRQTARGET ) != 0 ) { psx_irq_set( machine(), PSX_IRQ_ROOTCOUNTER0 << n_counter ); } }