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

1994/0804/pc/vgas3.c (diff list | history)

1994/0803/sys/src/9/pc/vgas3.c:16,211994/0804/sys/src/9/pc/vgas3.c:16,22 (short | long | prev | next)
1994/0803    
 */ 
static Lock s3pagelock; 
static ulong storage; 
1994/0804    
static Point hotpoint; 
1994/0803    
 
extern Bitmap gscreen; 
 
1994/0803/sys/src/9/pc/vgas3.c:80,941994/0804/sys/src/9/pc/vgas3.c:81,96
1994/0803    
	/* 
	 * Cursor colours. Set both the CR0[EF] and the colour 
	 * stack in case we are using a 16-bit RAMDAC. 
1994/0804    
	 * Why are these colours reversed? 
1994/0803    
	 */ 
	vgaxo(Crtx, 0x0E, 0x00); 
	vgaxo(Crtx, 0x0F, 0xFF); 
1994/0804    
	vgaxo(Crtx, 0x0E, 0xFF); 
	vgaxo(Crtx, 0x0F, 0x00); 
1994/0803    
	vgaxi(Crtx, 0x45); 
	for(i = 0; i < 4; i++) 
		vgaxo(Crtx, 0x4A, 0x00); 
1994/0804    
		vgaxo(Crtx, 0x4A, 0xFF); 
1994/0803    
	vgaxi(Crtx, 0x45); 
	for(i = 0; i < 4; i++) 
		vgaxo(Crtx, 0x4B, 0xFF); 
1994/0804    
		vgaxo(Crtx, 0x4B, 0x00); 
1994/0803    
 
	/* 
	 * Find a place for the cursor data in display memory. 
1994/0803/sys/src/9/pc/vgas3.c:110,1161994/0804/sys/src/9/pc/vgas3.c:112,118
1994/0803    
static void 
load(Cursor *c) 
{ 
	uchar *and, *xor; 
1994/0804    
	uchar *p; 
1994/0803    
	int x, y; 
 
	/* 
1994/0803/sys/src/9/pc/vgas3.c:118,1311994/0804/sys/src/9/pc/vgas3.c:120,133
1994/0803    
	 * memory so we can update the cursor bitmap. 
	 * Set the display page (do we need to restore 
	 * the current contents when done?) and the 
	 * pointers to the two planes. 
1994/0804    
	 * pointer to the two planes. What if this crosses 
	 * into a new page? 
1994/0803    
	 */ 
	disable(); 
	lock(&s3pagelock); 
 
	sets3page(storage>>16); 
	and = ((uchar*)gscreen.base) + (storage & 0xFFFF); 
	xor = and + 512; 
1994/0804    
	p = ((uchar*)gscreen.base) + (storage & 0xFFFF); 
1994/0803    
 
	/* 
	 * The cursor is set in X11 mode which gives the following 
1994/0803/sys/src/9/pc/vgas3.c:138,1511994/0804/sys/src/9/pc/vgas3.c:140,157
1994/0803    
	 * Put the cursor into the top-left of the 64x64 array. 
	 */ 
	for(y = 0; y < 64; y++){ 
		for(x = 0; x < 8; x++){ 
			if(y < 16 && x < 2){ 
				and[8*y + x] = c->clr[2*y + x]^c->set[2*y + x]; 
				xor[8*y + x] = c->set[2*y + x]; 
1994/0804    
		for(x = 0; x < 64/8; x += 2){ 
			if(x < 16/8 && y < 16){ 
				*p++ = c->clr[2*y + x]|c->set[2*y + x]; 
				*p++ = c->clr[2*y + x+1]|c->set[2*y + x+1]; 
				*p++ = c->set[2*y + x]; 
				*p++ = c->set[2*y + x+1]; 
1994/0803    
			} 
			else { 
				and[8*y + x] = 0; 
				xor[8*y + x] = 0; 
1994/0804    
				*p++ = 0x00; 
				*p++ = 0x00; 
				*p++ = 0x00; 
				*p++ = 0x00; 
1994/0803    
			} 
		} 
	} 
1994/0803/sys/src/9/pc/vgas3.c:152,1611994/0804/sys/src/9/pc/vgas3.c:158,166
1994/0803    
	unlock(&s3pagelock); 
 
	/* 
	 * Set the cursor offset and enable the cursor. 
1994/0804    
	 * Set the cursor hotpoint and enable the cursor. 
1994/0803    
	 */ 
	vgaxo(Crtx, 0x4E, -c->offset.x); 
	vgaxo(Crtx, 0x4F, -c->offset.y); 
1994/0804    
	hotpoint = c->offset; 
1994/0803    
	vsyncactive(); 
	vgaxo(Crtx, 0x45, 0x01); 
} 
1994/0803/sys/src/9/pc/vgas3.c:163,1721994/0804/sys/src/9/pc/vgas3.c:168,200
1994/0803    
static int 
move(Point p) 
{ 
	vgaxo(Crtx, 0x46, (p.x>>8) & 0x07); 
	vgaxo(Crtx, 0x47, p.x & 0xFF); 
	vgaxo(Crtx, 0x49, p.y & 0xFF); 
	vgaxo(Crtx, 0x48, (p.y>>8) & 0x07); 
1994/0804    
	int x, xo, y, yo; 
 
	/* 
	 * Mustn't position the cursor offscreen even partially, 
	 * or it disappears. Therefore, if x or y is -ve, adjust the 
	 * cursor offset instead. 
	 */ 
	if((x = p.x+hotpoint.x) < 0){ 
		xo = -x; 
		xo = ((xo+1)/2)*2; 
		x = 0; 
	} 
	else 
		xo = 0; 
	if((y = p.y+hotpoint.y) < 0){ 
		yo = -y; 
		y = 0; 
	} 
	else 
		yo = 0; 
 
	vgaxo(Crtx, 0x46, (x>>8) & 0x07); 
	vgaxo(Crtx, 0x47, x & 0xFF); 
	vgaxo(Crtx, 0x49, y & 0xFF); 
	vgaxo(Crtx, 0x4E, xo); 
	vgaxo(Crtx, 0x4F, yo); 
	vgaxo(Crtx, 0x48, (y>>8) & 0x07); 
1994/0803    
 
	return 0; 
} 


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