コード例 #1
0
ファイル: video-mode.c プロジェクト: 274914765/C
/*
 * Recalculate the vertical video cutoff (hack!)
 */
static void vga_recalc_vertical(void)
{
    unsigned int font_size, rows;
    u16 crtc;
    u8 pt, ov;

    set_fs(0);
    font_size = rdfs8(0x485); /* BIOS: font size (pixels) */
    rows = force_y ? force_y : rdfs8(0x484)+1; /* Text rows */

    rows *= font_size;    /* Visible scan lines */
    rows--;            /* ... minus one */

    crtc = vga_crtc();

    pt = in_idx(crtc, 0x11);
    pt &= ~0x80;        /* Unlock CR0-7 */
    out_idx(pt, crtc, 0x11);

    out_idx((u8)rows, crtc, 0x12); /* Lower height register */

    ov = in_idx(crtc, 0x07); /* Overflow register */
    ov &= 0xbd;
    ov |= (rows >> (8-1)) & 0x02;
    ov |= (rows >> (9-6)) & 0x40;
    out_idx(ov, crtc, 0x07);
}
コード例 #2
0
static void vga_recalc_vertical(void)
{
	unsigned int font_size, rows;
	u16 crtc;
	u8 pt, ov;

	set_fs(0);
	font_size = rdfs8(0x485); 
	rows = force_y ? force_y : rdfs8(0x484)+1; 

	rows *= font_size;	
	rows--;			

	crtc = vga_crtc();

	pt = in_idx(crtc, 0x11);
	pt &= ~0x80;		
	out_idx(pt, crtc, 0x11);

	out_idx((u8)rows, crtc, 0x12); 

	ov = in_idx(crtc, 0x07); 
	ov &= 0xbd;
	ov |= (rows >> (8-1)) & 0x02;
	ov |= (rows >> (9-6)) & 0x40;
	out_idx(ov, crtc, 0x07);
}
コード例 #3
0
ファイル: video-mode.c プロジェクト: hephaex/linux-3.2
/**
 @brief
 */
static void vga_recalc_vertical(void)
{
	unsigned int font_size, rows;
	u16 crtc;
	u8 pt, ov;

	/*
	 0x485 : Point Height of Size (2Byte)
	 0x484 : Rows on the screen (2Byte)
	 */
	set_fs(0);
	font_size = rdfs8(0x485); /* BIOS: font size (pixels) */
	rows = force_y ? force_y : rdfs8(0x484)+1; /* Text rows */

	rows *= font_size;	/* Visible scan lines */
	rows--;			/* ... minus one */

	crtc = vga_crtc();

	/*
	 CPU 에서 장치에 접근하는 방법은
	 Index Register Address, Data Register Address 을 이용하여 접근한다.
	 Index Register Address 에는 장치에서 관리하는 Register 중, 몇 번째 Register
	 에 접근할지 에 대한 정보(Index)가 입력되며, 1 Byte 의 크기(0 ~ 255) 까지의
	 값이 할당가능하다.
	 Data Register 에는 지정된 Index 번째에 해당하는 데이터가 입력된다.
	 Index Register Address 와 Data Register Address 는 항상 쌍으로 구성되며,
	 Index Register Address + 1 의 주소가 Data Register Address 가 된다
	 */
	pt = in_idx(crtc, 0x11);
	pt &= ~0x80;		/* Unlock CR0-7 */ // 최상위 비트를 끈다.
	out_idx(pt, crtc, 0x11); // 쓰기가능하게 해준다.
//	 11h R- native VGA with bit7=1 in end horizontal blanking (03h):
//	            end vertical retrace
// 11h -W end vertical retrace
//           bit7  : VGA: protection bit
//                =0 enable write access to 00h-07h
//                =1 read only regs 00h-07h with the exception
//                   of bit4 in 07h. ET4000: protect 35h also.
// rows의 아래 8비트를 먼저 써주고 8번 9번 비트를 위치에 맞게 OR해 넣는다.
	out_idx((u8)rows, crtc, 0x12); /* Lower height register */

	ov = in_idx(crtc, 0x07); /* Overflow register */
	ov &= 0xbd; // 1011 1101 
	ov |= (rows >> (8-1)) & 0x02; // bit 8 of vertical display end
	ov |= (rows >> (9-6)) & 0x40; // bit 9 of "
	out_idx(ov, crtc, 0x07);
}