nes-fix mapper 64 and some minor details of ppu data bus management; fixes klax and chu chu rocket
This commit is contained in:
parent
68a8dd5f74
commit
06239e1aa3
|
@ -25,6 +25,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
bool irq_pending, irq_enable;
|
||||
bool irq_mode;
|
||||
bool irq_reload_pending;
|
||||
int separator_counter;
|
||||
|
||||
|
||||
public override void Dispose()
|
||||
|
@ -51,6 +52,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
ser.Sync("irq_enable", ref irq_enable);
|
||||
ser.Sync("irq_mode", ref irq_mode);
|
||||
ser.Sync("irq_reload_pending", ref irq_reload_pending);
|
||||
ser.Sync("separator_counter", ref separator_counter);
|
||||
|
||||
if (ser.IsReader)
|
||||
Sync();
|
||||
|
@ -63,7 +65,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
case "MAPPER064":
|
||||
break;
|
||||
case "TENGEN-800032":
|
||||
AssertPrg(64,128); AssertChr(64,128); AssertVram(0); AssertWram(00);
|
||||
AssertPrg(64, 128); AssertChr(64, 128); AssertVram(0); AssertWram(00);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -170,7 +172,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
case 0x4001:
|
||||
irq_mode = value.Bit(0);
|
||||
if(irq_mode) irq_countdown = 12;
|
||||
if (irq_mode) irq_countdown = 12;
|
||||
irq_reload_pending = true;
|
||||
break;
|
||||
|
||||
|
@ -241,27 +243,34 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
public override void ClockPPU()
|
||||
{
|
||||
if (separator_counter > 0)
|
||||
separator_counter--;
|
||||
|
||||
if (irq_countdown > 0)
|
||||
{
|
||||
irq_countdown--;
|
||||
if (irq_countdown == 0)
|
||||
{
|
||||
ClockIRQ();
|
||||
if (irq_mode)
|
||||
irq_countdown = 12;
|
||||
}
|
||||
irq_countdown--;
|
||||
if (irq_countdown == 0)
|
||||
{
|
||||
ClockIRQ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void AddressPPU(int addr)
|
||||
{
|
||||
int a12 = (addr >> 12) & 1;
|
||||
bool rising_edge = (a12 == 1 && a12_old == 0);
|
||||
if (rising_edge)
|
||||
{
|
||||
//this number is totally guessed to make klax work
|
||||
irq_countdown = 25;
|
||||
if (separator_counter > 0)
|
||||
{
|
||||
separator_counter = 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
separator_counter = 15;
|
||||
irq_countdown = 11;
|
||||
}
|
||||
}
|
||||
|
||||
a12_old = a12;
|
||||
|
|
|
@ -39,7 +39,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
return 0xFF;
|
||||
|
||||
nes.board.AddressPPU(addr);
|
||||
|
||||
return nes.board.ReadPPU(addr);
|
||||
}
|
||||
|
||||
|
|
|
@ -436,16 +436,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
ppur.install_latches();
|
||||
//nes.LogLine("addr wrote vt = {0}, ht = {1}", ppur._vt, ppur._ht);
|
||||
|
||||
//zero 03-mar-2012 - this broke chu chu rocket.
|
||||
//its actually a terrible idea, so dont put it back.
|
||||
//the address isnt observed by the board till it gets clocked by a read or write.
|
||||
//nes.board.AddressPPU(ppur.get_2007access());
|
||||
//normally the address isnt observed by the board till it gets clocked by a read or write.
|
||||
//but maybe thats just because a ppu read/write shoves it on the address bus
|
||||
//apparently this shoves it on the address bus, too, or else blargg's mmc3 tests dont pass
|
||||
nes.board.AddressPPU(ppur.get_2007access());
|
||||
}
|
||||
|
||||
vtoggle ^= true;
|
||||
|
||||
int addr = ppur.get_2007access() & 0x3FFF;
|
||||
nes.board.AddressPPU(addr);
|
||||
}
|
||||
byte read_2006() { return PPUGenLatch; }
|
||||
|
||||
|
@ -477,8 +474,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
ppur.increment2007(ppur.status.rendering && reg_2001.PPUON, reg_2000.vram_incr32 != 0);
|
||||
|
||||
addr = ppur.get_2007access() & 0x3FFF;
|
||||
nes.board.AddressPPU(addr);
|
||||
//see comments in $2006
|
||||
nes.board.AddressPPU(ppur.get_2007access());
|
||||
}
|
||||
byte read_2007()
|
||||
{
|
||||
|
@ -499,8 +496,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
ppur.increment2007(ppur.status.rendering && reg_2001.PPUON, reg_2000.vram_incr32 != 0);
|
||||
|
||||
addr = ppur.get_2007access() & 0x3FFF;
|
||||
nes.board.AddressPPU(addr);
|
||||
//see comments in $2006
|
||||
nes.board.AddressPPU(ppur.get_2007access());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -413,6 +413,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
//garbage nametable fetches + scroll resets
|
||||
int garbage_todo = 2;
|
||||
ppubus_read(ppur.get_ntread(),true);
|
||||
if (reg_2001.PPUON)
|
||||
{
|
||||
if (sl == 0 && ppur.status.cycle == 304)
|
||||
|
@ -433,6 +434,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
if (realSprite) runppu(garbage_todo);
|
||||
|
||||
ppubus_read(ppur.get_atread(), true); //at or nt?
|
||||
if (realSprite) runppu(kFetchTime);
|
||||
|
||||
//TODO - fake sprites should not come through ppubus_read but rather peek it
|
||||
|
|
Loading…
Reference in New Issue