nes-fix dmc sfx bug in bt&dd making nonexistent sfx; add emulation of empty databus (to extra joystick bits and reads of nonexistent EXP and WRAM memory ranges.. need to scan other emulator source codes for places to check for use of empty databus); fixes freeze bug in bt&dd. also break savestates, but add a crude version system so we at least have a way to avoid it in the future.
bt&dd has a glitch that reads from $6000 when there is no ram installed, and crashes if something too large is returned. I think this chooses a frame for abobo, and you can actually see abobo's sprites glitch for one frame right when the wall finishes getting busted down (the same place where bizhawk was freezing)
This commit is contained in:
parent
a38e574695
commit
3898733e8e
|
@ -1,4 +1,5 @@
|
|||
//TODO - so many integers in the square wave output keep us from exactly unbiasing the waveform. also other waves probably
|
||||
//TODO - DMC cpu suspending - http://forums.nesdev.com/viewtopic.php?p=62690#p62690
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
@ -592,6 +593,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
Clock();
|
||||
}
|
||||
|
||||
SyncSample();
|
||||
}
|
||||
|
||||
void SyncSample()
|
||||
{
|
||||
if (out_silence)
|
||||
sample = 0;
|
||||
else
|
||||
|
@ -601,13 +607,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
}
|
||||
|
||||
void SyncSample()
|
||||
{
|
||||
//sample = (out_deltacounter - 64) / 4;
|
||||
//Console.WriteLine("dmc sample: {0}", sample);
|
||||
//sample -= 64; //unbias
|
||||
}
|
||||
|
||||
void Clock()
|
||||
{
|
||||
if (!out_silence)
|
||||
|
@ -692,6 +691,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
break;
|
||||
case 1:
|
||||
out_deltacounter = val & 0x7F;
|
||||
out_silence = false;
|
||||
//apu.nes.LogLine("~~ out_deltacounter set to {0}", out_deltacounter);
|
||||
SyncSample();
|
||||
break;
|
||||
|
|
|
@ -188,11 +188,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
public virtual byte ReadWRAM(int addr) {
|
||||
if (wram != null)
|
||||
return wram[addr & wram_mask];
|
||||
else return 0xFF;
|
||||
else return NES.DB;
|
||||
}
|
||||
|
||||
public virtual void WriteEXP(int addr, byte value) { }
|
||||
public virtual byte ReadEXP(int addr) { return 0xFF; }
|
||||
public virtual byte ReadEXP(int addr) {
|
||||
return NES.DB;
|
||||
}
|
||||
|
||||
public virtual void WritePPU(int addr, byte value)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
CartInfo cart; //the current cart prototype. should be moved into the board, perhaps
|
||||
INESBoard board; //the board hardware that is currently driving things
|
||||
public bool SoundOn = true;
|
||||
int sprdma_countdown; //used to
|
||||
int sprdma_countdown;
|
||||
bool _irq_apu; //various irq signals that get merged to the cpu irq pin
|
||||
|
||||
//irq state management
|
||||
|
@ -119,7 +119,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
{
|
||||
//its weird that this is 514.. normally itd be 512 (and people would say its wrong) or 513 (and people would say its right)
|
||||
//but 514 passes test 4-irq_and_dma
|
||||
cpu_deadcounter = 514;
|
||||
cpu_deadcounter += 514;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
}
|
||||
|
||||
//old data bus values from previous reads
|
||||
public byte DB;
|
||||
|
||||
public byte ReadMemory(ushort addr)
|
||||
{
|
||||
byte ret;
|
||||
|
@ -301,6 +304,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
ret = sysbus_watch[addr].ApplyGameGenie(ret);
|
||||
}
|
||||
|
||||
DB = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
{
|
||||
int ret = value & 1;
|
||||
value >>= 1;
|
||||
return (byte)ret;
|
||||
return (byte)(ret | nes.DB);
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
|
@ -621,7 +621,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
void SyncState(Serializer ser)
|
||||
{
|
||||
int version = 2;
|
||||
ser.BeginSection("NES");
|
||||
ser.Sync("version", ref version);
|
||||
ser.Sync("Frame", ref _frame);
|
||||
ser.Sync("Lag", ref _lagcount);
|
||||
ser.Sync("IsLag", ref islag);
|
||||
|
@ -639,6 +641,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
throw new InvalidOperationException("the current NES mapper didnt call base.SyncState");
|
||||
ppu.SyncState(ser);
|
||||
apu.SyncState(ser);
|
||||
if (version >= 2)
|
||||
ser.Sync("DB", ref DB);
|
||||
|
||||
ser.EndSection();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue