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

1995/0126/pc/vgabt485.c (diff list | history)

1995/0126/sys/src/9/pc/vgabt485.c:5,131997/1101/sys/src/9/pc/vgabt485.c:5,14 (short | long | prev | next)
1994/0624    
#include "fns.h" 
#include "../port/error.h" 
 
#include <libg.h> 
1997/1101    
#define	Image	IMAGE 
#include <draw.h> 
#include <memdraw.h> 
1994/0624    
#include "screen.h" 
#include "vga.h" 
 
/* 
 * Hardware graphics cursor support for 
1995/0126/sys/src/9/pc/vgabt485.c:103,1201997/1101/sys/src/9/pc/vgabt485.c:104,176
1994/0624    
	vgaxo(Crtx, 0x55, crt55); 
} 
 
static Point hotpoint; 
1997/1101    
static void 
bt485disable(VGAscr*) 
{ 
	uchar r; 
1994/0624    
 
1997/1101    
	/* 
	 * Disable  
	 *	cursor mode 3; 
	 *	cursor control enable for Bt485 DAC; 
	 *	the hardware cursor external operation mode. 
	 */ 
	r = bt485i(Cmd2) & ~0x03; 
	bt485o(Cmd2, r); 
 
	r = vgaxi(Crtx, 0x45) & ~0x20; 
	vgaxo(Crtx, 0x45, r); 
 
	r = vgaxi(Crtx, 0x55) & ~0x20; 
	vgaxo(Crtx, 0x55, r); 
} 
 
1994/0624    
static void 
load(Cursor *c) 
1997/1101    
bt485enable(VGAscr*) 
1994/0624    
{ 
	uchar r; 
	int x, y; 
 
1997/1101    
	/* 
	 * Turn cursor off. 
	 */ 
	r = bt485i(Cmd2) & 0xFC; 
	bt485o(Cmd2, r); 
1994/0624    
 
1994/0729    
	lock(&palettelock); 
1997/1101    
	/* 
	 * Overscan colour, 
	 * cursor colour 1 (white), 
	 * cursor colour 2, 3 (black). 
	 */ 
	bt485o(ColorW, 0x00); 
	bt485o(Color, Pwhite); bt485o(Color, Pwhite); bt485o(Color, Pwhite); 
1994/0624    
 
1997/1101    
	bt485o(Color, Pwhite); bt485o(Color, Pwhite); bt485o(Color, Pwhite); 
 
	bt485o(Color, Pblack); bt485o(Color, Pblack); bt485o(Color, Pblack); 
	bt485o(Color, Pblack); bt485o(Color, Pblack); bt485o(Color, Pblack); 
 
1994/0624    
	/* 
1997/1101    
	 * Finally, enable 
	 *	the hardware cursor external operation mode; 
	 *	cursor control enable for Bt485 DAC. 
	 * The #9GXE cards seem to need the 86C928 Bt485 support 
	 * enabled in order to work at all in enhanced mode. 
	 */ 
 
	r = vgaxi(Crtx, 0x55)|0x20; 
	vgaxo(Crtx, 0x55, r); 
 
	r = vgaxi(Crtx, 0x45)|0x20; 
	vgaxo(Crtx, 0x45, r); 
} 
 
static void 
bt485load(VGAscr* scr, Cursor* curs) 
{ 
	uchar r; 
	int x, y; 
 
	/* 
1994/0624    
	 * Turn cursor off; 
	 * put cursor into 64x64x2 mode and clear MSBs of address; 
	 * clear LSBs of address; 
1995/0126/sys/src/9/pc/vgabt485.c:137,1431997/1101/sys/src/9/pc/vgabt485.c:193,199
1994/0624    
	for(y = 0; y < 64; y++){ 
		for(x = 0; x < 64/8; x++){ 
			if(x < 16/8 && y < 16) 
				bt485o(Cram, c->clr[x+y*2]); 
1997/1101    
				bt485o(Cram, curs->clr[x+y*2]); 
1994/0624    
			else 
				bt485o(Cram, 0x00); 
		} 
1995/0126/sys/src/9/pc/vgabt485.c:145,1511997/1101/sys/src/9/pc/vgabt485.c:201,207
1994/0624    
	for(y = 0; y < 64; y++){ 
		for(x = 0; x < 64/8; x++){ 
			if(x < 16/8 && y < 16) 
				bt485o(Cram, c->set[x+y*2]); 
1997/1101    
				bt485o(Cram, curs->set[x+y*2]); 
1994/0624    
			else 
				bt485o(Cram, 0x00); 
		} 
1995/0126/sys/src/9/pc/vgabt485.c:155,2671997/1101/sys/src/9/pc/vgabt485.c:211,244
1994/0624    
	 * Initialise the cursor hot-point 
	 * and enable the cursor. 
	 */ 
	hotpoint.x = 64+c->offset.x; 
	hotpoint.y = 64+c->offset.y; 
1997/1101    
	scr->offset.x = 64+curs->offset.x; 
	scr->offset.y = 64+curs->offset.y; 
1994/0624    
 
	r = (bt485i(Cmd2) & 0xFC)|0x01; 
	bt485o(Cmd2, r); 
                 
1994/0729    
	unlock(&palettelock); 
1994/0624    
} 
 
