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

📄 bmc_1992ballgames11in1.c

📁 一款游戏机的模拟器
💻 C
字号:
#include	"..\..\DLL\d_UNIF.h"

static	struct
{
	u8 Bank, Mode;
}	Mapper;

static	void	Sync (void)
{
	MP->SetCHR_RAM8(0,0);
	if (Mapper.Mode & 1)
		MP->SetPRG_ROM8(0x6,Mapper.Bank | 0x23);
	else	MP->SetPRG_ROM8(0x6,Mapper.Bank | 0x2F);
	if (Mapper.Mode == 2)
		MP->SetPRG_ROM16(0x8,(Mapper.Bank >> 1) | 1);
	else	MP->SetPRG_ROM16(0x8,Mapper.Bank >> 1);
	if (Mapper.Mode & 1)
		MP->SetPRG_ROM16(0xC,(Mapper.Bank >> 1) | 1);
	else	MP->SetPRG_ROM16(0xC,(Mapper.Bank >> 1) | 7);
	if (Mapper.Mode == 3)
		MP->Mirror_H();
	else	MP->Mirror_V();
}
/*
static	void	Sync (void)
{
	MP->SetCHR_RAM8(0,0);
	switch (Mapper.Mode)
	{
	case 0:	MP->Mirror_V();
		MP->SetPRG_ROM8(0x6,Mapper.Bank | 0x2C | 3);
		MP->SetPRG_ROM8(0x8,Mapper.Bank | 0x00 | 0);
		MP->SetPRG_ROM8(0xA,Mapper.Bank | 0x00 | 1);
		MP->SetPRG_ROM8(0xC,Mapper.Bank | 0x0C | 2);
		MP->SetPRG_ROM8(0xE,Mapper.Bank | 0x0C | 3);		break;
	case 1:	MP->Mirror_V();
		MP->SetPRG_ROM8(0x6,Mapper.Bank | 0x20 | 3);
		MP->SetPRG_ROM8(0x8,Mapper.Bank | 0x00 | 0);
		MP->SetPRG_ROM8(0xA,Mapper.Bank | 0x00 | 1);
		MP->SetPRG_ROM8(0xC,Mapper.Bank | 0x00 | 2);
		MP->SetPRG_ROM8(0xE,Mapper.Bank | 0x00 | 3);		break;
	case 2:	MP->Mirror_V();
		MP->SetPRG_ROM8(0x6,Mapper.Bank | 0x2E | 3);
		MP->SetPRG_ROM8(0x8,Mapper.Bank | 0x02 | 0);
		MP->SetPRG_ROM8(0xA,Mapper.Bank | 0x02 | 1);
		MP->SetPRG_ROM8(0xC,Mapper.Bank | 0x0E | 2);
		MP->SetPRG_ROM8(0xE,Mapper.Bank | 0x0E | 3);		break;
	case 3:	MP->Mirror_H();
		MP->SetPRG_ROM8(0x6,Mapper.Bank | 0x20 | 3);
		MP->SetPRG_ROM8(0x8,Mapper.Bank | 0x00 | 0);
		MP->SetPRG_ROM8(0xA,Mapper.Bank | 0x00 | 1);
		MP->SetPRG_ROM8(0xC,Mapper.Bank | 0x00 | 2);
		MP->SetPRG_ROM8(0xE,Mapper.Bank | 0x00 | 3);		break;
	}
}
*/
static	void	__cdecl	SaveMI (Ar128 MI)
{
	u8 x = 0;
	MI[x++] = Mapper.Bank;
	MI[x++] = Mapper.Mode;
}

static	void	__cdecl	LoadMI (const Ar128 MI)
{
	u8 x = 0;
	Mapper.Bank	= MI[x++];
	Mapper.Mode	= MI[x++];
	Sync();
}

static	void	__cdecl	Write67 (int Bank, int Where, int What)
{
	Mapper.Mode = ((What & 0x10) >> 3) | ((What & 0x02) >> 1);
	Sync();
}

static	void	__cdecl	Write89ABCDEF (int Bank, int Where, int What)
{
	Mapper.Bank = (What & 0xF) << 2;
	if (Bank & 0x4)
		Mapper.Mode = (Mapper.Mode & 0x1) | ((What & 0x10) >> 3);
	Sync();
}

static	void	__cdecl	InitMapper (const PMapperParam _MP, int IsHardReset)
{
	u8 x;

	MP = _MP;

	for (x = 0x6; x < 0x8; x++)
		MP->SetWriteHandler(x,Write67);
	for (x = 0x8; x <= 0xF; x++)
		MP->SetWriteHandler(x,Write89ABCDEF);

	Mapper.Bank = 0;
	Mapper.Mode = 1;
	Sync();
}

CTMapperInfo	MapperInfo_BMC_1992Ballgames11in1 =
{
	"BMC-1992Ballgames11in1",
	-1,
	MS_Full,
	8192,
	InitMapper,
	NULL,
	NULL,
	NULL,
	SaveMI,
	LoadMI,
	NULL,
	NULL
};

⌨️ 快捷键说明

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