NES - Implement a SoftReset function into the board base, Mapper 230 - implement mode switching via soft reset, implement prg mode 0, game select screen now playable, games are not
This commit is contained in:
parent
fa449a5116
commit
d939e66867
|
@ -33,6 +33,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
void WritePPU(int addr, byte value);
|
void WritePPU(int addr, byte value);
|
||||||
void WriteWRAM(int addr, byte value);
|
void WriteWRAM(int addr, byte value);
|
||||||
void WriteEXP(int addr, byte value);
|
void WriteEXP(int addr, byte value);
|
||||||
|
void NESSoftReset();
|
||||||
byte[] SaveRam { get; }
|
byte[] SaveRam { get; }
|
||||||
byte[] WRAM { get; set; }
|
byte[] WRAM { get; set; }
|
||||||
byte[] VRAM { get; set; }
|
byte[] VRAM { get; set; }
|
||||||
|
@ -64,6 +65,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
this.NES = nes;
|
this.NES = nes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void NESSoftReset()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public abstract bool Configure(NES.EDetectionOrigin origin);
|
public abstract bool Configure(NES.EDetectionOrigin origin);
|
||||||
public virtual void ClockPPU() { }
|
public virtual void ClockPPU() { }
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,15 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
chip 1 = 512k PRG (offset 0x20010-0xA000F)
|
chip 1 = 512k PRG (offset 0x20010-0xA000F)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TODO: fix prg1
|
||||||
|
//TODO: soft reset back to contra = fails
|
||||||
|
|
||||||
public int prg_page;
|
public int prg_page;
|
||||||
public bool prg_mode;
|
public bool prg_mode;
|
||||||
public bool contra_mode;
|
public bool contra_mode;
|
||||||
public int prg_bank_mask_16k;
|
public int chip0_prg_bank_mask_16k = 0x07;
|
||||||
|
public int chip1_prg_bank_mask_16k = 0x1F;
|
||||||
|
public int chip1_offset = 0x20000;
|
||||||
|
|
||||||
public override bool Configure(NES.EDetectionOrigin origin)
|
public override bool Configure(NES.EDetectionOrigin origin)
|
||||||
{
|
{
|
||||||
|
@ -83,8 +88,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
contra_mode = true;
|
contra_mode = true;
|
||||||
SetMirrorType(EMirrorType.Vertical);
|
SetMirrorType(EMirrorType.Vertical);
|
||||||
prg_mode = false;
|
|
||||||
prg_bank_mask_16k = Cart.prg_size / 16 - 1;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +110,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
prg_page = value & 0x0F;
|
prg_page = value & 0x0F;
|
||||||
prg_mode = value.Bit(5);
|
prg_mode = value.Bit(5);
|
||||||
|
|
||||||
if (addr.Bit(6))
|
if (addr.Bit(6))
|
||||||
{
|
{
|
||||||
SetMirrorType(EMirrorType.Horizontal);
|
SetMirrorType(EMirrorType.Horizontal);
|
||||||
|
@ -124,7 +128,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
if (addr < 0x4000)
|
if (addr < 0x4000)
|
||||||
{
|
{
|
||||||
return ROM[((prg_page & prg_bank_mask_16k) * 0x4000) + addr];
|
return ROM[((prg_page & chip0_prg_bank_mask_16k) * 0x4000) + addr];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -133,23 +137,38 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (prg_mode)
|
if (prg_mode == false)
|
||||||
{
|
{
|
||||||
return ROM[(prg_page * 0x8000) + addr]; //TODO
|
return ROM[((prg_page >> 1) * 0x8000) + addr + chip1_offset]; //TODO
|
||||||
}
|
}
|
||||||
else
|
else //TODO:
|
||||||
{
|
{
|
||||||
if (addr < 0x4000)
|
if (addr < 0x4000)
|
||||||
{
|
{
|
||||||
return ROM[((prg_page & prg_bank_mask_16k) * 0x4000) + addr];
|
return ROM[((prg_page & chip1_prg_bank_mask_16k) * 0x4000) + (addr + chip1_offset)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ROM[((prg_page & prg_bank_mask_16k) * 0x4000) + (addr - 0x4000)];
|
return ROM[((prg_page & chip1_prg_bank_mask_16k) * 0x4000) + (addr - 0x4000 + chip1_offset)];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void NESSoftReset()
|
||||||
|
{
|
||||||
|
contra_mode ^= true;
|
||||||
|
prg_page = 0;
|
||||||
|
prg_mode = false;
|
||||||
|
if (contra_mode)
|
||||||
|
{
|
||||||
|
SetMirrorType(EMirrorType.Vertical);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetMirrorType(EMirrorType.Horizontal);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
cpu.NESSoftReset();
|
cpu.NESSoftReset();
|
||||||
apu.NESSoftReset();
|
apu.NESSoftReset();
|
||||||
|
board.NESSoftReset();
|
||||||
//need to study what happens to ppu and apu and stuff..
|
//need to study what happens to ppu and apu and stuff..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue