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

📄 menus.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * Copyright (C) 1996-2002 Supernar Systems, Ltd. All rights reserved.
 *
 * Redistribution  and  use  in source and  binary  forms, with or without
 * modification,  are permitted provided that the following conditions are
 * met:
 *
 * 1.  Redistributions  of  source code  must  retain  the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * 2.  Redistributions  in binary form  must reproduce the above copyright
 * notice,  this  list of conditions and  the  following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *
 * 3. The end-user documentation included with the redistribution, if any,
 * must include the following acknowledgment:
 *
 * "This product uses DOS/32 Advanced DOS Extender technology."
 *
 * Alternately,  this acknowledgment may appear in the software itself, if
 * and wherever such third-party acknowledgments normally appear.
 *
 * 4.  Products derived from this software  may not be called "DOS/32A" or
 * "DOS/32 Advanced".
 *
 * THIS  SOFTWARE AND DOCUMENTATION IS PROVIDED  "AS IS" AND ANY EXPRESSED
 * OR  IMPLIED  WARRANTIES,  INCLUDING, BUT  NOT  LIMITED  TO, THE IMPLIED
 * WARRANTIES  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN  NO  EVENT SHALL THE  AUTHORS  OR  COPYRIGHT HOLDERS BE
 * LIABLE  FOR  ANY DIRECT, INDIRECT,  INCIDENTAL,  SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT NOT  LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE  GOODS  OR  SERVICES;  LOSS OF  USE,  DATA,  OR  PROFITS; OR
 * BUSINESS  INTERRUPTION) HOWEVER CAUSED AND  ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE)  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */


void ShowMainMenu()
{
	SetColor(LIGHTWHITE);
	SetBackColor(BLUE);
	OpenWindow(2,35,10,42);
	SetColor(YELLOW);
	Print_At(2,38," Main Menu ");
	SetColor(LIGHTWHITE);

	Print_At( 3,37,"F1 -  Configure DOS/32A DPMI Kernel");
	Print_At( 4,37,"F2 -  Configure DOS/32A DOS Extender");
	Print_At( 5,37,"F3 -  Create Predefined Configuration");
	Print_At( 6,37,"F4 -  Restore Predefined Configuration");
	Print_At( 8,37,"F5 -  Restore Old Values");
	Print_At( 9,37,"F9 -  Discard Changes and Exit");
	Print_At(10,37,"F10 - Apply Changes and Exit");
}


/*--------------------------------------------------------------------------*/
void SelectMainMenu()
{
	do {
		ShowModified();
		ShowHelp(0,mainmenu_sel);
		ShowCursor(	mainmenu_ypos[mainmenu_sel],
				mainmenu_xpos[mainmenu_sel],
				mainmenu_xlen[mainmenu_sel]);
		GetKey();
		ShowCursor(	mainmenu_ypos[mainmenu_sel],
				mainmenu_xpos[mainmenu_sel],
				mainmenu_xlen[mainmenu_sel]);

		if(keycode==UP) mainmenu_sel--;
		if(keycode==DOWN) mainmenu_sel++;
		if(keycode==HOME) mainmenu_sel=0;
		if(keycode==END) mainmenu_sel=6;
		if(keycode==PAGEUP) mainmenu_sel=0;
		if(keycode==PAGEDOWN) mainmenu_sel=6;

		if(keycode==F1) { mainmenu_sel=0; break; }
		if(keycode==F2) { mainmenu_sel=1; break; }
		if(keycode==F3) { mainmenu_sel=2; break; }
		if(keycode==F4) { mainmenu_sel=3; break; }
		if(keycode==F5) { mainmenu_sel=4; break; }
		if(keycode==F6) { RestoreDefaults(); ClearConfigName(); ShowMemory(); }
		if(keycode==F7) { ValidateConfig(); ShowMemory(); }
		if(keycode==F8) { ShowMemReq(); ShowMemory(); }
		if(keycode==F9) { mainmenu_sel=5; break; }
		if(keycode==F10) { mainmenu_sel=6; break; }

		if(mainmenu_sel<0) mainmenu_sel=0;
		if(mainmenu_sel>6) mainmenu_sel=6;
	} while(keycode!=ESC && keycode!=ALT_X && keycode!=ENTER);
	if(keycode==ESC || keycode==ALT_X) AskExit();
}





