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

📄 pm.c

📁 BIOS emulator and interface to Realmode X86 Emulator Library Can emulate a PCI Graphic Controller V
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************					SciTech OS Portability Manager Library**  ========================================================================**    The contents of this file are subject to the SciTech MGL Public*    License Version 1.0 (the "License"); you may not use this file*    except in compliance with the License. You may obtain a copy of*    the License at http://www.scitechsoft.com/mgl-license.txt**    Software distributed under the License is distributed on an*    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or*    implied. See the License for the specific language governing*    rights and limitations under the License.**    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.**    The Initial Developer of the Original Code is SciTech Software, Inc.*    All Rights Reserved.**  ========================================================================** Language:		ANSI C* Environment:	RTTarget-32** Description:	Implementation for the OS Portability Manager Library, which*				contains functions to implement OS specific services in a*				generic, cross platform API. Porting the OS Portability*				Manager library is the first step to porting any SciTech*				products to a new platform.*****************************************************************************/#include "pmapi.h"#include "drvlib/os/os.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#define	WIN32_LEAN_AND_MEAN#define	STRICT#include <windows.h>#include <mmsystem.h>#ifdef	__BORLANDC__#pragma	warn -par#endif/*--------------------------- Global variables ----------------------------*/static void 	(PMAPIP fatalErrorCleanup)(void) = NULL;/*----------------------------- Implementation ----------------------------*/void MTRR_init(void);/****************************************************************************REMARKS:Initialise the PM library.****************************************************************************/void PMAPI PM_init(void){	// TODO: dO any special init code in here.	MTRR_init();}/****************************************************************************REMARKS:Return the operating system type identifier.****************************************************************************/long PMAPI PM_getOSType(void){	return _OS_RTTARGET;}/****************************************************************************REMARKS:Return the runtime type identifier.****************************************************************************/int PMAPI PM_getModeType(void){	return PM_386;}/****************************************************************************REMARKS:Add a file directory separator to the end of the filename.****************************************************************************/void PMAPI PM_backslash(	char *s){	uint pos = strlen(s);	if (s[pos-1] != '\\') {		s[pos] = '\\';		s[pos+1] = '\0';		}}/****************************************************************************REMARKS:Add a user defined PM_fatalError cleanup function.****************************************************************************/void PMAPI PM_setFatalErrorCleanup(	void (PMAPIP cleanup)(void)){	fatalErrorCleanup = cleanup;}/****************************************************************************REMARKS:Report a fatal error condition and halt the program.****************************************************************************/void PMAPI PM_fatalError(	const char *msg){	if (fatalErrorCleanup)		fatalErrorCleanup();	// TODO: Display a fatal error message and exit!//	MessageBox(NULL,msg,"Fatal Error!", MB_ICONEXCLAMATION);	exit(1);}/****************************************************************************REMARKS:Allocate the real mode VESA transfer buffer for communicating with the BIOS.****************************************************************************/void * PMAPI PM_getVESABuf(	uint *len,	uint *rseg,	uint *roff){	/* No BIOS access for the RTTarget */	return NULL;}/****************************************************************************REMARKS:Check if a key has been pressed.****************************************************************************/int	PMAPI PM_kbhit(void){	// TODO: Need to check if a key is waiting on the keyboard queue	return true;}/****************************************************************************REMARKS:Wait for and return the next keypress.****************************************************************************/int	PMAPI PM_getch(void){	// TODO: Need to obtain the next keypress, and block until one is hit	return 0xD;}/****************************************************************************REMARKS:Set the location of the OS console cursor.****************************************************************************/void PM_setOSCursorLocation(	int x,	int y){	/* Nothing to do for RTTarget-32 */}/****************************************************************************REMARKS:Set the width of the OS console.****************************************************************************/void PM_setOSScreenWidth(	int width,	int height){	/* Nothing to do for RTTarget-32 */}/****************************************************************************REMARKS:Set the real time clock handler (used for software stereo modes).****************************************************************************/ibool PMAPI PM_setRealTimeClockHandler(	PM_intHandler ih,	int frequency){	/* Not supported for RTTarget-32 */	return false;}/****************************************************************************REMARKS:Set the real time clock frequency (for stereo modes).****************************************************************************/void PMAPI PM_setRealTimeClockFrequency(	int frequency){	/* Not supported under RTTarget-32 */}/****************************************************************************REMARKS:Restore the original real time clock handler.****************************************************************************/void PMAPI PM_restoreRealTimeClockHandler(void){	/* Not supported under RTTarget-32 */}/****************************************************************************REMARKS:Return the current operating system path or working directory.****************************************************************************/const char * PMAPI PM_getCurrentPath(void){	static char cwd[256];	GetCurrentDirectory(sizeof(cwd),cwd);	return cwd;}/****************************************************************************REMARKS:Return the drive letter for the boot drive.****************************************************************************/char PMAPI PM_getBootDrive(void){	return 'c';}/****************************************************************************REMARKS:Return the path to the VBE/AF driver files.****************************************************************************/const char * PMAPI PM_getVBEAFPath(void){	return "c:\\";}/****************************************************************************REMARKS:Return the path to the Nucleus driver files.****************************************************************************/const char * PMAPI PM_getNucleusPath(void){	// TODO: Point this at the path when the Nucleus drivers will be found	return "c:\\nucleus";}/****************************************************************************REMARKS:Return the path to the Nucleus configuration files.****************************************************************************/const char * PMAPI PM_getNucleusConfigPath(void){	static char path[256];	strcpy(path,PM_getNucleusPath());	PM_backslash(path);	strcat(path,"config");	return path;}/****************************************************************************REMARKS:Return a unique identifier for the machine if possible.****************************************************************************/const char * PMAPI PM_getUniqueID(void){	return PM_getMachineName();}/****************************************************************************REMARKS:Get the name of the machine on the network.****************************************************************************/const char * PMAPI PM_getMachineName(void){	/* Not necessary for RTTarget-32 */	return "Unknown";}/****************************************************************************REMARKS:Return a pointer to the real mode BIOS data area.****************************************************************************/void * PMAPI PM_getBIOSPointer(void){	/* Not used for RTTarget-32 */	return NULL;}/****************************************************************************REMARKS:Return a pointer to 0xA0000 physical VGA graphics framebuffer.****************************************************************************/void * PMAPI PM_getA0000Pointer(void){	static void *bankPtr;	if (!bankPtr)		bankPtr = PM_mapPhysicalAddr(0xA0000,0xFFFF,true);

⌨️ 快捷键说明

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