コード例 #1
0
ファイル: tiff_templ.cpp プロジェクト: ahui108/broccoli
int32 tiff_templ::add_de(uint16 tagid, short val) {
    std::map<uint16, TDE>::iterator it = m_demap.find(tagid);
    if (it != m_demap.end()) {
        set_de(tagid, val);
    } else {
        TDE de;
        de.tagid = tagid;
        de.type = TIFF_SHORT;
        de.length = 1;
        de.value = val;
        m_demap.insert(std::pair<uint16, TDE>(tagid, de));
    }
}
コード例 #2
0
ファイル: crtc_ega.c プロジェクト: jiangzhonghui/mame
void crtc_ega_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_LINE:
		handle_line_timer();
		break;

	case TIMER_DE_OFF:
		set_de( FALSE );
		break;

	case TIMER_CUR_ON:
		set_cur( TRUE );

		/* Schedule CURSOR off signal */
		m_cur_off_timer->adjust( attotime::from_ticks( 1, m_clock ) );
		break;

	case TIMER_CUR_OFF:
		set_cur( FALSE );
		break;

	case TIMER_HSYNC_ON:
		{
			INT8 hsync_width = ( 0x20 | m_horiz_blank_end ) - ( m_horiz_blank_start & 0x1f );

			if ( hsync_width <= 0 )
			{
				hsync_width += 0x20;
			}

			m_hsync_width_counter = 0;
			set_hsync( TRUE );

			/* Schedule HSYNC off signal */
			m_hsync_off_timer->adjust( attotime::from_ticks( hsync_width, m_clock ) );
		}
		break;

	case TIMER_HSYNC_OFF:
		set_hsync( FALSE );
		break;

	case TIMER_LIGHT_PEN_LATCH:
		m_light_pen_addr = get_ma();
		m_light_pen_latched = true;
		break;
	}
}
コード例 #3
0
ファイル: tiff_templ.cpp プロジェクト: ahui108/broccoli
int32 tiff_templ::add_de(uint16 tagid, char* val, int32 len) {
    std::map<uint16, TDE>::iterator it = m_demap.find(tagid);
    if (it != m_demap.end()) {
        set_de(tagid, val, len);
    } else {
        TDE de;
        de.tagid = tagid;
        de.type = TIFF_ASCII;
        de.length = len;
        de.valueOffset = m_ifd_offset;
        fseek(m_file, m_ifd_offset, SEEK_SET);
        fwrite(val, 1, len, m_file);
        m_ifd_offset += len;
        m_demap.insert(std::pair<uint16, TDE>(tagid, de));
    }
}
コード例 #4
0
ファイル: tiff_templ.cpp プロジェクト: ahui108/broccoli
int32 tiff_templ::write_ifd() {
    fseek(m_file, 0, SEEK_SET);
    m_ifh.offsetToFirstIFD = m_ifd_offset;
    fwrite(&m_ifh, 1, sizeof(TIFH), m_file);
    
    const int DECountLen = 2;
    const int NextIFDOffsetLen = 4;
    long img_offset = m_ifd_offset + sizeof(TDE) * m_demap.size() + DECountLen + NextIFDOffsetLen;
    set_de(TIFFTAG_STRIPOFFSETS, img_offset);
    printf("Raw data offset:0x%02X\n", (uint32)img_offset);
    
    fseek(m_file, m_ifd_offset, SEEK_SET);
    uint16 de_count = m_demap.size();
    fwrite(&de_count, 1, 2, m_file);
    for (std::map<uint16, TDE>::iterator it = m_demap.begin(); it != m_demap.end(); it++) {
        if (it->second.tagid == TIFFTAG_EXTERN_EXPOSURELINE) {
            long pos = ftell(m_file);
            printf("Expline offset:0x%02X, cur value:0x%02X\n", (uint32)(pos + 2 + 2 + 4), it->second.value);
        }
        fwrite(&(it->second), 1, sizeof(TDE), m_file);
    }
    uint32 next_ifd_offset = 0x00;
    fwrite(&next_ifd_offset, 1, 4, m_file);
}
コード例 #5
0
ファイル: crtc_ega.c プロジェクト: jiangzhonghui/mame
void crtc_ega_device::handle_line_timer()
{
	int new_vsync = m_vsync;

	m_character_counter = 0;
	m_cursor_x = -1;

	/* Check if VSYNC is active */
	if ( m_vsync_ff )
	{
		m_vsync_width_counter = ( m_vsync_width_counter + 1 ) & 0x0F;

		/* Check if we've reached end of VSYNC */
		if ( m_vsync_width_counter == m_vert_retr_end )
		{
			m_vsync_ff = 0;

			new_vsync = FALSE;
		}
	}

	if ( m_raster_counter == m_max_ras_addr )
	{
		m_raster_counter = 0;
		m_line_address = ( m_line_address + m_horiz_disp + 1 ) & 0xffff;
	}
	else
	{
		m_raster_counter = ( m_raster_counter + 1 ) & 0x1F;
	}

	m_line_counter = ( m_line_counter + 1 ) & 0x3ff;

	/* Check if we've reached the end of active display */
	if ( m_line_counter == m_vert_disp_end )
	{
		m_line_enable_ff = false;
	}

	/* Check if VSYNC should be enabled */
	if ( m_line_counter == m_vert_retr_start )
	{
		m_vsync_width_counter = 0;
		m_vsync_ff = 1;

		new_vsync = TRUE;
	}

	/* Check if we have reached the end of the vertical area */
	if ( m_line_counter == m_vert_total )
	{
		m_line_counter = 0;
		m_line_address = m_disp_start_addr;
		m_line_enable_ff = true;
		set_vblank( FALSE );
		/* also update the cursor state now */
		update_cursor_state();

		if (m_screen != NULL)
			m_screen->reset_origin();
	}

	if ( m_line_enable_ff )
	{
		/* Schedule DE off signal change */
		m_de_off_timer->adjust(attotime::from_ticks( m_horiz_disp + 1, m_clock ));

		/* Is cursor visible on this line? */
		if ( m_cursor_state &&
			(m_raster_counter >= (m_cursor_start_ras & 0x1f)) &&
			(m_raster_counter <= m_cursor_end_ras) &&
			(m_cursor_addr >= m_line_address) &&
			(m_cursor_addr < (m_line_address + m_horiz_disp + 1)) )
		{
			m_cursor_x = m_cursor_addr - m_line_address;

			/* Schedule CURSOR ON signal */
			m_cur_on_timer->adjust( attotime::from_ticks( m_cursor_x, m_clock ) );
		}
	}

	/* Schedule HSYNC on signal */
	m_hsync_on_timer->adjust( attotime::from_ticks( m_horiz_blank_start, m_clock ) );

	/* Set VBlank signal */
	if ( m_line_counter == m_vert_disp_end + 1 )
	{
		set_vblank( TRUE );
	}

	/* Schedule our next callback */
	m_line_timer->adjust( attotime::from_ticks( m_horiz_char_total + 2, m_clock ) );

	/* Set VSYNC and DE signals */
	set_vsync( new_vsync );
	set_de( m_line_enable_ff ? TRUE : FALSE );
}
コード例 #6
0
ファイル: mc6845.c プロジェクト: vtanakas/mame
void mc6845_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_LINE:
		handle_line_timer();
		break;

	case TIMER_DE_OFF:
		set_de( FALSE );
		break;

	case TIMER_CUR_ON:
		set_cur( TRUE );

		/* Schedule CURSOR off signal */
		m_cur_off_timer->adjust( attotime::from_ticks( 1, m_clock ) );
		break;

	case TIMER_CUR_OFF:
		set_cur( FALSE );
		break;

	case TIMER_HSYNC_ON:
		{
			UINT8 hsync_width = ( m_sync_width & 0x0f ) ? ( m_sync_width & 0x0f ) : 0x10;

			m_hsync_width_counter = 0;
			set_hsync( TRUE );

			/* Schedule HSYNC off signal */
			m_hsync_off_timer->adjust( attotime::from_ticks( hsync_width, m_clock ) );
		}
		break;

	case TIMER_HSYNC_OFF:
		set_hsync( FALSE );
		break;

	case TIMER_LIGHT_PEN_LATCH:
		m_light_pen_addr = get_ma();
		m_light_pen_latched = true;
		break;

	case TIMER_UPD_ADR:
		/* fire a update address strobe */
		call_on_update_address(0);
		break;

	case TIMER_UPD_TRANS:
		{
			int addr = (param >> 8);
			int strobe = (param & 0xff);

			/* call the callback function -- we know it exists */
			m_on_update_addr_changed_cb(addr, strobe);

			if(!m_update_ready_bit && MODE_TRANSPARENT_BLANK)
			{
				m_update_addr++;
				m_update_addr &= 0x3fff;
				m_update_ready_bit = true;
			}
		}
		break;

	}
}
コード例 #7
0
ファイル: mc6845.c プロジェクト: vtanakas/mame
void mc6845_device::handle_line_timer()
{
	int new_vsync = m_vsync;

	m_character_counter = 0;
	m_cursor_x = -1;

	/* Check if VSYNC is active */
	if ( m_vsync_ff )
	{
		UINT8 vsync_width = m_supports_vert_sync_width ? (m_sync_width >> 4) & 0x0f : 0;

		m_vsync_width_counter = ( m_vsync_width_counter + 1 ) & 0x0F;

		/* Check if we've reached end of VSYNC */
		if ( m_vsync_width_counter == vsync_width )
		{
			m_vsync_ff = 0;

			new_vsync = FALSE;
		}
	}

	// For rudimentary 'interlace and video' support, m_raster_counter increments by 1 rather than the correct 2.
	// The correct test would be:
	// if ( m_raster_counter == (MODE_INTERLACE_AND_VIDEO ? m_max_ras_addr + 1 : m_max_ras_addr) )
	if ( m_raster_counter == m_max_ras_addr )
	{
		/* Check if we have reached the end of the vertical area */
		if ( m_line_counter == m_vert_char_total )
		{
			m_adjust_counter = 0;
			m_adjust_active = 1;
		}

		m_raster_counter = 0;
		m_line_counter = ( m_line_counter + 1 ) & 0x7F;
		m_line_address = ( m_line_address + m_horiz_disp ) & 0x3fff;

		/* Check if we've reached the end of active display */
		if ( m_line_counter == m_vert_disp )
		{
			m_line_enable_ff = false;
			m_current_disp_addr = m_disp_start_addr;
		}

		/* Check if VSYNC should be enabled */
		if ( m_line_counter == m_vert_sync_pos )
		{
			m_vsync_width_counter = 0;
			m_vsync_ff = 1;

			new_vsync = TRUE;
		}
	}
	else
	{
		// For rudimentary 'interlace and video' support, m_raster_counter increments by 1 rather than the correct 2.
		// m_raster_counter = ( m_raster_counter + (MODE_INTERLACE_AND_VIDEO ? 2 : 1) ) & 0x1F;
		m_raster_counter = ( m_raster_counter + 1 ) & 0x1F;
	}

	if ( m_adjust_active )
	{
		/* Check if we have reached the end of a full cycle */
		if ( m_adjust_counter == m_vert_total_adj )
		{
			m_adjust_active = 0;
			m_raster_counter = 0;
			m_line_counter = 0;
			m_line_address = m_disp_start_addr;
			m_line_enable_ff = true;
			/* also update the cursor state now */
			update_cursor_state();

			if (m_screen != NULL)
				m_screen->reset_origin();
		}
		else
		{
			m_adjust_counter = ( m_adjust_counter + 1 ) & 0x1F;
		}
	}

	if ( m_line_enable_ff )
	{
		/* Schedule DE off signal change */
		m_de_off_timer->adjust(attotime::from_ticks( m_horiz_disp, m_clock ));

		/* Is cursor visible on this line? */
		if ( m_cursor_state &&
			(m_raster_counter >= (m_cursor_start_ras & 0x1f)) &&
			(m_raster_counter <= m_cursor_end_ras) &&
			(m_cursor_addr >= m_line_address) &&
			(m_cursor_addr < (m_line_address + m_horiz_disp)) )
		{
			m_cursor_x = m_cursor_addr - m_line_address;

			/* Schedule CURSOR ON signal */
			m_cur_on_timer->adjust( attotime::from_ticks( m_cursor_x, m_clock ) );
		}
	}

	/* Schedule HSYNC on signal */
	m_hsync_on_timer->adjust( attotime::from_ticks( m_horiz_sync_pos, m_clock ) );

	/* Schedule our next callback */
	m_line_timer->adjust( attotime::from_ticks( m_horiz_char_total + 1, m_clock ) );

	/* Set VSYNC and DE signals */
	set_vsync( new_vsync );
	set_de( m_line_enable_ff ? TRUE : FALSE );
}