Fixes to registers change core.

This commit is contained in:
Vladimir Kononovich 2020-10-12 16:49:10 +03:00
parent 4ea538fbfe
commit 7a75651541
5 changed files with 126 additions and 6 deletions

View file

@ -157,5 +157,9 @@ void Cpu::SetReg(CpuRegister reg, uint16_t value)
{ {
_state.PS = value & 0xFF; _state.PS = value & 0xFF;
} break; } break;
case CpuRegister::CpuRegNmiFlag:
{
_state.NmiFlag = value != 0;
} break;
} }
} }

View file

@ -295,7 +295,8 @@ enum class CpuRegister : uint8_t
CpuRegPC, CpuRegPC,
CpuRegK, CpuRegK,
CpuRegDBR, CpuRegDBR,
CpuRegPS CpuRegPS,
CpuRegNmiFlag
}; };
enum class Cx4Register : uint8_t enum class Cx4Register : uint8_t

View file

@ -69,12 +69,12 @@ extern "C"
DllExport void __stdcall GetState(DebugState& state) { GetDebugger()->GetState(state, false); } DllExport void __stdcall GetState(DebugState& state) { GetDebugger()->GetState(state, false); }
DllExport void __stdcall SetCpuRegister(CpuRegister reg, uint16_t value) { GetDebugger()->SetCpuRegister(reg, value); } DllExport void __stdcall SetCpuRegister(CpuRegister reg, uint16_t value) { GetDebugger()->SetCpuRegister(reg, value); }
DllExport void __stdcall SetSpcRegister(SpcRegister reg, uint32_t value) { GetDebugger()->SetSpcRegister(reg, value); } DllExport void __stdcall SetSpcRegister(SpcRegister reg, uint16_t value) { GetDebugger()->SetSpcRegister(reg, value); }
DllExport void __stdcall SetNecDspRegister(NecDspRegister reg, uint32_t value) { GetDebugger()->SetNecDspRegister(reg, value); } DllExport void __stdcall SetNecDspRegister(NecDspRegister reg, uint16_t value) { GetDebugger()->SetNecDspRegister(reg, value); }
DllExport void __stdcall SetSa1Register(CpuRegister reg, uint32_t value) { GetDebugger()->SetSa1Register(reg, value); } DllExport void __stdcall SetSa1Register(CpuRegister reg, uint16_t value) { GetDebugger()->SetSa1Register(reg, value); }
DllExport void __stdcall SetGsuRegister(GsuRegister reg, uint32_t value) { GetDebugger()->SetGsuRegister(reg, value); } DllExport void __stdcall SetGsuRegister(GsuRegister reg, uint16_t value) { GetDebugger()->SetGsuRegister(reg, value); }
DllExport void __stdcall SetCx4Register(Cx4Register reg, uint32_t value) { GetDebugger()->SetCx4Register(reg, value); } DllExport void __stdcall SetCx4Register(Cx4Register reg, uint32_t value) { GetDebugger()->SetCx4Register(reg, value); }
DllExport void __stdcall SetGameboyRegister(GbRegister reg, uint32_t value) { GetDebugger()->SetGameboyRegister(reg, value); } DllExport void __stdcall SetGameboyRegister(GbRegister reg, uint16_t value) { GetDebugger()->SetGameboyRegister(reg, value); }
DllExport const char* __stdcall GetDebuggerLog() DllExport const char* __stdcall GetDebuggerLog()
{ {

View file

@ -58,6 +58,15 @@ namespace Mesen.GUI
return state; return state;
} }
[DllImport(DllPath)] public static extern void SetCpuRegister(CpuRegister reg, UInt16 value);
[DllImport(DllPath)] public static extern void SetSpcRegister(SpcRegister reg, UInt16 value);
[DllImport(DllPath)] public static extern void SetNecDspRegister(NecDspRegister reg, UInt16 value);
[DllImport(DllPath)] public static extern void SetSa1Register(CpuRegister reg, UInt16 value);
[DllImport(DllPath)] public static extern void SetGsuRegister(GsuRegister reg, UInt16 value);
[DllImport(DllPath)] public static extern void SetCx4Register(Cx4Register reg, UInt32 value);
[DllImport(DllPath)] public static extern void SetGameboyRegister(GbRegister reg, UInt16 value);
[DllImport(DllPath)] public static extern void SetScriptTimeout(UInt32 timeout); [DllImport(DllPath)] public static extern void SetScriptTimeout(UInt32 timeout);
[DllImport(DllPath)] public static extern Int32 LoadScript([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string name, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string content, Int32 scriptId = -1); [DllImport(DllPath)] public static extern Int32 LoadScript([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string name, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))]string content, Int32 scriptId = -1);
[DllImport(DllPath)] public static extern void RemoveScript(Int32 scriptId); [DllImport(DllPath)] public static extern void RemoveScript(Int32 scriptId);

View file

@ -925,4 +925,110 @@ namespace Mesen.GUI
public InternalRegisterState InternalRegs; public InternalRegisterState InternalRegs;
public AluState Alu; public AluState Alu;
} }
public enum CpuRegister : byte
{
CpuRegA,
CpuRegX,
CpuRegY,
CpuRegSP,
CpuRegD,
CpuRegPC,
CpuRegK,
CpuRegDBR,
CpuRegPS,
CpuRegNmiFlag,
}
public enum Cx4Register : byte
{
Cx4Reg0,
Cx4Reg1,
Cx4Reg2,
Cx4Reg3,
Cx4Reg4,
Cx4Reg5,
Cx4Reg6,
Cx4Reg7,
Cx4Reg8,
Cx4Reg9,
Cx4Reg10,
Cx4Reg11,
Cx4Reg12,
Cx4Reg13,
Cx4Reg14,
Cx4Reg15,
Cx4RegPB,
Cx4RegPC,
Cx4RegA,
Cx4RegP,
Cx4RegSP,
}
public enum GbRegister : byte
{
GbRegPC,
GbRegSP,
GbRegA,
GbRegFlags,
GbRegB,
GbRegC,
GbRegD,
GbRegE,
GbRegH,
GbRegL,
}
public enum GsuRegister : byte
{
GsuReg0,
GsuReg1,
GsuReg2,
GsuReg3,
GsuReg4,
GsuReg5,
GsuReg6,
GsuReg7,
GsuReg8,
GsuReg9,
GsuRegA,
GsuRegB,
GsuRegC,
GsuRegD,
GsuRegE,
GsuRegF,
GsuRegSFR,
}
public enum NecDspRegister : byte
{
NecDspRegA,
NecDspRegFlagsA,
NecDspRegB,
NecDspRegFlagsB,
NecDspRegTR,
NecDspRegTRB,
NecDspRegPC,
NecDspRegRP,
NecDspRegDP,
NecDspRegDR,
NecDspRegSR,
NecDspRegK,
NecDspRegL,
NecDspRegM,
NecDspRegN,
NecDspRegSerialOut,
NecDspRegSerialIn,
NecDspRegSP,
}
public enum SpcRegister : byte
{
SpcRegPC,
SpcRegA,
SpcRegX,
SpcRegY,
SpcRegSP,
SpcRegPS,
}
} }