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

📄 tu1_init.c

📁 小型操作系统,以VC为开发环境,需要boachs调试
💻 C
字号:
/***************************************************************************
**     File name   : tu1_init.c
**     Author      : x.cheng
**     Create date :
**
**	   Comment:
**        TUI Initialization routines...
**
**     Revisions:
**     $Log: tu1_init.c,v $
**     Revision 1.2  2005/07/30 06:15:51  x.cheng
**     after page enable, video memory 0xB8000 is map to 0xE00B8000, so, bug fix.
**
**     Revision 1.1.1.1  2005/07/27 06:53:15  x.cheng
**     add into repositories
**
**
***************************************************************************/
#include "const.h"
#include "type.h"
#include "stdarg.h"
#include "string.h"

#include "..\..\Inc\i386\io.h"
#include "..\..\Inc\i386\system.h"
#include "..\..\Inc\i386\map.h"
#include "..\..\Inc\i386\page.h"
#include "..\..\Inc\vga.h"
#include "..\..\Inc\tui.h"
#include "..\..\Inc\vmm.h"
#include "..\..\Inc\mts.h"
#include "..\..\Inc\debug.h"


#include "..\inc\def_tui.h"

/* debug preprocessor instrument
	#ifdef _DEBUG__
	#ifdef _DEBUG_TUI__
				
	#endif
	#endif	
***************************/

/*********************************************
 * global variable declaration
 *********************************************/
ts_Console g_astVirtualConsole[TOTAL_VIRTUAL_CONSOLE_NB+1];	//(console #0 is the special console).

int g_iCurrentConsoleIndex = 0;	//index of current console.

/************************************************************
*************************************************************
**      Function Name:			vTu1InitBootConsole
**      Author:                 x.cheng
**
**      Comment:
**			Initialize the special console #0 as the video memory buffer.
**
**      List of parameters:
**			no
**
**      Return value:   
**          no
**
**      Revisions:
**
*************************************************************
*************************************************************/
void vTu1InitBootConsole()
{
	g_astVirtualConsole[0].puiVideoBuffer = (unsigned short *)0xB8000;
	g_astVirtualConsole[0].uiCurrentPos = 0;
	g_astVirtualConsole[0].ucCurrentColor = DEFAULT_COLOR;

	vVgaConsoleClr(&g_astVirtualConsole[0]);
}

/************************************************************
*************************************************************
**      Function Name:			vTu1InitMainConsole
**      Author:                 x.cheng
**
**      Comment:
**			Initialize the special console #0 as the video memory buffer.
**
**      List of parameters:
**			va_list
**
**      Return value:   
**          no
**
**      Revisions:
**
*************************************************************
*************************************************************/
void vTu1InitMainConsole()
{
	g_astVirtualConsole[0].puiVideoBuffer = (unsigned short *)VIDEO_START_ADDRESS;
	g_astVirtualConsole[0].uiCurrentPos = 0;
	g_astVirtualConsole[0].ucCurrentColor = DEFAULT_COLOR;

	vVgaConsoleClr(&g_astVirtualConsole[0]);
}

/************************************************************
*************************************************************
**      Function Name:			vTu1CreateVirtualConsole
**      Author:                 x.cheng
**
**      Comment:
**			Allocate and initialize memory space for every virtual consoles.
**
**      List of parameters:
**			no
**
**      Return value:   
**          no
**			
**      Revisions:
**			Before you can run this procedure you have to initialize the
**		virtual memory manager.
*************************************************************
*************************************************************/
void vTu1CreateVirtualConsole()
{
	int i;
 
	// Initialize virtual consoles.
	for ( i = 1; i < (TOTAL_VIRTUAL_CONSOLE_NB+1); i++ )
	{
		g_astVirtualConsole[i].puiVideoBuffer = (unsigned short *)pvVmmKeMalloc( VIDEO_BUFFER_SIZE, GFP_KERNEL );
		memsetw(g_astVirtualConsole[i].puiVideoBuffer, 0, VIDEO_BUFFER_SIZE/2);
		g_astVirtualConsole[i].uiCurrentPos = 0;
		g_astVirtualConsole[i].ucCurrentColor = DEFAULT_COLOR;
	}
	// Copy the current video parameters into the first
	// virtual console.
	memcpy(g_astVirtualConsole[1].puiVideoBuffer, g_astVirtualConsole[0].puiVideoBuffer, VIDEO_BUFFER_SIZE);
	g_astVirtualConsole[1].uiCurrentPos = g_astVirtualConsole[0].uiCurrentPos;
	g_astVirtualConsole[1].ucCurrentColor = g_astVirtualConsole[0].ucCurrentColor;

	// Automatic switch to the first virtual console.
	g_iCurrentConsoleIndex = 1;
}

⌨️ 快捷键说明

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