Unified interfaces.
parent
20c2b5ab78
commit
59fd18ce2c
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace DotN64.AI
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public class AudioInterface
|
||||
public class AudioInterface : Interface
|
||||
{
|
||||
#region Fields
|
||||
private readonly IReadOnlyList<MappingEntry> memoryMaps;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected override IReadOnlyList<MappingEntry> MemoryMaps => memoryMaps;
|
||||
|
||||
private uint dramAddress;
|
||||
/// <summary>
|
||||
/// Starting RDRAM address (8B-aligned).
|
||||
|
@ -45,11 +45,5 @@ namespace DotN64.AI
|
|||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public uint ReadWord(ulong address) => memoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => memoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
<Compile Include="RI\RDRAMInterface.ModeRegister.cs" />
|
||||
<Compile Include="MI\MIPSInterface.InitModeRegister.cs" />
|
||||
<Compile Include="RI\RDRAMInterface.RefreshRegister.cs" />
|
||||
<Compile Include="Interface.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="CPU\" />
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace DotN64
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public abstract class Interface
|
||||
{
|
||||
#region Properties
|
||||
protected abstract IReadOnlyList<MappingEntry> MemoryMaps { get; }
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public uint ReadWord(ulong address) => MemoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => MemoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -4,15 +4,15 @@ using System.Collections.Specialized;
|
|||
|
||||
namespace DotN64.MI
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public partial class MIPSInterface
|
||||
public partial class MIPSInterface : Interface
|
||||
{
|
||||
#region Fields
|
||||
private readonly IReadOnlyList<MappingEntry> memoryMaps;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected override IReadOnlyList<MappingEntry> MemoryMaps => memoryMaps;
|
||||
|
||||
public InitModeRegister InitMode { get; set; }
|
||||
#endregion
|
||||
|
||||
|
@ -48,11 +48,5 @@ namespace DotN64.MI
|
|||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public uint ReadWord(ulong address) => memoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => memoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ using System.Net;
|
|||
|
||||
namespace DotN64.PI
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public partial class PeripheralInterface
|
||||
public partial class PeripheralInterface : Interface
|
||||
{
|
||||
#region Fields
|
||||
private readonly IReadOnlyList<MappingEntry> memoryMaps;
|
||||
|
@ -16,6 +14,8 @@ namespace DotN64.PI
|
|||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected override IReadOnlyList<MappingEntry> MemoryMaps => memoryMaps;
|
||||
|
||||
public StatusRegister Status { get; set; }
|
||||
|
||||
public byte[] BootROM { get; set; }
|
||||
|
@ -118,10 +118,6 @@ namespace DotN64.PI
|
|||
private void ClearInterrupt() { /* TODO: Implement. */ }
|
||||
|
||||
private void ResetController() { /* TODO: Implement. */ }
|
||||
|
||||
public uint ReadWord(ulong address) => memoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => memoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,15 @@ using System.Collections.Generic;
|
|||
|
||||
namespace DotN64.RI
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public partial class RDRAMInterface
|
||||
public partial class RDRAMInterface : Interface
|
||||
{
|
||||
#region Fields
|
||||
private readonly IReadOnlyList<MappingEntry> memoryMaps;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected override IReadOnlyList<MappingEntry> MemoryMaps => memoryMaps;
|
||||
|
||||
public byte Select { get; set; } = 0x14;
|
||||
|
||||
public ConfigRegister Config { get; set; } = 0x40;
|
||||
|
@ -65,11 +65,5 @@ namespace DotN64.RI
|
|||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public uint ReadWord(ulong address) => memoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => memoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace DotN64.SI
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public partial class SerialInterface
|
||||
public partial class SerialInterface : Interface
|
||||
{
|
||||
#region Fields
|
||||
private readonly IReadOnlyList<MappingEntry> memoryMaps;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected override IReadOnlyList<MappingEntry> MemoryMaps => memoryMaps;
|
||||
|
||||
public StatusRegister Status { get; set; }
|
||||
#endregion
|
||||
|
||||
|
@ -27,11 +27,5 @@ namespace DotN64.SI
|
|||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public uint ReadWord(ulong address) => memoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => memoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
|
||||
namespace DotN64.VI
|
||||
{
|
||||
using Extensions;
|
||||
|
||||
public partial class VideoInterface
|
||||
public partial class VideoInterface : Interface
|
||||
{
|
||||
#region Fields
|
||||
private readonly IReadOnlyList<MappingEntry> memoryMaps;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
protected override IReadOnlyList<MappingEntry> MemoryMaps => memoryMaps;
|
||||
|
||||
private ushort verticalInterrupt;
|
||||
/// <summary>
|
||||
/// Interrupt when current half-line = V_INTR.
|
||||
|
@ -59,11 +59,5 @@ namespace DotN64.VI
|
|||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public uint ReadWord(ulong address) => memoryMaps.GetEntry(address).ReadWord(address);
|
||||
|
||||
public void WriteWord(ulong address, uint value) => memoryMaps.GetEntry(address).WriteWord(address, value);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue