⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pm.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 2 页
字号:
	/*	 * Initialize the screen.	 */	pcc->cmdr = PCC_FOPB | PCC_VBHI;	/*	 * Initialize the cursor register.	 */	pcc->cmdr = curReg = PCC_ENPA | PCC_ENPB;	/*	 * Initialize screen info.	 */	fp->fbu->scrInfo.max_row = 56;	fp->fbu->scrInfo.max_col = 80;	fp->fbu->scrInfo.max_x = 1024;	fp->fbu->scrInfo.max_y = 864;	fp->fbu->scrInfo.max_cur_x = 1023;	fp->fbu->scrInfo.max_cur_y = 863;	fp->fbu->scrInfo.version = 11;	fp->fbu->scrInfo.mthreshold = 4;		fp->fbu->scrInfo.mscale = 2;	fp->fbu->scrInfo.min_cur_x = -15;	fp->fbu->scrInfo.min_cur_y = -15;	fp->fbu->scrInfo.qe.timestamp_ms = TO_MS(time);	fp->fbu->scrInfo.qe.eSize = PM_MAXEVQ;	fp->fbu->scrInfo.qe.eHead = fp->fbu->scrInfo.qe.eTail = 0;	fp->fbu->scrInfo.qe.tcSize = MOTION_BUFFER_SIZE;	fp->fbu->scrInfo.qe.tcNext = 0;	/*	 * Initialize the color map, the screen, and the mouse.	 */	pmInitColorMap();	pmScreenInit();	fbScroll(fp);	fp->initialized = 1;	if (cn_tab.cn_fb == (struct pmax_fb *)0)		cn_tab.cn_fb = fp;	return (1);}	/* * ---------------------------------------------------------------------------- * * pmScreenInit -- * *	Initialize the screen. * * Results: *	None. * * Side effects: *	The screen is initialized. * * ---------------------------------------------------------------------------- */static voidpmScreenInit(){	register struct pmax_fb *fp = &pmfb;	/*	 * Home the cursor.	 * We want an LSI terminal emulation.  We want the graphics	 * terminal to scroll from the bottom. So start at the bottom.	 */	fp->row = 55;	fp->col = 0;	/*	 * Load the cursor with the default values	 *	 */	pmLoadCursor(defCursor);}/* * ---------------------------------------------------------------------------- * * pmLoadCursor -- * *	Routine to load the cursor Sprite pattern. * * Results: *	None. * * Side effects: *	The cursor is loaded into the hardware cursor. * * ---------------------------------------------------------------------------- */static voidpmLoadCursor(cur)	unsigned short *cur;{	register PCCRegs *pcc = (PCCRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_PCC);	register int i;	curReg |= PCC_LODSA;	pcc->cmdr = curReg;	for (i = 0; i < 32; i++) {		pcc->memory = cur[i];		MachEmptyWriteBuffer();	}	curReg &= ~PCC_LODSA;	pcc->cmdr = curReg;}/* * ---------------------------------------------------------------------------- * * pmRestoreCursorColor -- * *	Routine to restore the color of the cursor. * * Results: *	None. * * Side effects: *	None. * * ---------------------------------------------------------------------------- */static voidpmRestoreCursorColor(){	register VDACRegs *vdac = (VDACRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);	register int i;	vdac->overWA = 0x04;	MachEmptyWriteBuffer();	for (i = 0; i < 3; i++) {  		vdac->over = bg_RGB[i];		MachEmptyWriteBuffer();	}	vdac->overWA = 0x08;	MachEmptyWriteBuffer();	vdac->over = 0x00;	MachEmptyWriteBuffer();	vdac->over = 0x00;	MachEmptyWriteBuffer();	vdac->over = 0x7f;	MachEmptyWriteBuffer();	vdac->overWA = 0x0c;	MachEmptyWriteBuffer();	for (i = 0; i < 3; i++) {		vdac->over = fg_RGB[i];		MachEmptyWriteBuffer();	}}/* * ---------------------------------------------------------------------------- * * pmCursorColor -- * *	Set the color of the cursor. * * Results: *	None. * * Side effects: *	None. * * ---------------------------------------------------------------------------- */static voidpmCursorColor(color)	unsigned int color[];{	register int i, j;	for (i = 0; i < 3; i++)		bg_RGB[i] = (u_char)(color[i] >> 8);	for (i = 3, j = 0; i < 6; i++, j++)		fg_RGB[j] = (u_char)(color[i] >> 8);	pmRestoreCursorColor();}/* * ---------------------------------------------------------------------------- * * pmInitColorMap -- * *	Initialize the color map. * * Results: *	None. * * Side effects: *	The colormap is initialized appropriately whether it is color or  *	monochrome. * * ---------------------------------------------------------------------------- */static voidpmInitColorMap(){	register VDACRegs *vdac = (VDACRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);	struct pmax_fb *fp = &pmfb;	register int i;	*(volatile char *)MACH_PHYS_TO_UNCACHED(KN01_PHYS_COLMASK_START) = 0xff;	MachEmptyWriteBuffer();	if (fp->isMono) {		vdac->mapWA = 0; MachEmptyWriteBuffer();		for (i = 0; i < 256; i++) {			vdac->map = (i < 128) ? 0x00 : 0xff;			MachEmptyWriteBuffer();			vdac->map = (i < 128) ? 0x00 : 0xff;			MachEmptyWriteBuffer();			vdac->map = (i < 128) ? 0x00 : 0xff;			MachEmptyWriteBuffer();		}	} else {		vdac->mapWA = 0; MachEmptyWriteBuffer();		vdac->map = 0; MachEmptyWriteBuffer();		vdac->map = 0; MachEmptyWriteBuffer();		vdac->map = 0; MachEmptyWriteBuffer();		for (i = 1; i < 256; i++) {			vdac->map = 0xff; MachEmptyWriteBuffer();			vdac->map = 0xff; MachEmptyWriteBuffer();			vdac->map = 0xff; MachEmptyWriteBuffer();		}	}	for (i = 0; i < 3; i++) {		bg_RGB[i] = 0x00;		fg_RGB[i] = 0xff;	}	pmRestoreCursorColor();}/* * ---------------------------------------------------------------------------- * * pmVDACInit -- * *	Initialize the VDAC. * * Results: *	None. * * Side effects: *	None. * * ---------------------------------------------------------------------------- */static voidpmVDACInit(){	register VDACRegs *vdac = (VDACRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);	/*	 *	 * Initialize the VDAC	 */	vdac->overWA = 0x04; MachEmptyWriteBuffer();	vdac->over = 0x00; MachEmptyWriteBuffer();	vdac->over = 0x00; MachEmptyWriteBuffer();	vdac->over = 0x00; MachEmptyWriteBuffer();	vdac->overWA = 0x08; MachEmptyWriteBuffer();	vdac->over = 0x00; MachEmptyWriteBuffer();	vdac->over = 0x00; MachEmptyWriteBuffer();	vdac->over = 0x7f; MachEmptyWriteBuffer();	vdac->overWA = 0x0c; MachEmptyWriteBuffer();	vdac->over = 0xff; MachEmptyWriteBuffer();	vdac->over = 0xff; MachEmptyWriteBuffer();	vdac->over = 0xff; MachEmptyWriteBuffer();}/* * ---------------------------------------------------------------------------- * * pmLoadColorMap -- * *	Load the color map. * * Results: *	None. * * Side effects: *	The color map is loaded. * * ---------------------------------------------------------------------------- */static voidpmLoadColorMap(ptr)	ColorMap *ptr;{	register VDACRegs *vdac = (VDACRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_VDAC);	if (ptr->index > 256)		return;	vdac->mapWA = ptr->index; MachEmptyWriteBuffer();	vdac->map = ptr->Entry.red; MachEmptyWriteBuffer();	vdac->map = ptr->Entry.green; MachEmptyWriteBuffer();	vdac->map = ptr->Entry.blue; MachEmptyWriteBuffer();}/* *---------------------------------------------------------------------- * * pmPosCursor -- * *	Postion the cursor. * * Results: *	None. * * Side effects: *	None. * *---------------------------------------------------------------------- */voidpmPosCursor(x, y)	register int x, y;{	register PCCRegs *pcc = (PCCRegs *)MACH_PHYS_TO_UNCACHED(KN01_SYS_PCC);	register struct pmax_fb *fp = &pmfb;	if (y < fp->fbu->scrInfo.min_cur_y || y > fp->fbu->scrInfo.max_cur_y)		y = fp->fbu->scrInfo.max_cur_y;	if (x < fp->fbu->scrInfo.min_cur_x || x > fp->fbu->scrInfo.max_cur_x)		x = fp->fbu->scrInfo.max_cur_x;	fp->fbu->scrInfo.cursor.x = x;		/* keep track of real cursor */	fp->fbu->scrInfo.cursor.y = y;		/* position, indep. of mouse */	pcc->xpos = PCC_X_OFFSET + x;	pcc->ypos = PCC_Y_OFFSET + y;}/* * pm keyboard and mouse input. Just punt to the generic ones in fb.c */voidpmKbdEvent(ch)	int ch;{	fbKbdEvent(ch, &pmfb);}voidpmMouseEvent(newRepPtr)	MouseReport *newRepPtr;{	fbMouseEvent(newRepPtr, &pmfb);}voidpmMouseButtons(newRepPtr)	MouseReport *newRepPtr;{	fbMouseButtons(newRepPtr, &pmfb);}#endif /* NDC */#endif /* NPM */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -