vba: cpu flags and registers
This commit is contained in:
parent
464cde5efa
commit
e8d9ae7e7c
|
@ -242,6 +242,7 @@
|
||||||
<Compile Include="Consoles\Nintendo\GBA\LibVBANext.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\LibVBANext.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\Meteor.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\Meteor.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\VBANext.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\VBANext.cs" />
|
||||||
|
<Compile Include="Consoles\Nintendo\GBA\VBARegisterHelper.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\N64\N64Input.cs" />
|
<Compile Include="Consoles\Nintendo\N64\N64Input.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\N64\N64JaboManager.cs" />
|
<Compile Include="Consoles\Nintendo\N64\N64JaboManager.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\N64\N64Settings.cs" />
|
<Compile Include="Consoles\Nintendo\N64\N64Settings.cs" />
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
[DllImport(dllname, CallingConvention = cc)]
|
[DllImport(dllname, CallingConvention = cc)]
|
||||||
public static extern void Reset(IntPtr g);
|
public static extern void Reset(IntPtr g);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// frame advance
|
/// frame advance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -137,6 +137,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
[DllImport(dllname, CallingConvention = cc)]
|
[DllImport(dllname, CallingConvention = cc)]
|
||||||
public static extern void SetScanlineCallback(IntPtr g, StandardCallback cb, int scanline);
|
public static extern void SetScanlineCallback(IntPtr g, StandardCallback cb, int scanline);
|
||||||
|
|
||||||
|
[DllImport(dllname, CallingConvention = cc)]
|
||||||
|
public static extern IntPtr GetRegisters(IntPtr g);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public class MemoryAreas
|
public class MemoryAreas
|
||||||
|
@ -150,5 +152,56 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
public IntPtr rom;
|
public IntPtr rom;
|
||||||
public IntPtr mmio;
|
public IntPtr mmio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this isn't used directly at the moment. but it could be used for something eventually...
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public class Registers
|
||||||
|
{
|
||||||
|
public int R0;
|
||||||
|
public int R1;
|
||||||
|
public int R2;
|
||||||
|
public int R3;
|
||||||
|
public int R4;
|
||||||
|
public int R5;
|
||||||
|
public int R6;
|
||||||
|
public int R7;
|
||||||
|
public int R8;
|
||||||
|
public int R9;
|
||||||
|
public int R10;
|
||||||
|
public int R11;
|
||||||
|
public int R12;
|
||||||
|
public int R13;
|
||||||
|
public int R14;
|
||||||
|
public int R15;
|
||||||
|
public int CPSR;
|
||||||
|
public int SPSR;
|
||||||
|
public int R13_IRQ;
|
||||||
|
public int R14_IRQ;
|
||||||
|
public int SPSR_IRQ;
|
||||||
|
public int _unk0; // what are these???
|
||||||
|
public int _unk1;
|
||||||
|
public int _unk2;
|
||||||
|
public int _unk3;
|
||||||
|
public int _unk4;
|
||||||
|
public int R13_USR;
|
||||||
|
public int R14_USR;
|
||||||
|
public int R13_SVC;
|
||||||
|
public int R14_SVC;
|
||||||
|
public int SPSR_SVC;
|
||||||
|
public int R13_ABT;
|
||||||
|
public int R14_ABT;
|
||||||
|
public int SPSR_ABT;
|
||||||
|
public int R13_UND;
|
||||||
|
public int R14_UND;
|
||||||
|
public int SPSR_UND;
|
||||||
|
public int R8_FIQ;
|
||||||
|
public int R9_FIQ;
|
||||||
|
public int R10_FIQ;
|
||||||
|
public int R11_FIQ;
|
||||||
|
public int R12_FIQ;
|
||||||
|
public int R13_FIQ;
|
||||||
|
public int R14_FIQ;
|
||||||
|
public int SPSR_FIQ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
savebuff = new byte[LibVBANext.BinStateSize(Core)];
|
savebuff = new byte[LibVBANext.BinStateSize(Core)];
|
||||||
savebuff2 = new byte[savebuff.Length + 13];
|
savebuff2 = new byte[savebuff.Length + 13];
|
||||||
InitMemoryDomains();
|
InitMemoryDomains();
|
||||||
|
InitRegisters();
|
||||||
|
|
||||||
// todo: hook me up as a setting
|
// todo: hook me up as a setting
|
||||||
SetupColors();
|
SetupColors();
|
||||||
|
@ -347,14 +348,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
|
|
||||||
public MemoryDomainList MemoryDomains { get; private set; }
|
public MemoryDomainList MemoryDomains { get; private set; }
|
||||||
|
|
||||||
|
VBARegisterHelper regs;
|
||||||
|
|
||||||
|
void InitRegisters()
|
||||||
|
{
|
||||||
|
regs = new VBARegisterHelper(Core);
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, int> GetCpuFlagsAndRegisters()
|
public Dictionary<string, int> GetCpuFlagsAndRegisters()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return regs.GetAllRegisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCpuRegister(string register, int value)
|
public void SetCpuRegister(string register, int value)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
regs.SetRegister(register, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
|
{
|
||||||
|
public unsafe class VBARegisterHelper
|
||||||
|
{
|
||||||
|
IntPtr _origin;
|
||||||
|
Dictionary<string, IntPtr> _locs = new Dictionary<string, IntPtr>();
|
||||||
|
|
||||||
|
public VBARegisterHelper(IntPtr Core)
|
||||||
|
{
|
||||||
|
_origin = LibVBANext.GetRegisters(Core);
|
||||||
|
foreach (var field in typeof(LibVBANext.Registers).GetFields())
|
||||||
|
{
|
||||||
|
var ofs = Marshal.OffsetOf(typeof(LibVBANext.Registers), field.Name);
|
||||||
|
_locs[field.Name] = IntPtr.Add(_origin, (int)ofs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetRegister(string name)
|
||||||
|
{
|
||||||
|
int* p = (int*)_locs[name];
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
public void SetRegister(string name, int val)
|
||||||
|
{
|
||||||
|
int* p = (int*)_locs[name];
|
||||||
|
*p = val;
|
||||||
|
}
|
||||||
|
public Dictionary<string, int> GetAllRegisters()
|
||||||
|
{
|
||||||
|
Dictionary<string, int> ret = new Dictionary<string,int>();
|
||||||
|
foreach (var kvp in _locs)
|
||||||
|
{
|
||||||
|
ret[kvp.Key] = GetRegister(kvp.Key);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -52,5 +52,4 @@ static const uint8_t memoryWait32_init[16] =
|
||||||
static const uint8_t memoryWaitSeq32_init[16] =
|
static const uint8_t memoryWaitSeq32_init[16] =
|
||||||
{ 0, 0, 5, 0, 0, 1, 1, 0, 5, 5, 9, 9, 17, 17, 4, 0 };
|
{ 0, 0, 5, 0, 0, 1, 1, 0, 5, 5, 9, 9, 17, 17, 4, 0 };
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3492,8 +3492,6 @@ void BIOS_SoftReset (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BIOS_GET_BIOS_CHECKSUM() bus.reg[0].I=0xBAAE187F;
|
|
||||||
|
|
||||||
#define BIOS_REGISTER_RAM_RESET() BIOS_RegisterRamReset(bus.reg[0].I);
|
#define BIOS_REGISTER_RAM_RESET() BIOS_RegisterRamReset(bus.reg[0].I);
|
||||||
|
|
||||||
#define CPU_UPDATE_CPSR() \
|
#define CPU_UPDATE_CPSR() \
|
||||||
|
@ -13362,6 +13360,11 @@ template<bool isReader>bool SyncBatteryRam(NewState *ns)
|
||||||
scanlineCallbackLine = scanline;
|
scanlineCallbackLine = scanline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t *GetRegisters()
|
||||||
|
{
|
||||||
|
return &bus.reg[0].I;
|
||||||
|
}
|
||||||
|
|
||||||
}; // class Gigazoid
|
}; // class Gigazoid
|
||||||
|
|
||||||
// zeroing mem operators: these are very important
|
// zeroing mem operators: these are very important
|
||||||
|
@ -13508,4 +13511,9 @@ EXPORT void SetScanlineCallback(Gigazoid *g, void (*cb)(), int scanline)
|
||||||
g->SetScanlineCallback(cb, scanline);
|
g->SetScanlineCallback(cb, scanline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT u32 *GetRegisters(Gigazoid *g)
|
||||||
|
{
|
||||||
|
return g->GetRegisters();
|
||||||
|
}
|
||||||
|
|
||||||
#include "optable.inc"
|
#include "optable.inc"
|
||||||
|
|
Loading…
Reference in New Issue