void upd1990a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_CLOCK: advance_seconds(); break; case TIMER_TP: m_tp = !m_tp; if (LOG) logerror("uPD1990A '%s' TP %u\n", tag(), m_tp); m_out_tp_func(m_tp); break; case TIMER_DATA_OUT: m_data_out = !m_data_out; if (LOG) logerror("uPD1990A '%s' DATA OUT TICK %u\n", tag(), m_data_out); m_out_data_func(m_data_out); break; } }
void upd1990a_rtc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_CLOCK: advance_seconds(); break; case TIMER_TP: m_tp = !m_tp; if (LOG) logerror("uPD1990A '%s' TP %u\n", tag(), m_tp); m_out_tp_func(m_tp); break; case TIMER_DATA_OUT: m_data_out = !m_data_out; if (LOG) logerror("uPD1990A '%s' DATA OUT TICK %u\n", tag(), m_data_out); m_out_data_func(m_data_out); break; case TIMER_TEST_MODE: if (m_oe) { /* TODO: completely untested */ /* time counter is advanced at 1024 Hz from "Second" counter input */ int i; m_data_out = (m_time_counter[4] == 0); for(i=0;i<5;i++) { m_time_counter[i]++; if(m_time_counter[i] != 0) return; } } else // parallel { int i; /* each counter is advanced at 1024 Hz in parallel, overflow carry does not affect next counter */ m_time_counter[0]++; m_time_counter[1]++; m_time_counter[2]++; m_time_counter[3]++; m_time_counter[4]++; m_data_out = 0; for(i=0;i<5;i++) m_data_out |= (m_time_counter[i] == 0); } break; } }