Added register and defaults from MAME.

master
Nabile Rahmani 2017-10-30 14:06:06 +01:00
parent a605598241
commit d5efc12872
3 changed files with 68 additions and 3 deletions

View File

@ -62,6 +62,7 @@
<Compile Include="RI\RDRAMInterface.ConfigRegister.cs" />
<Compile Include="RI\RDRAMInterface.ModeRegister.cs" />
<Compile Include="MI\MIPSInterface.InitModeRegister.cs" />
<Compile Include="RI\RDRAMInterface.RefreshRegister.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="CPU\" />

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Specialized;
namespace DotN64.RI
{
public partial class RDRAMInterface
{
public struct RefreshRegister
{
#region Fields
private BitVector32 bits;
private static readonly BitVector32.Section cleanRefreshDelaySection = BitVector32.CreateSection((1 << 8) - 1),
dirtyRefreshDelaySection = BitVector32.CreateSection((1 << 8) - 1, cleanRefreshDelaySection),
refreshBankSection = BitVector32.CreateSection(1, dirtyRefreshDelaySection),
refreshEnableSection = BitVector32.CreateSection(1, refreshBankSection),
refreshOptimiseSection = BitVector32.CreateSection(1, refreshEnableSection);
#endregion
#region Properties
public byte CleanRefreshDelay
{
get => (byte)bits[cleanRefreshDelaySection];
set => bits[cleanRefreshDelaySection] = value;
}
public byte DirtyRefreshDelay
{
get => (byte)bits[dirtyRefreshDelaySection];
set => bits[dirtyRefreshDelaySection] = value;
}
public bool RefreshBank
{
get => Convert.ToBoolean(bits[refreshBankSection]);
set => bits[refreshBankSection] = Convert.ToInt32(value);
}
public bool RefreshEnable
{
get => Convert.ToBoolean(bits[refreshEnableSection]);
set => bits[refreshEnableSection] = Convert.ToInt32(value);
}
public bool RefreshOptimise
{
get => Convert.ToBoolean(bits[refreshOptimiseSection]);
set => bits[refreshOptimiseSection] = Convert.ToInt32(value);
}
#endregion
#region Operators
public static implicit operator RefreshRegister(uint data) => new RefreshRegister { bits = new BitVector32((int)data) };
public static implicit operator uint(RefreshRegister register) => (uint)register.bits.Data;
#endregion
}
}
}

View File

@ -11,11 +11,13 @@ namespace DotN64.RI
#endregion
#region Properties
public byte Select { get; set; }
public byte Select { get; set; } = 0x14;
public ConfigRegister Config { get; set; }
public ConfigRegister Config { get; set; } = 0x40;
public ModeRegister Mode { get; set; }
public ModeRegister Mode { get; set; } = 0x0E;
public RefreshRegister Refresh { get; set; } = 0x00063634;
#endregion
#region Constructors
@ -39,6 +41,9 @@ namespace DotN64.RI
new MappingEntry(0x04700000, 0x04700003) // RI mode.
{
Write = (o, v) => Mode = v
},
new MappingEntry(0x04700010, 0x04700013) // RI refresh.
{
}
};
}