From 9f6d7dba8befa8b13fa8b7ece6e83bca9b0c16af Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Mon, 13 Jan 2025 22:29:19 +0800 Subject: [PATCH] todomapper --- .../Assets/VirtualNes.Core/Mapper/MMC3.cs | 401 ++++++++++++++++++ .../VirtualNes.Core/Mapper/MMC3.cs.meta | 2 + .../Assets/VirtualNes.Core/Mapper/Mapper.cs | 1 + .../VirtualNes.Core/Mapper/Mapper020.cs | 98 +++++ .../VirtualNes.Core/Mapper/Mapper020.cs.meta | 2 + .../VirtualNes.Core/Mapper/MapperFk23c.cs | 15 + .../Mapper/MapperFk23c.cs.meta | 2 + .../VirtualNes.Core/Mapper/UnifMapper.cs | 253 +++++++++++ .../VirtualNes.Core/Mapper/UnifMapper.cs.meta | 2 + 9 files changed, 776 insertions(+) create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs create mode 100644 AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs new file mode 100644 index 00000000..3ffdd6ae --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs @@ -0,0 +1,401 @@ +//MMC3.h + + +//////////////////////////////////////////////////////////////////////////// +//// Nintendo MMC3 // +//////////////////////////////////////////////////////////////////////////// +//class MMC3 : public Mapper +//{ +//public: +// MMC3( NES* parent ); +// //virtual ~MMC3(); + +// // For state save +// BOOL IsStateSave() { return TRUE; } +// void SaveState( LPBYTE p ); +// void LoadState( LPBYTE p ); + + +// void Reset(); + +// void Write( WORD addr, BYTE data ); +// void HSync( INT scanline ); + +// ////////////////////////////////////////////////////////////////////////// +// // MMC3 +// ////////////////////////////////////////////////////////////////////////// +// unsigned int count; +// unsigned int latch; +// unsigned int reload; +// unsigned int enabled; + +// unsigned int ctrl0; +// unsigned int ctrl1; + +// unsigned int chr[8]; +// unsigned int prg[4]; + +// //Memory Write 8000~FFFF +// //void Mmc3_MemoryWrite(uint32 address, uint8 data); +// void Poke_Mmc3_8000(uint32 address,uint8 data); +// void Poke_Mmc3_8001(uint32 address,uint8 data); +// void Poke_Mmc3_A000(uint32 address,uint8 data); +// void Poke_Mmc3_A001(uint32 address,uint8 data); +// void Poke_Mmc3_C000(uint32 address,uint8 data); +// void Poke_Mmc3_C001(uint32 address,uint8 data); +// void Poke_Mmc3_E000(uint32 address,uint8 data); +// void Poke_Mmc3_E001(uint32 address,uint8 data); +// void Poke_Nop(uint32,uint8); + +// //³õʼ»¯Mmc3º¯ÊýÖ¸Õë +// //void Mmc3_Init(); +// //void Mmc3_Reset(); +// void Mmc3_UpdatePrg(); +// void Mmc3_UpdateChr(); +// void Mmc3_UpdatePrg2p(unsigned int addr,unsigned int bank); +// void Mmc3_UpdateChr2p(unsigned int addr,unsigned int bank); +// unsigned int Mmc3_GetChrSource(unsigned int); +// void Mmc3_HSync(uint32 scanline); + +// void Mmc3_SwapChr1K(uint8 page,uint32 bank); +// void Mmc3_SwapChr2K(uint8 page,uint32 bank); + +// void (MMC3::*UpdateChr)(unsigned int,unsigned int); +// void (MMC3::*UpdatePrg)(unsigned int,unsigned int); +// unsigned int (MMC3::*GetChrSource)(unsigned int); + +// void (MMC3::*Poke_8000)(uint32 address,uint8 data); +// void (MMC3::*Poke_8001)(uint32 address,uint8 data); +// void (MMC3::*Poke_A000)(uint32 address,uint8 data); +// void (MMC3::*Poke_A001)(uint32 address,uint8 data); +// void (MMC3::*Poke_C000)(uint32 address,uint8 data); +// void (MMC3::*Poke_C001)(uint32 address,uint8 data); +// void (MMC3::*Poke_E000)(uint32 address,uint8 data); +// void (MMC3::*Poke_E001)(uint32 address,uint8 data); +//};////////////////////////////////////////////////////////////////////////// +//// Nintendo MMC3 // +//////////////////////////////////////////////////////////////////////////// +//class MMC3 : public Mapper +//{ +//public: +// MMC3( NES* parent ); +// //virtual ~MMC3(); + +// // For state save +// BOOL IsStateSave() { return TRUE; } +// void SaveState( LPBYTE p ); +// void LoadState( LPBYTE p ); + + +// void Reset(); + +// void Write( WORD addr, BYTE data ); +// void HSync( INT scanline ); + +// ////////////////////////////////////////////////////////////////////////// +// // MMC3 +// ////////////////////////////////////////////////////////////////////////// +// unsigned int count; +// unsigned int latch; +// unsigned int reload; +// unsigned int enabled; + +// unsigned int ctrl0; +// unsigned int ctrl1; + +// unsigned int chr[8]; +// unsigned int prg[4]; + +// //Memory Write 8000~FFFF +// //void Mmc3_MemoryWrite(uint32 address, uint8 data); +// void Poke_Mmc3_8000(uint32 address,uint8 data); +// void Poke_Mmc3_8001(uint32 address,uint8 data); +// void Poke_Mmc3_A000(uint32 address,uint8 data); +// void Poke_Mmc3_A001(uint32 address,uint8 data); +// void Poke_Mmc3_C000(uint32 address,uint8 data); +// void Poke_Mmc3_C001(uint32 address,uint8 data); +// void Poke_Mmc3_E000(uint32 address,uint8 data); +// void Poke_Mmc3_E001(uint32 address,uint8 data); +// void Poke_Nop(uint32,uint8); + +// //³õʼ»¯Mmc3º¯ÊýÖ¸Õë +// //void Mmc3_Init(); +// //void Mmc3_Reset(); +// void Mmc3_UpdatePrg(); +// void Mmc3_UpdateChr(); +// void Mmc3_UpdatePrg2p(unsigned int addr,unsigned int bank); +// void Mmc3_UpdateChr2p(unsigned int addr,unsigned int bank); +// unsigned int Mmc3_GetChrSource(unsigned int); +// void Mmc3_HSync(uint32 scanline); + +// void Mmc3_SwapChr1K(uint8 page,uint32 bank); +// void Mmc3_SwapChr2K(uint8 page,uint32 bank); + +// void (MMC3::*UpdateChr)(unsigned int,unsigned int); +// void (MMC3::*UpdatePrg)(unsigned int,unsigned int); +// unsigned int (MMC3::*GetChrSource)(unsigned int); + +// void (MMC3::*Poke_8000)(uint32 address,uint8 data); +// void (MMC3::*Poke_8001)(uint32 address,uint8 data); +// void (MMC3::*Poke_A000)(uint32 address,uint8 data); +// void (MMC3::*Poke_A001)(uint32 address,uint8 data); +// void (MMC3::*Poke_C000)(uint32 address,uint8 data); +// void (MMC3::*Poke_C001)(uint32 address,uint8 data); +// void (MMC3::*Poke_E000)(uint32 address,uint8 data); +// void (MMC3::*Poke_E001)(uint32 address,uint8 data); +//}; + + + + +//MMC3.cpp + + +//////////////////////////////////////////////////////////////////////////// +//// Nintendo MMC3 // +//////////////////////////////////////////////////////////////////////////// +//using System.Net; +//using System; +//using Unity.Android.Gradle.Manifest; +//using VirtualNes.Core; + +//MMC3::MMC3(NES * parent) : Mapper(parent) +//{ +// UpdateChr = &MMC3::Mmc3_UpdateChr2p; +// UpdatePrg = &MMC3::Mmc3_UpdatePrg2p; +// GetChrSource = &MMC3::Mmc3_GetChrSource; + +// Poke_8000 = &MMC3::Poke_Mmc3_8000; +// Poke_8001 = &MMC3::Poke_Mmc3_8001; +// Poke_A000 = &MMC3::Poke_Mmc3_A000; +// Poke_A001 = &MMC3::Poke_Mmc3_A001; +// Poke_C000 = &MMC3::Poke_Mmc3_C000; +// Poke_C001 = &MMC3::Poke_Mmc3_C001; +// Poke_E000 = &MMC3::Poke_Mmc3_E000; +// Poke_E001 = &MMC3::Poke_Mmc3_E001; +//} + +//void MMC3::Reset() +//{ +// int i; + +// ctrl0 = 0; +// ctrl1 = 0; + +// for (i = 0; i < 8; ++i) +// chr[i] = i; + +// prg[0] = 0x00; +// prg[1] = 0x01; +// prg[2] = 0x3E; +// prg[3] = 0x3F; + +// count = 0; +// latch = 0; +// reload = 0; +// enabled = 0; + +// Mmc3_UpdatePrg(); +// Mmc3_UpdateChr(); +//} + +//void MMC3::Write(WORD A, BYTE V) +//{ +// switch (A & 0xE001) +// { +// case 0x8000: (this->* Poke_8000)(A, V); break; +// case 0x8001: (this->* Poke_8001)(A, V); break; +// case 0xA000: (this->* Poke_A000)(A, V); break; +// case 0xA001: (this->* Poke_A001)(A, V); break; +// case 0xC000: (this->* Poke_C000)(A, V); break; +// case 0xC001: (this->* Poke_C001)(A, V); break; +// case 0xE000: (this->* Poke_E000)(A, V); break; +// case 0xE001: (this->* Poke_E001)(A, V); break; +// } +//} + +//void MMC3::Poke_Mmc3_8000(uint32 address, uint8 data) +//{ +// const unsigned int diff = ctrl0 ^ data; +// ctrl0 = data; + +// if (diff & 0x40) +// { +// const unsigned int v[2] = +// { +// prg[(data >> 5 & 0x2) ^ 0], +// prg[(data >> 5 & 0x2) ^ 2] +// }; + +// (this->* UpdatePrg)(0x0000, v[0]); +// (this->* UpdatePrg)(0x4000, v[1]); +// } + +// if (diff & 0x80) +// Mmc3_UpdateChr(); +//} +//void MMC3::Poke_Mmc3_8001(uint32 address, uint8 data) +//{ +// unsigned int addr = ctrl0 & 0x7; + +// if (addr < 6) +// { +// unsigned int base = ctrl0 << 5 & 0x1000; + +// if (addr < 2) +// { +// addr <<= 1; +// base |= addr << 10; +// (this->* UpdateChr)(base | 0x0000, (chr[addr + 0] = data & 0xFE)); +// (this->* UpdateChr)(base | 0x0400, (chr[addr + 1] = data | 0x01)); +// } +// else +// { +// (this->* UpdateChr)((base ^ 0x1000) | (addr - 2) << 10, (chr[addr + 2] = data)); +// } +// } +// else +// { +// (this->* UpdatePrg)((addr == 6) ? (ctrl0 << 8 & 0x4000) : 0x2000, (prg[addr - 6] = data & 0x3F)); +// } +//} +//void MMC3::Poke_Mmc3_A000(uint32 address, uint8 data) +//{ +// if (!nes->rom->Is4SCREEN()) +// { +// if (data & 0x01) +// SetVRAM_Mirror(VRAM_HMIRROR); +// else +// SetVRAM_Mirror(VRAM_VMIRROR); +// } +//} + +//void MMC3::Poke_Mmc3_A001(uint32 address, uint8 data) +//{ +// ctrl1 = data; +//} + +//////////////////////////////////////////////////////////////////////////// +//// MMC3 IRQ +//////////////////////////////////////////////////////////////////////////// +//void MMC3::Poke_Mmc3_C000(uint32 address, uint8 data) +//{ +// count = data; +// reload = 0; +//} +//void MMC3::Poke_Mmc3_C001(uint32 address, uint8 data) +//{ +// latch = data; +// reload = 0; +//} +//void MMC3::Poke_Mmc3_E000(uint32 address, uint8 data) +//{ +//enabled = 0; +//reload = 0; +// nes->cpu->ClrIRQ(IRQ_MAPPER); +//} +//void MMC3::Poke_Mmc3_E001(uint32 address, uint8 data) +//{ +// enabled = 1; +// reload = 0; +//} + +//void MMC3::HSync(int scanline) +////void MMC3::Mmc3_HSync(uint32 scanline) +//{ +// if ((scanline >= 0 && scanline <= 239)) +// { +// if (nes->ppu->IsDispON()) +// { +// if (enabled && !reload) +// { +// if (scanline == 0) +// { +// if (count) +// { +// count -= 1; +// } +// } +// if (!(count)) +// { +// reload = 0xFF; +// count = latch; +// nes->cpu->SetIRQ(IRQ_MAPPER); +// } +// count--; +// } +// } +// } +//} + +//void MMC3::Poke_Nop(uint32 addr, uint8 data) +//{ +// return; +//} + + + +//void MMC3::Mmc3_SwapChr1K(uint8 page, uint32 bank) +//{ +// if ((this->* GetChrSource)(bank)) +// { +// SetCRAM_1K_Bank(page, bank); +// } +// else +// { +// SetVROM_1K_Bank(page, bank); +// } +//} + +//void MMC3::Mmc3_SwapChr2K(uint8 page, uint32 bank) +//{ +// if ((this->* GetChrSource)(bank)) +// { +// SetCRAM_2K_Bank(page, bank); +// } +// else +// { +// SetVROM_2K_Bank(page, bank); +// } +//} + +//void MMC3::Mmc3_UpdatePrg2p(unsigned int addr, unsigned int bank) +//{ +// SetPROM_8K_Bank((addr >> 13) + 4, bank); +//} + +//void MMC3::Mmc3_UpdateChr2p(unsigned int addr, unsigned int bank) +//{ +// Mmc3_SwapChr1K(addr >> 10, bank); +//} + + +//void MMC3::Mmc3_UpdatePrg() +//{ +// const unsigned int x = ctrl0 >> 5 & 0x2; + +// (this->* UpdatePrg)(0x0000, prg[0 ^ x]); +// (this->* UpdatePrg)(0x2000, prg[1 ^ 0]); +// (this->* UpdatePrg)(0x4000, prg[2 ^ x]); +// (this->* UpdatePrg)(0x6000, prg[3 ^ 0]); +//} + +//void MMC3::Mmc3_UpdateChr() +//{ +// const unsigned int x = ctrl0 >> 5 & 0x4; +// unsigned int i = 0; +// for (i = 0; i < 8; ++i) +// (this->* UpdateChr)(i * 0x400, chr[i ^ x]); +//} + +//unsigned int MMC3::Mmc3_GetChrSource(unsigned int dummy){return 0;} + + +//void MMC3::SaveState(LPBYTE p) +//{ +// //ûдºÃ +//} +//void MMC3::LoadState(LPBYTE p) +//{ +// //ûдºÃ +//} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs.meta b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs.meta new file mode 100644 index 00000000..fa3a7c52 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MMC3.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0e50dbc25281282468ee112d349c4127 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper.cs index d0b32b40..bf38a2aa 100644 --- a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper.cs +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper.cs @@ -236,6 +236,7 @@ namespace VirtualNes.Core case 249: return new Mapper249(parent); case 251: return new Mapper251(parent); case 252: return new Mapper252(parent); + case 253: return new Mapper253(parent); case 254: return new Mapper254(parent); case 255: return new Mapper255(parent); diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs new file mode 100644 index 00000000..f6e09986 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs @@ -0,0 +1,98 @@ +//TODO VirituaNes097 / NES / Mapper / MapperFDS.cpp + +//////////////////////////////////////////////////////////////////////////// +//// Mapper020 Nintendo Disk System(FDS) // +//////////////////////////////////////////////////////////////////////////// +//using System; +//using Unity.Android.Gradle; +//using static VirtualNes.Core.CPU; +//using static VirtualNes.MMU; +//using BYTE = System.Byte; +//using INT = System.Int32; + + +//namespace VirtualNes.Core +//{ +// public class Mapper020 : Mapper +// { +// enum enum_1 +// { +// BLOCK_READY = 0, +// BLOCK_VOLUME_LABEL, +// BLOCK_FILE_AMOUNT, +// BLOCK_FILE_HEADER, +// BLOCK_FILE_DATA, +// }; +// enum enum_2 +// { +// SIZE_VOLUME_LABEL = 56, +// SIZE_FILE_AMOUNT = 2, +// SIZE_FILE_HEADER = 16, +// }; +// enum enum_3 +// { +// OFFSET_VOLUME_LABEL = 0, +// OFFSET_FILE_AMOUNT = 56, +// OFFSET_FILE_HEADER = 58, +// OFFSET_FILE_DATA = 74, +// }; + +// enum enum_4 +// { +// MECHANICAL_SOUND_BOOT = 0, +// MECHANICAL_SOUND_SEEKEND, +// MECHANICAL_SOUND_MOTOR_ON, +// MECHANICAL_SOUND_MOTOR_OFF, +// MECHANICAL_SOUND_ALLSTOP, +// }; + +// bool bDiskThrottle; +// bool DiskThrottleTime; + +// LPBYTE disk; +// LPBYTE disk_w; + +// INT irq_counter, irq_latch; // $4020-$4021 +// BYTE irq_enable, irq_repeat; // $4022 +// BYTE irq_occur; // IRQ発生時に0以外になる +// BYTE irq_transfer; // 割り込み転送フラグ + +// BYTE disk_enable; // Disk I/O enable +// BYTE sound_enable; // Sound I/O enable +// BYTE RW_start; // 読み書き可能になったらIRQ発生 +// BYTE RW_mode; // 読み書きモード +// BYTE disk_motor_mode; // ディスクモーター +// BYTE disk_eject; // ディスクカードの挿入/非挿入 +// BYTE drive_ready; // 読み書き中かどうか +// BYTE drive_reset; // ドライブリセット状態 + +// INT block_point; +// INT block_mode; +// INT size_file_data; +// INT file_amount; +// INT point; +// BYTE first_access; + +// BYTE disk_side; +// BYTE disk_mount_count; + +// BYTE irq_type; + +// // For mechanical sound +// BYTE sound_startup_flag; +// INT sound_startup_timer; +// INT sound_seekend_timer; +// public Mapper020(NES parent) : base(parent) +// { + + +// } + +// public override bool IsStateSave() +// { +// return true; +// } + +// override ma +// } +//} diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs.meta b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs.meta new file mode 100644 index 00000000..4cd56df1 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/Mapper020.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 18bba5ba2502bfd4394ce01de2fb331c \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs new file mode 100644 index 00000000..8edb6ec7 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs @@ -0,0 +1,15 @@ +////////////////////////////////////////////////////////////////////////// +// MapperFk23c WaiXing San Guo Zhi - Xiong Ba Tian Xia (C) // +////////////////////////////////////////////////////////////////////////// +namespace VirtualNes.Core +{ + public class _Mapper : Mapper + { + + public _Mapper(NES parent) : base(parent) { } + + public override void Reset() + { + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs.meta b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs.meta new file mode 100644 index 00000000..44c968cb --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/MapperFk23c.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ec2612a9819d1f34cb86820bc16cbcc8 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs new file mode 100644 index 00000000..c5c1d57c --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs @@ -0,0 +1,253 @@ +//using System; +//using Unity.Android.Gradle; +//using Unity.Android.Gradle.Manifest; +//using VirtualNes.Core; + +//namespace VirtualNes.Core +//{ + +// public class map0_3208cn : Mapper +// { +// public map0_3208cn(NES parent) : base(parent) { } +// //void map0_3208cn::Reset() +// public override void Reset() +// { +// SetPROM_32K_Bank(0); +// } + + +// //void map0_3208cn::Write(WORD addr, BYTE data) +// public override void Write(ushort addr, byte data) +// { +// //addr = 0x8000,Çл» PROM +// if (addr == 0x8032) +// SetPROM_32K_Bank(data); +// if (addr == 0x8416) +// SetPROM_16K_Bank(4, data); +// if (addr == 0x8616) +// SetPROM_16K_Bank(6, data); +// if (addr == 0x8408) +// SetPROM_8K_Bank(4, data); +// if (addr == 0x8508) +// SetPROM_8K_Bank(5, data); +// if (addr == 0x8608) +// SetPROM_8K_Bank(6, data); +// if (addr == 0x8708) +// SetPROM_8K_Bank(7, data); + +// //addr = 0x8001,Çл» VROM +// if (addr == 0x9008) +// SetVROM_8K_Bank(data); +// if (addr == 0x9004) +// SetVROM_4K_Bank(0, data); +// if (addr == 0x9404) +// SetVROM_4K_Bank(4, data); +// if (addr == 0x9001) +// SetVROM_1K_Bank(0, data); +// if (addr == 0x9101) +// SetVROM_1K_Bank(1, data); +// if (addr == 0x9201) +// SetVROM_1K_Bank(2, data); +// if (addr == 0x9301) +// SetVROM_1K_Bank(3, data); +// if (addr == 0x9401) +// SetVROM_1K_Bank(4, data); +// if (addr == 0x9501) +// SetVROM_1K_Bank(5, data); +// if (addr == 0x9601) +// SetVROM_1K_Bank(6, data); +// if (addr == 0x9701) +// SetVROM_1K_Bank(7, data); +// } +// } + +// public class GeniusMerioBros : Mapper +// { + +// public GeniusMerioBros(NES parent) : base(parent) { } +// //void GeniusMerioBros::Reset() +// public override void Reset() +// { +// SetPROM_32K_Bank(0); +// memcpy(WRAM, PROM + 0x2000 * 4, 0x800); +// } + +// //BYTE GeniusMerioBros::ReadLow(WORD A) +// public override byte ReadLow(ushort addr) +// { +// if (A >= 0x6000 && A <= 0x6FFF) +// { +// return CPU_MEM_BANK[0][A & 0x7FF]; +// } +// else if (A >= 0x7000 && A <= 0x7FFF) +// { +// return XRAM[A & 0x7FF]; +// } +// else +// return (BYTE)(A >> 8); + +// } +// //void GeniusMerioBros::WriteLow(WORD A, BYTE V) +// public override void WriteLow(ushort addr, byte data) +// { +// if (A >= 0x7000 && A <= 0x7FFF) +// { +// XRAM[A & 0x7FF] = V; +// } +// else +// if (A >= 0x6000 && A <= 0x6FFF) +// { +// CPU_MEM_BANK[A >> 13][A & 0x1FFF] = V; +// } +// } +// } + +// public class smb2j : Mapper +// { + +// BYTE prg, IRQa; +// WORD IRQCount; +// public smb2j(NES parent) : base(parent) { } +// //Super Mario Bros. 2j (Unl) [U][!] +// //void smb2j::Reset() +// public override void Reset() +// { +// prg = 0; + +// memcpy(MRAM, &PROMPTR[1][0x1000], 0x1000); +// SetPrg8r(1, 0x6000, 1); +// SetPROM_32K_Bank(prg); +// SetVROM_8K_Bank(0); +// SetVRAM_Mirror(VRAM_VMIRROR); +// IRQa = 0; +// IRQCount = 0; +// } + +// //void smb2j::Write(WORD A, BYTE V)// (0x4020,0xffff) +// public override void Write(ushort addr, byte data) +// { +// if (A == 0x4022) +// { +// prg = V & 1; +// SetPROM_32K_Bank(prg); +// } +// if (A == 0x4122) +// { +// IRQa = V; +// IRQCount = 0; +// nes->cpu->ClrIRQ(IRQ_MAPPER); +// } +// } + +// //void smb2j::WriteLow(WORD A, BYTE V) +// public override void WriteLow(ushort addr, byte data) +// { +// Write(A, V); +// } + +// //void smb2j::Clock(INT a) +// public override void Clock(int cycles) +// { +// if (IRQa) +// { +// IRQCount += a * 3; +// if ((IRQCount >> 12) == IRQa) +// nes->cpu->SetIRQ(IRQ_MAPPER); +// } +// } + +// //BYTE smb2j::ReadLow(WORD A) +// public override byte ReadLow(ushort addr) +// { +// if ((A >= 0x5000) && (A < 0x6000)) +// return MRAM[A - 0x5000]; +// return Mapper::ReadLow(A); +// } +// } + +// //public class smb2j : Mapper +// //{ + +// // WORD cmdreg; +// // BYTE invalid_data; +// // public smb2j(NES parent) : base(parent) { } + +// // void Reset(); +// // void SoftReset(); +// // void Write(WORD addr, BYTE data); +// // BYTE Read(WORD addr); +// // void Sync(void); +// //} + + +// //void Mapper8157::SoftReset() +// // { +// // cmdreg = 0x200; +// // invalid_data ^= 1; +// // Sync(); +// // } + +// // void Mapper8157::Sync(void) +// // { +// // SetPrg16r((cmdreg & 0x060) >> 5, 0x8000, (cmdreg & 0x01C) >> 2); +// // SetPrg16r((cmdreg & 0x060) >> 5, 0xC000, (cmdreg & 0x200) ? (PROM_16K_SIZE / 4 - 1) : 0); +// // SetVRAM_Mirror(((cmdreg & 2) >> 1) ^ 1); +// // } + +// // BYTE Mapper8157::Read(WORD A) +// // { +// // if (invalid_data && cmdreg & 0x100) +// // return 0xFF; +// // else +// // return Mapper::Read(A); +// // } + +// // void Mapper8157::Write(WORD A, BYTE V) +// // { +// // cmdreg = A; +// // Sync(); +// // } + + + + +// public class MapperT262 : Mapper +// { + +// uint16 addrreg; +// uint8 datareg; +// uint8 busy; +// public MapperT262(NES parent) : base(parent) { } + +// //void MapperT262::Reset() +// public override void Reset() +// { +// SetVROM_8K_Bank(0); +// busy = 0; +// addrreg = 0; +// datareg = 0; + +// uint16 base = ((addrreg & 0x60) >> 2) | ((addrreg & 0x100) >> 3); +// SetPROM_16K_Bank(0x8000 >> 13, (datareg & 7) | base); +// SetPROM_16K_Bank(0xC000 >> 13, 7 | base); +// SetVRAM_Mirror(((addrreg & 2) >> 1) ^ 1); +// } +// //void MapperT262::Write(WORD A, BYTE V) +// public override void Write(ushort addr, byte data) +// { +// if (busy || (A == 0x8000)) +// datareg = V; +// else +// { +// addrreg = A; +// busy = 1; +// } + +// uint16 base = ((addrreg & 0x60) >> 2) | ((addrreg & 0x100) >> 3); +// SetPROM_16K_Bank(0x8000 >> 13, (datareg & 7) | base); +// SetPROM_16K_Bank(0xC000 >> 13, 7 | base); +// SetVRAM_Mirror(((addrreg & 2) >> 1) ^ 1); +// } +// } +//} + diff --git a/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs.meta b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs.meta new file mode 100644 index 00000000..650adba1 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/VirtualNes.Core/Mapper/UnifMapper.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c022787531a02234dacffb16e9788d5f \ No newline at end of file