MAME:MC68000 Register[8] A、D 指针化

This commit is contained in:
sin365 2025-11-17 16:27:45 +08:00
parent 382ee2d1b9
commit 212810384e
8 changed files with 50 additions and 42 deletions

View File

@ -2,7 +2,7 @@ using System;
namespace cpu.m68000 namespace cpu.m68000
{ {
partial class MC68000 unsafe partial class MC68000
{ {
//void AND0() // AND <ea>, Dn //void AND0() // AND <ea>, Dn
//{ //{

View File

@ -3,7 +3,7 @@ using System.Text;
namespace cpu.m68000 namespace cpu.m68000
{ {
partial class MC68000 unsafe partial class MC68000
{ {
void MOVE() void MOVE()
{ {

View File

@ -2,7 +2,7 @@ using System;
namespace cpu.m68000 namespace cpu.m68000
{ {
partial class MC68000 unsafe partial class MC68000
{ {
void ADD0() void ADD0()
{ {

View File

@ -2,7 +2,7 @@ using System;
namespace cpu.m68000 namespace cpu.m68000
{ {
partial class MC68000 unsafe partial class MC68000
{ {
bool TestCondition(int condition) bool TestCondition(int condition)
{ {

View File

@ -2,7 +2,7 @@ using System;
namespace cpu.m68000 namespace cpu.m68000
{ {
partial class MC68000 unsafe partial class MC68000
{ {
unsafe void MOVEtSR() unsafe void MOVEtSR()
{ {

View File

@ -9,45 +9,45 @@ namespace cpu.m68000
{ {
public static MC68000 m1; public static MC68000 m1;
// Machine State // Machine State
public Register[] D = new Register[8]; //public Register[] D = new Register[8];
//#region //指针化 D #region //指针化 D
//static Register[] D_src; Register[] D_src;
//static GCHandle D_handle; GCHandle D_handle;
//public static Register* D; public Register* D;
//public static int DLength; public int DLength;
//public static bool D_IsNull => D == null; public bool D_IsNull => D == null;
//public static Register[] D_set public Register[] D_set
//{ {
// set set
// { {
// D_handle.ReleaseGCHandle(); D_handle.ReleaseGCHandle();
// D_src = value; D_src = value;
// DLength = value.Length; DLength = value.Length;
// D_src.GetObjectPtr(ref D_handle, ref D); D_src.GetObjectPtr(ref D_handle, ref D);
// } }
//} }
//#endregion #endregion
public Register[] A = new Register[8]; //public Register[] A = new Register[8];
//#region //指针化 A #region //指针化 A
//static Register[] A_src; Register[] A_src;
//static GCHandle A_handle; GCHandle A_handle;
//public static Register* A; public Register* A;
//public static int ALength; public int ALength;
//public static bool A_IsNull => A == null; public bool A_IsNull => A == null;
//public static Register[] A_set public Register[] A_set
//{ {
// set set
// { {
// A_handle.ReleaseGCHandle(); A_handle.ReleaseGCHandle();
// A_src = value; A_src = value;
// ALength = value.Length; ALength = value.Length;
// A_src.GetObjectPtr(ref A_handle, ref A); A_src.GetObjectPtr(ref A_handle, ref A);
// } }
//} }
//#endregion #endregion
public int PC, PPC; public int PC, PPC;
private ulong totalExecutedCycles; private ulong totalExecutedCycles;
@ -201,6 +201,8 @@ namespace cpu.m68000
public MC68000() public MC68000()
{ {
A_set = new Register[8];
D_set = new Register[8];
//还是使用Action[]吧 //还是使用Action[]吧
BuildOpcodeTable(); BuildOpcodeTable();
} }

View File

@ -2,7 +2,7 @@
namespace cpu.m68000 namespace cpu.m68000
{ {
partial class MC68000 unsafe partial class MC68000
{ {
sbyte ReadValueB(int mode, int reg) sbyte ReadValueB(int mode, int reg)
{ {

View File

@ -418,6 +418,12 @@ namespace MAME.Core
set_TempBuffer = new byte[0x40000]; set_TempBuffer = new byte[0x40000];
} }
public static void GetObjectPtr(this object srcObj, ref GCHandle handle, ref cpu.m68000.Register* ptr)
{
IntPtr intptr;
GetObjectPtr(srcObj, ref handle, out intptr);
ptr = (cpu.m68000.Register*)intptr;
}
public static void GetObjectPtr(this object srcObj, ref GCHandle handle, ref uint* ptr) public static void GetObjectPtr(this object srcObj, ref GCHandle handle, ref uint* ptr)
{ {
IntPtr intptr; IntPtr intptr;