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

📄 wndo1.c

📁 nucleus 文件系统,内核和彩色图形系统,在小系统上非常好用
💻 C
字号:
/*************************************************************************/
/*                                                                       */
/*         Copyright (c) 1997 - 1999 Accelerated Technology, Inc.        */
/*                                                                       */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the      */
/* subject matter of this material.  All manufacturing, reproduction,    */
/* use, and sales rights pertaining to this subject matter are governed  */
/* by the license agreement.  The recipient of this software implicitly  */
/* accepts the terms of the license.                                     */
/*                                                                       */
/*************************************************************************/

/*************************************************************************/
/*                                                                       */
/* FILE NAME                                            VERSION          */
/*                                                                       */
/*      WNDO1.c                                          1.9             */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      All                                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains the SetDisplay function.                      */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Robert G. Burrill, Accelerated Technology, Inc.                  */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*                                                                       */
/*************************************************************************/

#include "meta_wnd.h"
#include "metconst.h"    /* MetaWINDOW Constant & Stucture Definitions */
#include "metports.h"    /* MetaWINDOW Port & Bitmap Definitions */
#include "grafdata.h"
#include "devc.h"


/* Function SetDisplay enables the current ports grafMap to be displayed.

	PAGE specifies the associated display screens:
	bit	FEDCBA98 76543210
		-------- xxxxxxxx	page number
		-------x --------	0 = text page  1 = graphics page

When enabling the grafMap to display graphics, palette operations are
performed to set the first 16 color indexes to the EGA default and the
maximum color index to white. */
void SetDisplay(int argPAGE)
{
	argsPalInfo dmPalParam;
	short dmFunc;
	long dmParam;
	long dmPage;
	grafMap *currentPortMap;
	int colors;
	short grafErrValue;

	currentPortMap = thePort->portMap;	/* get the current ports grafmap */
	dmPage = argPAGE & 0xff;	/* get page number only */

	if (argPAGE & 0x0100)	/* text or graphics? */
	{	/* set graphics mode */
		/* are we already in graphics mode? */
		if ((currentPortMap->mapFlags & mfDspGraf) == 0)
		{	/* no, set it */
			dmFunc = DMGRAFIX;	/* devMgr set graphics function */
			dmParam = 0;
			/* call the device manager */
			currentPortMap->mapDevMgr(currentPortMap, dmFunc, dmParam);

			/* set grafMaps display status bit to indicate 'in graphics mode' */
			currentPortMap->mapFlags |= mfDspGraf;

			/* set default palette */
			dmPalParam.palNum = 0;
			dmPalParam.palBgn = 0;
			dmPalParam.palEnd = 15;
			dmPalParam.palDataPtr = (palData *) &DefPal[0][0];

			/* call the device manager with write palette function */
			currentPortMap->mapDevMgr(currentPortMap, DMWPAL, &dmPalParam);

			/* set max color to white */
			if (currentPortMap->pixPlanes <= 1)
			{
				colors = (1 << currentPortMap->pixBits) - 1;
			}
			else
			{
				colors = (1 << currentPortMap->pixPlanes) - 1;
			}

			dmPalParam.palBgn = colors;
			dmPalParam.palEnd = colors;
			dmPalParam.palDataPtr = (palData *) &PalWhite;
			currentPortMap->mapDevMgr(currentPortMap, DMWPAL, &dmPalParam);

			/* do we also need to flip the page? */
			if (dmPage == 0) return; /* no if page = 0? */
		}

		/* flip to requested page */
		dmFunc = DMFLIP;
		dmParam = dmPage;
		if (currentPortMap->mapDevMgr(currentPortMap, dmFunc, dmParam))
		{	/* error if here */
			grafErrValue = c_SetDispl + c_InvDevFunc;
			nuGrafErr(grafErrValue);
		}
		
		return;
	}

	/* set text mode */
	dmFunc = DMTEXT;
	dmParam = dmPage;
	currentPortMap->mapDevMgr(currentPortMap, dmFunc, dmParam);

	/* clear grafMaps display status bit to indicate 'in text mode' */
	currentPortMap->mapFlags &= ~mfDspGraf;

	/* done if not a banked device */
	if (!(currentPortMap->mapFlags & mfBankMgr)) return;

	/* invalidate bank (no active bank) */
	currentPortMap->mapWinYmin[0] = -1;
	currentPortMap->mapWinYmin[1] = -1;
	currentPortMap->mapWinYmax[0] = -1;
	currentPortMap->mapWinYmax[1] = -1;

	return;
}

⌨️ 快捷键说明

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