plan 9 kernel history: overview | file list | diff list

1991/1112/pc/vga.c (diff list | history)

1991/1109/sys/src/9/pc/vga.c:24,321991/1112/sys/src/9/pc/vga.c:24,32 (short | long | prev | next)
1991/0730    
 */ 
#define MAXX	640 
#define MAXY	480 
1991/1109    
#define XPERIOD	800	/* Hsync freq == 31.47 KHZ */ 
#define YPERIOD	525	/* Vsync freq == 59.9 HZ */ 
#define YBORDER 2 
1991/1112    
int	xperiod = 800;	/* Hsync freq == 31.47 KHZ */ 
int	yperiod	= 525;	/* Vsync freq == 59.9 HZ */ 
int	yborder = 7;	/* top/bottom border of screen */ 
1991/0730    
 
#define SCREENMEM	(0xA0000 | KZERO) 
 
1991/1109/sys/src/9/pc/vga.c:42,471991/1112/sys/src/9/pc/vga.c:42,51
1991/0730    
 
1991/0723    
enum 
{ 
1991/1112    
	EMISCR=		0x3CC,		/* control sync polarity */ 
	EMISCW=		0x3C2, 
	EFCW=		0x3DA,		/* feature control */ 
	EFCR=		0x3CA, 
1991/0723    
	GRX=		0x3CE,		/* index to graphics registers */ 
1991/0727    
	GR=		0x3CF,		/* graphics registers */ 
	 Grot=		 0x03,		/*  data rotate register */ 
1991/1109/sys/src/9/pc/vga.c:115,1201991/1112/sys/src/9/pc/vga.c:119,135
1991/0727    
	grout(Grms, p&3); 
} 
 
1991/1112    
vgadump(void) 
{ 
	print("misc is 0x%ux fc is 0x%ux\n", inb(EMISCR), inb(EFCR)); 
	outb(EMISCW, 0xc7);/**/ 
} 
 
vgaclock(void) 
{ 
	outb(EMISCW, 0xc7);/**/ 
} 
 
1991/0727    
/* 
1991/1109    
 *  set up like vga mode 0x12 
 *	16 color (though we only use values 0x0 and 0xf) 
1991/1109/sys/src/9/pc/vga.c:138,1671991/1112/sys/src/9/pc/vga.c:153,182
1991/0928    
				 * mem without modifications */ 
1991/1109    
 
	msl = overflow = 0; 
1991/0928    
	crout(Cmode, 0xe3);	/* turn off address wrap & 
				 * word mode */ 
1991/1112    
	/* turn off address wrap & word mode */ 
	crout(Cmode, 0xe3); 
1991/1109    
	/* last scan line displayed (first is 0) */ 
	crout(Cvde, MAXY-1); 
	overflow |= ((MAXY-1)&0x200) ? 0x40 : 0; 
	overflow |= ((MAXY-1)&0x100) ? 0x2 : 0; 
	/* total scan lines (including retrace) - 2 */ 
	crout(Cvt, (YPERIOD-2)); 
	overflow |= ((YPERIOD-2)&0x200) ? 0x20 : 0; 
	overflow |= ((YPERIOD-2)&0x100) ? 0x1 : 0; 
1991/1112    
	crout(Cvt, (yperiod-2)); 
	overflow |= ((yperiod-2)&0x200) ? 0x20 : 0; 
	overflow |= ((yperiod-2)&0x100) ? 0x1 : 0; 
1991/1109    
	/* scan lines at which vertcal retrace starts & ends */ 
	crout(Cvrs, (MAXY+10)); 
	overflow |= ((MAXY+10)&0x200) ? 0x80 : 0; 
	overflow |= ((MAXY+10)&0x100) ? 0x4 : 0; 
	crout(Cvre, ((YPERIOD-1)&0xf)|0xa0);	/* also disable vertical interrupts */ 
1991/1112    
	crout(Cvrs, (MAXY+0x0a)); /**/ 
	overflow |= ((MAXY+0x0a)&0x200) ? 0x80 : 0; 
	overflow |= ((MAXY+0x0a)&0x100) ? 0x4 : 0; 
	crout(Cvre, ((yperiod-1)&0xf)|0xa0);	/* also disable vertical interrupts */ 
1991/1109    
	/* scan lines at which vertical blanking starts & ends */ 
	crout(Cvbs, (MAXY+YBORDER)); 
	msl |= ((MAXY+YBORDER)&0x200) ? 0x20 : 0; 
	overflow |= ((MAXY+YBORDER)&0x100) ? 0x8 : 0; 
	crout(Cvbe, (YPERIOD-YBORDER)&0x7f); 
	/* pixels per scan line (always 0 for graphics) */ 
	crout(Cmsl, 0x40|msl);	/* also 10th bit of line compare */ 
1991/1112    
	crout(Cvbs, (MAXY+yborder)); 
	msl |= ((MAXY+yborder)&0x100) ? 0x20 : 0; 
	overflow |= ((MAXY+yborder)&0x100) ? 0x8 : 0; 
	crout(Cvbe, (yperiod-yborder)&0x7f); 
1991/1109    
	/* the overflow bits from the other registers */ 
	crout(Cvover, 0x10|overflow);	/* also 9th bit of line compare */ 
1991/1112    
	/* pixels per scan line (always 0 for graphics) */ 
	crout(Cmsl, 0x40|msl);	/* also 10th bit of line compare */ 
1991/1109    
 
1991/0928    
	srout(Smode, 0x06);	/* extended memory, 
				 * odd/even off */ 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)