void pioneer_ldv1000_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TID_MULTIJUMP: { // bit 5 of port B on PPI 1 selects the direction of slider movement int direction = (m_portb1 & 0x20) ? 1 : -1; advance_slider(direction); // update down counter and reschedule if (--m_counter != 0) timer.adjust(MULTIJUMP_TRACK_TIME); break; } case TID_VSYNC_OFF: m_vsync = false; break; case TID_VBI_DATA_FETCH: { // appears to return data in reverse order UINT32 lines[3]; lines[0] = get_field_code(LASERDISC_CODE_LINE1718, false); lines[1] = get_field_code(LASERDISC_CODE_LINE17, false); lines[2] = get_field_code(LASERDISC_CODE_LINE16, false); // fill in the details memset(m_vbi, 0, sizeof(m_vbi)); if (focus_on() && laser_on()) { // loop over lines for (int line = 0; line < 3; line++) { UINT8 *dest = &m_vbi[line * 7]; UINT32 data = lines[line]; // the logic only processes leadin/leadout/frame number codes if (data == VBI_CODE_LEADIN || data == VBI_CODE_LEADOUT || (data & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE) { *dest++ = 0x09 | (((data & VBI_MASK_CAV_PICTURE) == VBI_CODE_CAV_PICTURE) ? 0x02 : 0x00); *dest++ = 0x08; *dest++ = (data >> 16) & 0x0f; *dest++ = (data >> 12) & 0x0f; *dest++ = (data >> 8) & 0x0f; *dest++ = (data >> 4) & 0x0f; *dest++ = (data >> 0) & 0x0f; } } } // signal that data is ready and reset the readback index m_vbiready = true; m_vbiindex = 0; break; } // pass everything else onto the parent default: laserdisc_device::device_timer(timer, id, param, ptr); break; }
void phillips_22vp931_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TID_VBI_DATA_FETCH: { uint32_t line = param >> 2; int which = param & 3; uint32_t code = 0; // fetch the code and compute the DATIC latched value if (line >= LASERDISC_CODE_LINE16 && line <= LASERDISC_CODE_LINE18) code = get_field_code(laserdisc_field_code(line), false); // at the start of each line, signal an interrupt and use a timer to turn it off if (which == 0) { m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE); timer_set(attotime::from_nsec(5580), TID_IRQ_OFF); } // clock the data strobe on each subsequent callback else if (code != 0) { m_daticval = code >> (8 * (3 - which)); m_datastrobe = 1; timer_set(attotime::from_nsec(5000), TID_DATA_STROBE_OFF); } // determine the next bit to fetch and reprime ourself if (++which == 4) { which = 0; line++; } if (line <= LASERDISC_CODE_LINE18 + 1) timer_set(screen().time_until_pos(line*2, which * 2 * screen().width() / 4), TID_VBI_DATA_FETCH, (line << 2) + which); break; } case TID_DEFERRED_DATA: // set the value and mark it pending if (LOG_COMMANDS && m_fromcontroller_pending) printf("Dropped previous command byte\n"); m_fromcontroller = param; m_fromcontroller_pending = true; // track the commands for debugging purposes if (m_cmdcount < ARRAY_LENGTH(m_cmdbuf)) { m_cmdbuf[m_cmdcount++ % 3] = param; if (LOG_COMMANDS && m_cmdcount % 3 == 0) printf("Cmd: %02X %02X %02X\n", m_cmdbuf[0], m_cmdbuf[1], m_cmdbuf[2]); } break; case TID_IRQ_OFF: m_i8049_cpu->set_input_line(MCS48_INPUT_IRQ, CLEAR_LINE); break; case TID_DATA_STROBE_OFF: m_datastrobe = 0; break; case TID_ERP_OFF: m_daticerp = 0; break; case TID_HALF_TRACK: // advance by the count and toggle the state m_trackstate ^= 1; if ((m_trackdir < 0 && !m_trackstate) || (m_trackdir > 0 && m_trackstate)) { advance_slider(m_trackdir); m_advanced += m_trackdir; } break; // pass everything else onto the parent default: laserdisc_device::device_timer(timer, id, param, ptr); break; }