Exemplo n.º 1
0
uint16_t via6522_device::get_counter1_value()
{
	uint16_t val;

	if(m_t1_active)
	{
		val = attotime_to_clocks(m_t1->remaining()) - IFR_DELAY;
	}
	else
	{
		val = 0xffff - attotime_to_clocks(machine().time() - m_time1);
	}

	return val;
}
Exemplo n.º 2
0
void dp835x_device::reconfigure_screen()
{
	int lines_per_frame = m_video_scan_lines + m_vblank_interval[m_60hz_refresh ? 1 : 0];
	attotime scan_period = clocks_to_attotime(m_dots_per_line);
	attotime refresh = clocks_to_attotime(lines_per_frame * m_dots_per_line);

	if (m_half_shift)
		screen().configure(2 * m_dots_per_line, lines_per_frame, screen().visible_area(), refresh.as_attoseconds());
	else
		screen().configure(m_dots_per_line, lines_per_frame, screen().visible_area(), refresh.as_attoseconds());

	logerror("Frame rate refresh: %.2f Hz (f%d); horizontal rate scan: %.4f kHz; character rate: %.4f MHz; dot rate: %.5f MHz\n",
		refresh.as_hz(),
		m_60hz_refresh ? 1 : 0,
		clock() / (m_dots_per_line * 1000.0),
		clock() / (m_char_width * 1000000.0),
		clock() / 1000000.0);

	// get current screen position (note that this method is more accurate than calling hpos and vpos separately)
	u32 dpos = attotime_to_clocks(refresh - screen().time_until_pos(lines_per_frame - 1, m_dots_per_row * (m_half_shift ? 2 : 1)));
	int hpos = (dpos + m_dots_per_row) % m_dots_per_line;
	int vpos = dpos / m_dots_per_line;

	// set line rate clock timers
	int hblank_begin = m_dots_per_row;
	int hblank_near_end = m_dots_per_line - m_char_width * 5;
	if (hpos >= hblank_begin)
		hblank_begin += m_dots_per_line;
	m_hblank_start_timer->adjust(clocks_to_attotime(hblank_begin - hpos), 0, scan_period);
	if (hpos >= hblank_near_end)
		hblank_near_end += m_dots_per_line;
	m_hblank_near_end_timer->adjust(clocks_to_attotime(hblank_near_end - hpos), 0, scan_period);

	// set horizontal sync timers (note that HSYNC may precede horizontal blanking or even outlast it, as on the DP8350)
	int hsync_begin = m_dots_per_row + m_char_width * m_hsync_delay;
	int hsync_end = hsync_begin + m_char_width * m_hsync_width;
	if (hpos >= hsync_begin)
		hsync_begin += m_dots_per_line;
	m_hsync_on_timer->adjust(clocks_to_attotime(hsync_begin - hpos), m_hsync_active, scan_period);
	if (hpos >= hsync_end)
		hsync_end += m_dots_per_line;
	else if (hpos < hsync_end - m_dots_per_line)
		hsync_end -= m_dots_per_line;
	m_hsync_off_timer->adjust(clocks_to_attotime(hsync_end - hpos), !m_hsync_active, scan_period);
	logerror("hblank_begin: %d; hsync_begin: %d; hsync_end: %d; hpos: %d\n", hblank_begin, hsync_begin, hsync_end, hpos);

	// calculate vertical sync and blanking parameters
	int vsync_begin = m_video_scan_lines + m_vsync_delay[m_60hz_refresh ? 1 : 0];
	int vsync_end = vsync_begin + m_vsync_width[m_60hz_refresh ? 1 : 0];
	int vblank_end = lines_per_frame - m_vblank_stop;
	logerror("vblank_begin: %d; vsync_begin: %d; vsync_end: %d; vblank_end: %d; vpos: %d\n", m_video_scan_lines, vsync_begin, vsync_end, vblank_end, vpos);

	// set counters
	m_line = vpos;
	if (m_line >= lines_per_frame - m_char_height)
		m_lc = m_line - (lines_per_frame - m_char_height);
	else
		m_lc = m_line % m_char_height;
}
Exemplo n.º 3
0
void m6809_base_device::execute_set_input(int inputnum, int state)
{
	if (LOG_INTERRUPTS)
		logerror("%s: inputnum=%s state=%d totalcycles=%d\n", machine().describe_context(), inputnum_string(inputnum), state, (int) attotime_to_clocks(machine().time()));

	switch(inputnum)
	{
		case INPUT_LINE_NMI:
			// NMI is edge triggered
			m_nmi_asserted = m_nmi_asserted || ((state != CLEAR_LINE) && !m_nmi_line && m_lds_encountered);
			m_nmi_line = (state != CLEAR_LINE);
			break;

		case M6809_FIRQ_LINE:
			// FIRQ is line triggered
			m_firq_line = (state != CLEAR_LINE);
			break;

		case M6809_IRQ_LINE:
			// IRQ is line triggered
			m_irq_line = (state != CLEAR_LINE);
			break;
	}
}