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

📄 romtype.cpp

📁 PC燒錄BIOS的源程序
💻 CPP
字号:
#include <stdio.h>
#include "ROMType.h"
#include "Tools.h"

void ROMType( PFLASHCHIPINFO pMyFlash, LONGINT ROMBase, LONGINT* XMSBlockLeft, LONGINT* XMSBlockPos, LONGINT* FlashSize, LONGINT* FlashBase, LONGINT* MaxBlock, LONGINT* OldBIOS, LONGINT* NewBIOS, LONGINT* TempBuf)
{
	int X;

	*FlashSize = LONGINT( pMyFlash->Size ) << 10;
	*FlashBase = ROMBase;

	switch ( pMyFlash->Flags & 3 )
	{
		case 0:
			*MaxBlock = 0;
			for( X = 0; X <= 4; X++ )
			{
				if ( pMyFlash->Sectors[X][0] == 0 )
				{
					break;
				}
				if ( pMyFlash->Sectors[X][1] > *MaxBlock )
				{
					*MaxBlock = pMyFlash->Sectors[X][1];
				}
			}
			*MaxBlock = ( *MaxBlock + 1 ) << 7;
		   break;
		case 1:
		case 3:
			*MaxBlock = pMyFlash->PgSize;
			break;
		case 2:
			*MaxBlock = *FlashSize;
			break;
		default:
			;
	}

	//{Allocate 2 buffers for BIOS images}
	*OldBIOS = AllocLinearBlock( *FlashSize, XMSBlockLeft, XMSBlockPos );
	*NewBIOS = AllocLinearBlock( *FlashSize, XMSBlockLeft, XMSBlockPos );
	//{Allocate temp page/sector buffer}
	*TempBuf = AllocLinearBlock( *MaxBlock, XMSBlockLeft, XMSBlockPos );

	if (( *OldBIOS == 0 ) || ( *NewBIOS == 0 ) || ( *TempBuf == 0 ))
	{
		printf("Allocate buffers: OldBIOS, NewBIOS and TempBuf error!");
	}
}

⌨️ 快捷键说明

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