/****************************************************************************/
void ShowKernelMenu()
{
	SetColor(LIGHTWHITE);
	SetBackColor(BLUE);
	OpenWindow(2,8,15,64);
	SetColor(YELLOW);
	Print_At(2,11," DPMI Kernel Configuration ");
	SetColor(LIGHTWHITE);

	Print_At( 3,10,"1)  VCPI/DPMI Detection Order ...................");
	Print_At( 4,10,"2)  Internal Exception Control .........................");
	Print_At( 5,10,"3)  VCPI SmartPage Allocation Mode .....................");
	Print_At( 6,10,"4)  VCPI+XMS Allocation Scheme .........................");
	Print_At( 7,10,"5)  Trap and Report Emulated IRQs ......................");
	Print_At( 8,10,"6)  Extended Memory Blocks Checking ....................");
	Print_At( 9,10,"7)  Ignore DOS/4G API Extension Calls ..................");
	Print_At(11,10,"Selectors:");
	Print_At(12,10,"Callbacks:");
	Print_At(13,10,"RMode Stacks:");
	Print_At(14,10,"PMode Stacks:");
	Print_At(11,40,"VCPI PageTables:");
	Print_At(12,40,"VCPI PhysTables:");
	Print_At(13,40,"RMode Stack Length:");
	Print_At(14,40,"PMode Stack Length:");
	Print_At(15,20,"Extended Memory:             (Bytes)");

	do {
		SelectKernelMenu();
		if(keycode!=ESC && keycode!=F1 && keycode!=F2) switch(kernelmenu_sel) {
			case 0:		id32.kernel_misc^=0x01; break;
			case 1:		id32.kernel_misc^=0x02; break;
			case 2:		id32.kernel_misc^=0x04; break;
			case 3:		id32.kernel_misc^=0x08; break;
			case 4:		id32.kernel_misc^=0x10; break;
			case 5:		id32.kernel_misc^=0x20; break;
			case 6:		id32.kernel_misc^=0x80; break;
			case 7:		id32.kernel_selectors=Input(11,29,6,id32.kernel_selectors); break;
			case 8:		id32.kernel_callbacks=Input(12,29,6,id32.kernel_callbacks); break;
			case 9:		id32.kernel_rmstacks=Input(13,29,6,id32.kernel_rmstacks); break;
			case 10:	id32.kernel_pmstacks=Input(14,29,6,id32.kernel_pmstacks); break;
			case 11:	id32.kernel_pagetables=Input(11,63,6,id32.kernel_pagetables); break;
			case 12:	id32.kernel_phystables=Input(12,63,6,id32.kernel_phystables); break;
			case 13:	id32.kernel_rmstacklen=Input(13,63,6,id32.kernel_rmstacklen); break;
			case 14:	id32.kernel_pmstacklen=Input(14,63,6,id32.kernel_pmstacklen); break;
			case 15:	if(hexmode==0) id32.kernel_maxextmem=Input(15,38,10,id32.kernel_maxextmem);
			 		else id32.kernel_maxextmem=Input(15,40,8,id32.kernel_maxextmem);
					break;
		}
	} while(keycode!=ESC && keycode!=F1 && keycode!=F2);
	CloseWindow();
}


/*--------------------------------------------------------------------------*/
void ShowKernelConfig()
{
	SetColor(LIGHTWHITE);
	SetBackColor(BLUE);

	if(id32.kernel_misc&0x01) Print_At(3,59," VCPI/DPMI");else Print_At(3,59," DPMI/VCPI");

	if(id32.kernel_misc&0x02) Print_At(4,65,". ON");else Print_At(4,65," OFF");

	if(id32.kernel_pagetables==0 && !(id32.kernel_misc&0x04)) { SetColor(LIGHTRED); SetBlink(1); }
	if(id32.kernel_misc&0x04) Print_At(5,65,". ON");else Print_At(5,65," OFF");
	SetColor(LIGHTWHITE); SetBlink(0);

	if(id32.kernel_misc&0x08) Print_At(6,65,". ON");else Print_At(6,65," OFF");

	if(id32.kernel_misc&0x10) Print_At(7,65,". ON");else Print_At(7,65," OFF");

	if(id32.kernel_misc&0x20) Print_At(8,65,". ON");else Print_At(8,65," OFF");

	if(id32.kernel_misc&0x80) Print_At(9,65,". ON");else Print_At(9,65," OFF");

	if(hexmode==0)
	{
		if(id32.kernel_selectors<16) SetColor(YELLOW);
		if(id32.kernel_selectors==0) { SetColor(LIGHTRED); SetBlink(1); }
		if(id32.kernel_selectors>8176) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(11,27,"%8d",id32.kernel_selectors);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_callbacks<8) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(12,27,"%8d",id32.kernel_callbacks);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_rmstacks<2) SetColor(YELLOW);
		if(id32.kernel_rmstacks==0) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(13,27,"%8d",id32.kernel_rmstacks);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_pmstacks<2) SetColor(YELLOW);
		if(id32.kernel_pmstacks==0) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(14,27,"%8d",id32.kernel_pmstacks);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_maxextmem>0x7FFFFFFF) Print_At(15,40,"     All");
		else if(id32.kernel_maxextmem==0) Print_At(15,40,"    None");
		else Print_At(15,38,"%10d",id32.kernel_maxextmem);

		if(id32.kernel_pagetables>64) SetColor(YELLOW);
		if(id32.kernel_pagetables==0 && !(id32.kernel_misc&0x04)) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(11,61,"%8d",id32.kernel_pagetables);
		SetColor(LIGHTWHITE); SetBlink(0);

		Print_At(12,61,"%8d",id32.kernel_phystables);

		if(id32.kernel_rmstacklen<0x10) SetColor(YELLOW);
		if(id32.kernel_rmstacklen==0) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(13,61,"%8d",id32.kernel_rmstacklen);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_pmstacklen<0x10) SetColor(YELLOW);
		if(id32.kernel_pmstacklen==0) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(14,61,"%8d",id32.kernel_pmstacklen);
		SetColor(LIGHTWHITE); SetBlink(0);

	}
	else
	{

		if(id32.kernel_selectors<16) SetColor(YELLOW);
		if(id32.kernel_selectors==0) { SetColor(LIGHTRED); SetBlink(1); }
		if(id32.kernel_selectors>8176) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(11,27,"%7Xh",id32.kernel_selectors);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_callbacks<8) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(12,27,"%7Xh",id32.kernel_callbacks);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_rmstacks<2) SetColor(YELLOW);
		if(id32.kernel_rmstacks==0) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(13,27,"%7Xh",id32.kernel_rmstacks);
		SetColor(LIGHTWHITE); SetBlink(0);

		if(id32.kernel_pmstacks<2) SetColor(YELLOW);
		if(id32.kernel_pmstacks==0) { SetColor(LIGHTRED); SetBlink(1); }
		Print_At(14,27,"%7Xh",id32.kernel_pmstacks);
		SetColor(LIGHTWHITE); SetBlink(0);

⌨️ 快捷键说明

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