static void 
enable(void) 
{ 
	uchar r; 
                 
1994/0729    
	lock(&palettelock); 
1994/0624    
                 
	/* 
	 * Turn cursor off. 
	 */ 
	r = bt485i(Cmd2) & 0xFC; 
	bt485o(Cmd2, r); 
                 
	/* 
	 * Overscan colour, 
	 * cursor colour 1 (white), 
	 * cursor colour 2, 3 (black). 
	 */ 
	bt485o(ColorW, 0x00); 
1995/0126    
	bt485o(Color, Pwhite); bt485o(Color, Pwhite); bt485o(Color, Pwhite); 
1994/0624    
                 
1995/0126    
	bt485o(Color, Pwhite); bt485o(Color, Pwhite); bt485o(Color, Pwhite); 
1994/0624    
                 
1995/0126    
	bt485o(Color, Pblack); bt485o(Color, Pblack); bt485o(Color, Pblack); 
	bt485o(Color, Pblack); bt485o(Color, Pblack); bt485o(Color, Pblack); 
1994/0624    
                 
1994/0729    
	unlock(&palettelock); 
1994/0624    
                 
	/* 
	 * Finally, enable 
	 *	the hardware cursor external operation mode; 
	 *	cursor control enable for Bt485 DAC. 
	 * The #9GXE cards seem to need the 86C928 Bt485 support 
	 * enabled in order to work at all in enhanced mode. 
	 */ 
                 
	r = vgaxi(Crtx, 0x55)|0x20; 
	vgaxo(Crtx, 0x55, r); 
                 
	r = vgaxi(Crtx, 0x45)|0x20; 
	vgaxo(Crtx, 0x45, r); 
} 
                 
static int 
move(Point p) 
1997/1101    
bt485move(VGAscr* scr, Point p) 
1994/0624    
{ 
	int x, y; 
 
1994/0729    
	if(canlock(&palettelock) == 0) 
1994/0624    
		return 1; 
1997/1101    
	x = p.x+scr->offset.x; 
	y = p.y+scr->offset.y; 
1994/0624    
 
	x = p.x+hotpoint.x; 
	y = p.y+hotpoint.y; 
                 
	bt485o(Cxlr, x & 0xFF); 
	bt485o(Cxhr, (x>>8) & 0x0F); 
	bt485o(Cylr, y & 0xFF); 
	bt485o(Cyhr, (y>>8) & 0x0F); 
 
1994/0729    
	unlock(&palettelock); 
1994/0624    
	return 0; 
} 
 
static void 
disable(void) 
{ 
	uchar r; 
                 
	/* 
	 * Disable  
	 *	cursor mode 3; 
	 *	cursor control enable for Bt485 DAC; 
	 *	the hardware cursor external operation mode. 
	 */ 
1994/0729    
	lock(&palettelock); 
1994/0624    
	r = bt485i(Cmd2) & ~0x03; 
	bt485o(Cmd2, r); 
1994/0729    
	unlock(&palettelock); 
1994/0624    
                 
	r = vgaxi(Crtx, 0x45) & ~0x20; 
	vgaxo(Crtx, 0x45, r); 
                 
	r = vgaxi(Crtx, 0x55) & ~0x20; 
	vgaxo(Crtx, 0x55, r); 
} 
                 
Hwgc bt485hwgc = { 
1997/1101    
VGAcur vgabt485cur = { 
1994/0624    
	"bt485hwgc", 
	enable, 
	load, 
	move, 
	disable, 
1995/0126    
 
	0, 
1997/1101    
	bt485enable, 
	bt485disable, 
	bt485load, 
	bt485move, 
1994/0624    
}; 
1995/0126    
                 
void 
vgabt485link(void) 
{ 
	addhwgclink(&bt485hwgc); 
} 


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