diff options
Diffstat (limited to 'Ryujinx.Tests/Cpu/CpuTest32.cs')
-rw-r--r-- | Ryujinx.Tests/Cpu/CpuTest32.cs | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Ryujinx.Tests/Cpu/CpuTest32.cs b/Ryujinx.Tests/Cpu/CpuTest32.cs index 1ffea0b6..2176e5ad 100644 --- a/Ryujinx.Tests/Cpu/CpuTest32.cs +++ b/Ryujinx.Tests/Cpu/CpuTest32.cs @@ -286,6 +286,35 @@ namespace Ryujinx.Tests.Cpu Assert.That(GetContext().Pstate, Is.EqualTo(finalCpsr)); } + public void RunPrecomputedTestCase(PrecomputedMemoryThumbTestCase test) + { + byte[] testMem = new byte[Size]; + + for (ulong i = 0; i < Size; i += 2) + { + testMem[i + 0] = (byte)((i + DataBaseAddress) >> 0); + testMem[i + 1] = (byte)((i + DataBaseAddress) >> 8); + } + + SetWorkingMemory(0, testMem); + + RunPrecomputedTestCase(new PrecomputedThumbTestCase(){ + Instructions = test.Instructions, + StartRegs = test.StartRegs, + FinalRegs = test.FinalRegs, + }); + + foreach (var delta in test.MemoryDelta) + { + testMem[delta.Address - DataBaseAddress + 0] = (byte)(delta.Value >> 0); + testMem[delta.Address - DataBaseAddress + 1] = (byte)(delta.Value >> 8); + } + + byte[] mem = _memory.GetSpan(DataBaseAddress, (int)Size).ToArray(); + + Assert.That(mem, Is.EqualTo(testMem), "testmem"); + } + protected void SetWorkingMemory(uint offset, byte[] data) { _memory.Write(DataBaseAddress + offset, data); @@ -641,4 +670,4 @@ namespace Ryujinx.Tests.Cpu _context.SetFPstateFlag(FPState.VFlag, (fpscr & (1u << (int)FPState.VFlag)) != 0); } } -} +}
\ No newline at end of file |