- Fake CACHE.

- Pretty print maps.
- Main memory get.
master
Nabile Rahmani 2017-10-30 21:46:09 +01:00
parent dbe5cc6559
commit 2ebfa53387
5 changed files with 29 additions and 2 deletions

View File

@ -30,6 +30,8 @@
BEQ = 0b000100,
/// <summary>Add Immediate.</summary>
ADDI = 0b001000,
/// <summary>Cache Operation.</summary>
CACHE = 0b101111
}
}
}

View File

@ -90,7 +90,8 @@ namespace DotN64.CPU
[OpCode.BNEL] = i => BranchLikely(i, (rs, rt) => rs != rt),
[OpCode.BNE] = i => Branch(i, (rs, rt) => rs != rt),
[OpCode.BEQ] = i => Branch(i, (rs, rt) => rs == rt),
[OpCode.ADDI] = i => GPR[i.RT] = (ulong)(int)(GPR[i.RS] + (ulong)(short)i.Immediate)
[OpCode.ADDI] = i => GPR[i.RT] = (ulong)(int)(GPR[i.RS] + (ulong)(short)i.Immediate),
[OpCode.CACHE] = i => { /* TODO: Implement and compare the performance if it's a concern. */ }
};
specialOperations = new Dictionary<SpecialOpCode, Action<Instruction>>
{

View File

@ -32,6 +32,8 @@ namespace DotN64
public uint ReadWord(ulong address) => Read(OffsetAddress ? address - StartAddress : address);
public void WriteWord(ulong address, uint value) => Write(OffsetAddress ? address - StartAddress : address, value);
public override string ToString() => $"[0x{StartAddress:X16}..0x{EndAddress:X16}] - {(Read != null ? "R" : "-")}{(Write != null ? "W" : "-")}";
#endregion
}
}

View File

@ -89,6 +89,11 @@ namespace DotN64
Write = RCP.DP.WriteWord
},
new MappingEntry(0x04700000, 0x047FFFFF, false) // RDRAM interface (RI) registers.
{
Read = RI.ReadWord,
Write = RI.WriteWord
},
new MappingEntry(0x00000000, 0x03EFFFFF, false) // RDRAM memory.
{
Read = RI.ReadWord,
Write = RI.WriteWord

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
namespace DotN64.RI
{
@ -18,6 +19,8 @@ namespace DotN64.RI
public ModeRegister Mode { get; set; } = 0x0E;
public RefreshRegister Refresh { get; set; } = 0x00063634;
public byte[] RAM { get; } = new byte[0x00400000]; // The base system has 4 MB of RAM installed.
#endregion
#region Constructors
@ -44,6 +47,20 @@ namespace DotN64.RI
},
new MappingEntry(0x04700010, 0x04700013) // RI refresh.
{
},
new MappingEntry(0x00000000, 0x03EFFFFF) // RDRAM memory.
{
Read = o => BitConverter.ToUInt32(RAM, (int)o),
Write = (o, v) =>
{
unsafe
{
fixed (byte* data = &RAM[(int)o])
{
*(uint*)data = v;
}
}
}
}
};
}