fds - fix up some junk. smb2j runs now
This commit is contained in:
parent
e84f1d2761
commit
fbb46e7054
|
@ -5,6 +5,12 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Emulation.Consoles.Nintendo
|
||||
{
|
||||
/*
|
||||
* http://sourceforge.net/p/fceultra/code/2696/tree/fceu/src/fds.cpp - only used for timer info
|
||||
* http://nesdev.com/FDS%20technical%20reference.txt - implementation is mostly a combination of
|
||||
* http://wiki.nesdev.com/w/index.php/Family_Computer_Disk_System - these two documents
|
||||
* http://nesdev.com/diskspec.txt - not useless
|
||||
*/
|
||||
[NES.INESBoardImplCancel]
|
||||
public class FDS : NES.NESBoardBase
|
||||
{
|
||||
|
@ -77,7 +83,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
int timerlatch;
|
||||
int timervalue;
|
||||
bool timeractive;
|
||||
byte timerreg;
|
||||
|
||||
byte reg4026;
|
||||
|
||||
|
@ -94,16 +100,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
timerirq = false;
|
||||
break;
|
||||
case 0x0021:
|
||||
timerlatch &= 0xff00;
|
||||
timerlatch &= 0x00ff;
|
||||
timerlatch |= value << 8;
|
||||
timerirq = false;
|
||||
break;
|
||||
case 0x0022:
|
||||
if ((value & 1) != 0)
|
||||
{
|
||||
timeractive = true;
|
||||
timervalue = timerlatch * 3;
|
||||
}
|
||||
timerreg = (byte)(value & 3);
|
||||
timervalue = timerlatch * 3;
|
||||
break;
|
||||
case 0x0023:
|
||||
diskenable = (value & 1) != 0;
|
||||
|
@ -171,12 +174,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
|
||||
public override void ClockPPU()
|
||||
{
|
||||
if (timeractive)
|
||||
if ((timerreg & 2) != 0 && timervalue > 0)
|
||||
{
|
||||
timervalue--;
|
||||
if (timervalue == 0)
|
||||
{
|
||||
timeractive = false;
|
||||
if ((timerreg & 1) != 0)
|
||||
{
|
||||
timervalue = timerlatch * 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
timerreg &= unchecked((byte)~2);
|
||||
timervalue = 0;
|
||||
timerlatch = 0;
|
||||
}
|
||||
timerirq = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
{
|
||||
// the current circulating .fds dumps are horribly broken. here we attempt to fix them up as best as possible.
|
||||
// todo: implement CRC. since the RamAdapter itself doesn't implement it, broken is not a problem
|
||||
// since its not contained in dumps, no way to be sure that the implementation is right
|
||||
|
||||
MemoryStream inp = new MemoryStream(inputdisk, false);
|
||||
BinaryReader br = new BinaryReader(inp);
|
||||
|
@ -282,7 +283,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
case RamAdapterState.SPINUP:
|
||||
state = RamAdapterState.RUNNING;
|
||||
SetCycles();
|
||||
transferreset = false;
|
||||
//transferreset = false; // this definitely does not happen.
|
||||
//numcrc = 0;
|
||||
Console.WriteLine("FDS: Spin up complete! Disk is running");
|
||||
break;
|
||||
|
@ -302,7 +303,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
byte readreglatch;
|
||||
byte writereglatch;
|
||||
|
||||
bool bytetransferflag = false;
|
||||
bool _bytetransferflag;
|
||||
bool bytetransferflag { get { return _bytetransferflag; } set { _bytetransferflag = value; } }
|
||||
|
||||
bool lookingforendofgap = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue