Set the MI version register to RCP v2.0.

master
Nabile Rahmani 2018-12-21 23:32:17 +01:00
parent 78d7002396
commit c89a91449e
3 changed files with 80 additions and 1 deletions

View File

@ -105,6 +105,7 @@
<Compile Include="Switch.cs" />
<Compile Include="RCP\DP\RealityCoprocessor.DisplayProcessor.Angrylion.cs" />
<Compile Include="RCP\MI\RealityCoprocessor.MIPSInterface.InterruptPins.cs" />
<Compile Include="RCP\MI\RealityCoprocessor.MIPSInterface.VersionRegister.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="CPU\" />

View File

@ -0,0 +1,76 @@
using System.Collections.Specialized;
namespace DotN64.RCP
{
public partial class RealityCoprocessor
{
public partial class MIPSInterface
{
public struct VersionRegister
{
#region Fields
private BitVector32 bits;
private static readonly BitVector32.Section io = BitVector32.CreateSection((1 << 8) - 1),
rac = BitVector32.CreateSection((1 << 8) - 1, io),
rdp = BitVector32.CreateSection((1 << 8) - 1, rac),
rsp = BitVector32.CreateSection((1 << 8) - 1, rdp);
#endregion
#region Properties
public byte IO
{
get => (byte)bits[io];
set => bits[io] = value;
}
public byte RAC
{
get => (byte)bits[rac];
set => bits[rac] = value;
}
public byte RDP
{
get => (byte)bits[rdp];
set => bits[rdp] = value;
}
public byte RSP
{
get => (byte)bits[rsp];
set => bits[rsp] = value;
}
/// <summary>
/// The prototype RCP chip.
/// </summary>
public static VersionRegister Version1 => new VersionRegister
{
IO = 1,
RAC = 1,
RDP = 1,
RSP = 1
};
/// <summary>
/// The retail RCP chip.
/// </summary>
public static VersionRegister Version2 => new VersionRegister
{
IO = 2,
RAC = 1,
RDP = 2,
RSP = 2
};
#endregion
#region Operators
public static implicit operator VersionRegister(uint data) => new VersionRegister { bits = new BitVector32((int)data) };
public static implicit operator uint(VersionRegister version) => (uint)version.bits.Data;
#endregion
}
}
}
}

View File

@ -13,6 +13,8 @@ namespace DotN64.RCP
public InitModeRegister InitMode { get; set; }
public VersionRegister Version { get; set; } = VersionRegister.Version2;
public Interrupts InterruptMask { get; set; }
private Interrupts interrupt;
@ -60,7 +62,7 @@ namespace DotN64.RCP
},
new MappingEntry(0x04300004, 0x04300007) // MI version.
{
Read = o => 0 // TODO.
Read = o => Version
},
new MappingEntry(0x04300008, 0x0430000B) // MI interrupt.
{