nes-fix mapper 088

This commit is contained in:
zeromus 2012-07-15 22:22:57 +00:00
parent f62607dea9
commit a33859fc1e
4 changed files with 77 additions and 121 deletions

View File

@ -179,10 +179,10 @@
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\TxROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\DRROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper076.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper088.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper095.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Mapper206.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Namcot1xx.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Namcot1xx\Namcot3443.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\NAMCOT_m19_m210.cs">
<SubType>Code</SubType>
</Compile>

View File

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
/*
Example Games:
--------------------------
Quinty (J)
Namcot Mahjong 3
Dragon Spirit - Aratanaru Densetsu
This is the same as Mapper206, with the following exception:
CHR support is increased to 128KB by connecting PPU's A12 line to the CHR ROM's A16 line.
For example, masking the CHR ROM address output from the mapper by $FFFF, and then OR it with $10000 if the PPU address was >= $1000.
Consequently, CHR is split into two halves. $0xxx can only have CHR from the first 64K, $1xxx can only have CHR from the second 64K.
*/
class Mapper088 : Namcot108Board_Base
{
//configuration
int chr_byte_mask;
public override bool Configure(NES.EDetectionOrigin origin)
{
//analyze board type
switch (Cart.board_type)
{
case "NAMCOT-3443":
case "NAMCOT-3433": //TODO: just a guess, find a ROM with this
case "MAPPER088":
break;
default:
return false;
}
BaseSetup();
SetMirrorType(EMirrorType.Vertical);
chr_byte_mask = (Cart.chr_size*1024) - 1;
return true;
}
int RewireCHR(int addr)
{
int chrrom_addr = base.MapCHR(addr);
chrrom_addr &= 0xFFFF;
if (addr >= 0x1000)
chrrom_addr |= 0x10000;
chrrom_addr &= chr_byte_mask;
return chrrom_addr;
}
public override byte ReadPPU(int addr)
{
//if (addr < 0x2000) return VROM[Get_CHRBank_1K(addr)];
if (addr < 0x2000) return VROM[RewireCHR(addr)];
else return base.ReadPPU(addr);
}
public override void WritePPU(int addr, byte value)
{
if (addr < 0x2000) { }
else base.WritePPU(addr, value);
}
}
}

View File

@ -103,7 +103,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
protected Namcot108Chip mapper;
//configuration
protected int prg_mask, chr_mask;
protected int prg_mask, chr_byte_mask;
public override void Dispose()
{
@ -129,7 +129,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
protected int MapCHR(int addr)
{
int bank_1k = Get_CHRBank_1K(addr);
bank_1k &= chr_mask;
addr = (bank_1k << 10) | (addr & 0x3FF);
return addr;
}
@ -140,7 +139,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
addr = MapCHR(addr);
if (VROM != null)
{
addr &= chr_byte_mask;
return VROM[addr];
}
else return VRAM[addr];
}
else return base.ReadPPU(addr);
@ -177,7 +179,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
prg_mask = num_prg_banks - 1;
int num_chr_banks = (Cart.chr_size);
chr_mask = num_chr_banks - 1;
chr_byte_mask = (num_chr_banks*1024) - 1;
mapper = new Namcot108Chip(this);
SetMirrorType(EMirrorType.Vertical);

View File

@ -1,117 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
/*
Here are Disch's original notes:
========================
= Mapper 088 =
========================
Example Games:
--------------------------
Quinty (J)
Namcot Mahjong 3
Dragon Spirit - Aratanaru Densetsu
Registers:
---------------------------
Range,Mask: $8000-FFFF, $8001
$8000: [.... .AAA] Address for use with $8001
$8001: [DDDD DDDD]
Data port:
R:0 -> CHR reg 0
R:1 -> CHR reg 1
R:2 -> CHR reg 2
R:3 -> CHR reg 3
R:4 -> CHR reg 4
R:5 -> CHR reg 5
R:6 -> PRG reg 0
R:7 -> PRG reg 1
CHR Setup:
---------------------------
CHR is split into two halves. $0xxx can only have CHR from the first 64k, $1xxx can only have CHR from the
second 64k.
*
$0000 $0400 $0800 $0C00 $1000 $1400 $1800 $1C00
+---------------+---------------+-------+-------+-------+-------+
| <R:0> | <R:1> | R:2 | R:3 | R:4 | R:5 |
+---------------+---------------+-------+-------+-------+-------+
| | |
| AND written values with $3F | OR written values with $40 |
PRG Setup:
---------------------------
$8000 $A000 $C000 $E000
+-------+-------+-------+-------+
| R:6 | R:7 | { -2} | { -1} |
+-------+-------+-------+-------+
*/
class Namcot3443 : Namcot108Board_Base
{
public override bool Configure(NES.EDetectionOrigin origin)
{
//analyze board type
switch (Cart.board_type)
{
case "NAMCOT-3443":
case "NAMCOT-3433": //TODO: just a guess, find a ROM with this
case "MAPPER088": //TODO: just a guess, find a ROM with this
break;
default:
return false;
}
BaseSetup();
SetMirrorType(EMirrorType.Vertical);
return true;
}
int RewireCHR(int addr)
{
//int mapper_addr = addr >> 1;
//int bank_1k = mapper.Get_CHRBank_1K(mapper_addr + 0x1000);
//int ofs = addr & ((1 << 11) - 1);
//return (bank_1k << 11) + ofs;
if (addr < 0x1000)
{
int mapper_addr = addr >> 1;
int bank_1k = mapper.Get_CHRBank_1K(mapper_addr);
int ofs = addr & ((1 << 10) - 1);
int bob = (bank_1k << 11) + ofs;
return bob & 0x0F;
}
else
{
return addr ; //TODO
}
}
public override byte ReadPPU(int addr)
{
//if (addr < 0x2000) return VROM[Get_CHRBank_1K(addr)];
if (addr < 0x2000) return VROM[RewireCHR(addr)];
else return base.ReadPPU(addr);
}
public override void WritePPU(int addr, byte value)
{
if (addr < 0x2000) { }
else base.WritePPU(addr, value);
}
}
}