MAME:NEOGEO/MC68000的一些减少下标地址计算,改为指针本身直接运算和解引用,以及减少某些重复操作
This commit is contained in:
parent
96039886f4
commit
382ee2d1b9
@ -4,6 +4,44 @@ namespace cpu.m68000
|
|||||||
{
|
{
|
||||||
partial class MC68000
|
partial class MC68000
|
||||||
{
|
{
|
||||||
|
//void AND0() // AND <ea>, Dn
|
||||||
|
//{
|
||||||
|
// int dstReg = (op >> 9) & 0x07;
|
||||||
|
// int size = (op >> 6) & 0x03;
|
||||||
|
// int srcMode = (op >> 3) & 0x07;
|
||||||
|
// int srcReg = op & 0x07;
|
||||||
|
|
||||||
|
// V = false;
|
||||||
|
// C = false;
|
||||||
|
// switch (size)
|
||||||
|
// {
|
||||||
|
// case 0: // Byte
|
||||||
|
// D[dstReg].s8 &= ReadValueB(srcMode, srcReg);
|
||||||
|
// pendingCycles -= (srcMode == 0) ? 4 : 4 + EACyclesBW[srcMode, srcReg];
|
||||||
|
// N = (D[dstReg].s8 & 0x80) != 0;
|
||||||
|
// Z = (D[dstReg].s8 == 0);
|
||||||
|
// return;
|
||||||
|
// case 1: // Word
|
||||||
|
// D[dstReg].s16 &= ReadValueW(srcMode, srcReg);
|
||||||
|
// pendingCycles -= (srcMode == 0) ? 4 : 4 + EACyclesBW[srcMode, srcReg];
|
||||||
|
// N = (D[dstReg].s16 & 0x8000) != 0;
|
||||||
|
// Z = (D[dstReg].s16 == 0);
|
||||||
|
// return;
|
||||||
|
// case 2: // Long
|
||||||
|
// D[dstReg].s32 &= ReadValueL(srcMode, srcReg);
|
||||||
|
// if (srcMode == 0 || (srcMode == 7 && srcReg == 4))
|
||||||
|
// {
|
||||||
|
// pendingCycles -= 8 + EACyclesL[srcMode, srcReg];
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// pendingCycles -= 6 + EACyclesL[srcMode, srcReg];
|
||||||
|
// }
|
||||||
|
// N = (D[dstReg].s32 & 0x80000000) != 0;
|
||||||
|
// Z = (D[dstReg].s32 == 0);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
void AND0() // AND <ea>, Dn
|
void AND0() // AND <ea>, Dn
|
||||||
{
|
{
|
||||||
int dstReg = (op >> 9) & 0x07;
|
int dstReg = (op >> 9) & 0x07;
|
||||||
@ -13,7 +51,6 @@ namespace cpu.m68000
|
|||||||
|
|
||||||
V = false;
|
V = false;
|
||||||
C = false;
|
C = false;
|
||||||
|
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
case 0: // Byte
|
case 0: // Byte
|
||||||
@ -44,7 +81,6 @@ namespace cpu.m68000
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AND1() // AND Dn, <ea>
|
void AND1() // AND Dn, <ea>
|
||||||
{
|
{
|
||||||
int srcReg = (op >> 9) & 0x07;
|
int srcReg = (op >> 9) & 0x07;
|
||||||
|
|||||||
@ -5,12 +5,50 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace cpu.m68000
|
namespace cpu.m68000
|
||||||
{
|
{
|
||||||
public sealed partial class MC68000 : cpuexec_data
|
public unsafe sealed partial class MC68000 : cpuexec_data
|
||||||
{
|
{
|
||||||
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
|
||||||
|
//static Register[] D_src;
|
||||||
|
//static GCHandle D_handle;
|
||||||
|
//public static Register* D;
|
||||||
|
//public static int DLength;
|
||||||
|
//public static bool D_IsNull => D == null;
|
||||||
|
//public static Register[] D_set
|
||||||
|
//{
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// D_handle.ReleaseGCHandle();
|
||||||
|
// D_src = value;
|
||||||
|
// DLength = value.Length;
|
||||||
|
// D_src.GetObjectPtr(ref D_handle, ref D);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
public Register[] A = new Register[8];
|
public Register[] A = new Register[8];
|
||||||
|
|
||||||
|
//#region //指针化 A
|
||||||
|
//static Register[] A_src;
|
||||||
|
//static GCHandle A_handle;
|
||||||
|
//public static Register* A;
|
||||||
|
//public static int ALength;
|
||||||
|
//public static bool A_IsNull => A == null;
|
||||||
|
//public static Register[] A_set
|
||||||
|
//{
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// A_handle.ReleaseGCHandle();
|
||||||
|
// A_src = value;
|
||||||
|
// ALength = value.Length;
|
||||||
|
// A_src.GetObjectPtr(ref A_handle, ref A);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
public int PC, PPC;
|
public int PC, PPC;
|
||||||
private ulong totalExecutedCycles;
|
private ulong totalExecutedCycles;
|
||||||
private int pendingCycles;
|
private int pendingCycles;
|
||||||
|
|||||||
@ -133,19 +133,31 @@
|
|||||||
int startY = Video.offsety;
|
int startY = Video.offsety;
|
||||||
int endY = Video.offsety + Video.height;
|
int endY = Video.offsety + Video.height;
|
||||||
|
|
||||||
|
int * bitmapcolorRect_target = &bitmapcolorRect[target_i];
|
||||||
if (single_step || Mame.paused)
|
if (single_step || Mame.paused)
|
||||||
{
|
{
|
||||||
byte bright = 0xa7;
|
byte bright = 0xa7;
|
||||||
for (y = startY; y < endY; y++)
|
for (y = startY; y < endY; y++)
|
||||||
{
|
{
|
||||||
int stepIndex = y * Video.fullwidth;
|
int stepIndex = y * Video.fullwidth;
|
||||||
|
|
||||||
|
ushort* curbitmap_stepIndex = &curbitmap[stepIndex + startX];
|
||||||
for (x = startX; x < endX; x++, target_i++)
|
for (x = startX; x < endX; x++, target_i++)
|
||||||
{
|
{
|
||||||
i = stepIndex + x;
|
//i = stepIndex + x;
|
||||||
red = (int)(((entry_color[curbitmap[i]] & 0xff0000) >> 16) * bright / 0xff);
|
|
||||||
green = (int)(((entry_color[curbitmap[i]] & 0xff00) >> 8) * bright / 0xff);
|
//red = (int)(((entry_color[curbitmap[i]] & 0xff0000) >> 16) * bright / 0xff);
|
||||||
blue = (int)((entry_color[curbitmap[i]] & 0xff) * bright / 0xff);
|
//green = (int)(((entry_color[curbitmap[i]] & 0xff00) >> 8) * bright / 0xff);
|
||||||
bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
|
//blue = (int)((entry_color[curbitmap[i]] & 0xff) * bright / 0xff);
|
||||||
|
red = (int)(((entry_color[*curbitmap_stepIndex] & 0xff0000) >> 16) * bright / 0xff);
|
||||||
|
green = (int)(((entry_color[*curbitmap_stepIndex] & 0xff00) >> 8) * bright / 0xff);
|
||||||
|
blue = (int)((entry_color[*curbitmap_stepIndex] & 0xff) * bright / 0xff);
|
||||||
|
|
||||||
|
//bitmapcolorRect[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
|
||||||
|
*bitmapcolorRect_target = (int)Palette.make_argb(0xff, red, green, blue);
|
||||||
|
bitmapcolorRect_target++;
|
||||||
|
|
||||||
|
curbitmap_stepIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,10 +167,15 @@
|
|||||||
for (y = startY; y < endY; y++)
|
for (y = startY; y < endY; y++)
|
||||||
{
|
{
|
||||||
int stepIndex = y * Video.fullwidth;
|
int stepIndex = y * Video.fullwidth;
|
||||||
|
ushort* curbitmap_stepIndex = &curbitmap[stepIndex + startX];
|
||||||
for (x = startX; x < endX; x++, target_i++)
|
for (x = startX; x < endX; x++, target_i++)
|
||||||
{
|
{
|
||||||
i = stepIndex + x;
|
//i = stepIndex + x;
|
||||||
bitmapcolorRect[target_i] = (int)entry_color[curbitmap[i]];
|
//bitmapcolorRect[target_i] = (int)entry_color[curbitmap[i]];
|
||||||
|
//*bitmapcolorRect_target = (int)entry_color[curbitmap[i]];
|
||||||
|
*bitmapcolorRect_target = (int)entry_color[*curbitmap_stepIndex];
|
||||||
|
bitmapcolorRect_target++;
|
||||||
|
curbitmap_stepIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,27 +331,32 @@
|
|||||||
int endY = Video.offsety + Video.height;
|
int endY = Video.offsety + Video.height;
|
||||||
|
|
||||||
int* bitmapbaseN_curbitmap_0_Ptrs = &Video.bitmapbaseN_Ptrs[Video.curbitmap][0];
|
int* bitmapbaseN_curbitmap_0_Ptrs = &Video.bitmapbaseN_Ptrs[Video.curbitmap][0];
|
||||||
|
int* bitmapcolorRect_Ptrunsafe_Ptr = &Video.bitmapcolorRect_Ptrunsafe[target_i];
|
||||||
if (single_step || Mame.paused)
|
if (single_step || Mame.paused)
|
||||||
{
|
{
|
||||||
byte bright = 0xa7;
|
byte bright = 0xa7;
|
||||||
for (y = startY; y < endY; y++)
|
for (y = startY; y < endY; y++)
|
||||||
{
|
{
|
||||||
int stepIndex = y * Video.fullwidth;
|
int stepIndex = y * Video.fullwidth;
|
||||||
|
int* stepIndex_Ptr = &bitmapbaseN_curbitmap_0_Ptrs[stepIndex + startX];
|
||||||
for (x = startX; x < endX; x++, target_i++)
|
for (x = startX; x < endX; x++, target_i++)
|
||||||
{
|
{
|
||||||
//i = y * Video.fullwidth + x;
|
//i = y * Video.fullwidth + x;
|
||||||
i = stepIndex + x;
|
//i = stepIndex + x;
|
||||||
//red = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
|
//red = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff0000) >> 16) * bright / 0xff;
|
||||||
//green = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
|
//green = ((Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff00) >> 8) * bright / 0xff;
|
||||||
//blue = (Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff) * bright / 0xff;
|
//blue = (Video.bitmapbaseN_Ptrs[Video.curbitmap][i] & 0xff) * bright / 0xff;
|
||||||
|
|
||||||
int bitmapbaseN_curbitmap_i_value = bitmapbaseN_curbitmap_0_Ptrs[i];
|
int bitmapbaseN_curbitmap_i_value = *stepIndex_Ptr;
|
||||||
red = ((bitmapbaseN_curbitmap_i_value & 0xff0000) >> 16) * bright / 0xff;
|
red = ((bitmapbaseN_curbitmap_i_value & 0xff0000) >> 16) * bright / 0xff;
|
||||||
green = ((bitmapbaseN_curbitmap_i_value & 0xff00) >> 8) * bright / 0xff;
|
green = ((bitmapbaseN_curbitmap_i_value & 0xff00) >> 8) * bright / 0xff;
|
||||||
blue = (bitmapbaseN_curbitmap_i_value & 0xff) * bright / 0xff;
|
blue = (bitmapbaseN_curbitmap_i_value & 0xff) * bright / 0xff;
|
||||||
|
|
||||||
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
|
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)Palette.make_argb(0xff, red, green, blue);
|
||||||
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)((((uint)(0xff) & 0xff) << 24) | (((uint)(blue) & 0xff) << 16) | (((uint)(green) & 0xff) << 8) | ((uint)(red) & 0xff));
|
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)((((uint)(0xff) & 0xff) << 24) | (((uint)(blue) & 0xff) << 16) | (((uint)(green) & 0xff) << 8) | ((uint)(red) & 0xff));
|
||||||
|
*bitmapcolorRect_Ptrunsafe_Ptr = (int)((((uint)(0xff) & 0xff) << 24) | (((uint)(blue) & 0xff) << 16) | (((uint)(green) & 0xff) << 8) | ((uint)(red) & 0xff));
|
||||||
|
bitmapcolorRect_Ptrunsafe_Ptr++;
|
||||||
|
stepIndex_Ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -343,12 +365,16 @@
|
|||||||
for (y = startY; y < endY; y++)
|
for (y = startY; y < endY; y++)
|
||||||
{
|
{
|
||||||
int stepIndex = y * Video.fullwidth;
|
int stepIndex = y * Video.fullwidth;
|
||||||
|
int* stepIndex_Ptr = &bitmapbaseN_curbitmap_0_Ptrs[stepIndex + startX];
|
||||||
for (x = startX; x < endX; x++, target_i++)
|
for (x = startX; x < endX; x++, target_i++)
|
||||||
{
|
{
|
||||||
//i = y * Video.fullwidth + x;
|
//i = y * Video.fullwidth + x;
|
||||||
i = stepIndex + x;
|
//i = stepIndex + x;
|
||||||
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)(0xff000000 | (uint)Video.bitmapbaseN_Ptrs[Video.curbitmap][i]);
|
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)(0xff000000 | (uint)Video.bitmapbaseN_Ptrs[Video.curbitmap][i]);
|
||||||
Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)(0xff000000 | (uint)bitmapbaseN_curbitmap_0_Ptrs[i]);
|
//Video.bitmapcolorRect_Ptrunsafe[target_i] = (int)(0xff000000 | (uint)bitmapbaseN_curbitmap_0_Ptrs[i]);
|
||||||
|
*bitmapcolorRect_Ptrunsafe_Ptr = (int)(0xff000000 | (uint)*stepIndex_Ptr);
|
||||||
|
bitmapcolorRect_Ptrunsafe_Ptr++;
|
||||||
|
stepIndex_Ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -218,46 +218,52 @@ namespace MAME.Core
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
//手动优化
|
//手动优化
|
||||||
public static short MReadOpWord(int address)
|
public unsafe static short MReadOpWord(int address)
|
||||||
{
|
{
|
||||||
address &= 0xffffff;
|
address &= 0xffffff;
|
||||||
short result = 0;
|
|
||||||
if (address >= 0x000000 && address + 1 <= 0x00007f)
|
if (address >= 0x000000 && address + 1 <= 0x00007f)
|
||||||
{
|
{
|
||||||
|
byte* ptr = &Memory.mainrom[address];
|
||||||
if (main_cpu_vector_table_source == 0)
|
if (main_cpu_vector_table_source == 0)
|
||||||
{
|
{
|
||||||
result = (short)(mainbiosrom[address] * 0x100 + mainbiosrom[address + 1]);
|
return (short)(*ptr * 0x100 + *(ptr + 1));
|
||||||
}
|
}
|
||||||
else if (main_cpu_vector_table_source == 1)
|
else if (main_cpu_vector_table_source == 1)
|
||||||
{
|
{
|
||||||
result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]);
|
return (short)(*ptr * 0x100 + *(ptr + 1));
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else if (address >= 0x000080 && address + 1 <= 0x0fffff)
|
else if (address >= 0x000080 && address + 1 <= 0x0fffff)
|
||||||
{
|
{
|
||||||
|
byte* ptr = &Memory.mainrom[address];
|
||||||
//if (address >= 0x142B9 && address <= 0x142C9)
|
//if (address >= 0x142B9 && address <= 0x142C9)
|
||||||
//{
|
//{
|
||||||
// //m68000Form.iStatus = 1;
|
// //m68000Form.iStatus = 1;
|
||||||
//}
|
//}
|
||||||
result = (short)(Memory.mainrom[address] * 0x100 + Memory.mainrom[address + 1]);
|
return (short)(*ptr * 0x100 + *(ptr + 1));
|
||||||
}
|
}
|
||||||
else if (address >= 0x100000 && address + 1 <= 0x1fffff)
|
else if (address >= 0x100000 && address + 1 <= 0x1fffff)
|
||||||
{
|
{
|
||||||
result = (short)(Memory.mainram[address & 0xffff] * 0x100 + Memory.mainram[(address & 0xffff) + 1]);
|
byte* Memory_mainrom_address_and_0xffff = &Memory.mainrom[address & 0xffff];
|
||||||
|
//result = (short)(Memory.mainram[address & 0xffff] * 0x100 + Memory.mainram[(address & 0xffff) + 1]);
|
||||||
|
return (short)(*Memory_mainrom_address_and_0xffff * 0x100 + *(Memory_mainrom_address_and_0xffff + 1));
|
||||||
}
|
}
|
||||||
else if (address >= 0x200000 && address + 1 <= 0x2fffff)
|
else if (address >= 0x200000 && address + 1 <= 0x2fffff)
|
||||||
{
|
{
|
||||||
result = (short)(Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1]);
|
byte* ptr = &Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)];
|
||||||
|
//result = (short)(Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1]);
|
||||||
|
return (short)(*ptr * 0x100 + *(ptr + 1));
|
||||||
}
|
}
|
||||||
else if (address >= 0xc00000 && address + 1 <= 0xcfffff)
|
else if (address >= 0xc00000 && address + 1 <= 0xcfffff)
|
||||||
{
|
{
|
||||||
result = (short)(mainbiosrom[address & 0x1ffff] * 0x100 + mainbiosrom[(address & 0x1ffff) + 1]);
|
byte* ptr = &mainbiosrom[address & 0x1ffff];
|
||||||
|
return (short)(*ptr * 0x100 + *(ptr + 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
public static short MReadWord(int address)
|
public static short MReadWord(int address)
|
||||||
{
|
{
|
||||||
@ -534,7 +540,7 @@ namespace MAME.Core
|
|||||||
// int i1 = 1;
|
// int i1 = 1;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//手动优化
|
//手动优化
|
||||||
public static void MWriteByte(int address, sbyte value)
|
public static void MWriteByte(int address, sbyte value)
|
||||||
{
|
{
|
||||||
@ -559,7 +565,8 @@ namespace MAME.Core
|
|||||||
{
|
{
|
||||||
int i1 = 1;
|
int i1 = 1;
|
||||||
}
|
}
|
||||||
else */if ((address & 0x01) == 1)
|
else */
|
||||||
|
if ((address & 0x01) == 1)
|
||||||
{
|
{
|
||||||
//watchdog_w();
|
//watchdog_w();
|
||||||
//减少一次堆栈 无意义套娃
|
//减少一次堆栈 无意义套娃
|
||||||
@ -2098,61 +2105,121 @@ namespace MAME.Core
|
|||||||
MWriteLong(address, value);
|
MWriteLong(address, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//public static byte ZReadOp(ushort address)
|
||||||
|
//{
|
||||||
|
// byte result = 0;
|
||||||
|
// if (address >= 0x0000 && address <= 0x7fff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[address];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0x8000 && address <= 0xbfff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[3] * 0x4000 + address - 0x8000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xc000 && address <= 0xdfff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[2] * 0x2000 + address - 0xc000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xe000 && address <= 0xefff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[1] * 0x1000 + address - 0xe000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xf000 && address <= 0xf7ff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[0] * 0x800 + address - 0xf000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xf800 && address <= 0xffff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audioram[address - 0xf800];
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//手动优化
|
||||||
public static byte ZReadOp(ushort address)
|
public static byte ZReadOp(ushort address)
|
||||||
{
|
{
|
||||||
byte result = 0;
|
|
||||||
if (address >= 0x0000 && address <= 0x7fff)
|
if (address >= 0x0000 && address <= 0x7fff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[address];
|
return *(Memory.audiorom + address);
|
||||||
}
|
}
|
||||||
else if (address >= 0x8000 && address <= 0xbfff)
|
else if (address >= 0x8000 && address <= 0xbfff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[3] * 0x4000 + address - 0x8000];
|
return *(Memory.audiorom + (*(audio_cpu_banks + 3) * 0x4000 + address - 0x8000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xc000 && address <= 0xdfff)
|
else if (address >= 0xc000 && address <= 0xdfff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[2] * 0x2000 + address - 0xc000];
|
return *(Memory.audiorom + (*(audio_cpu_banks + 2) * 0x2000 + address - 0xc000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xe000 && address <= 0xefff)
|
else if (address >= 0xe000 && address <= 0xefff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[1] * 0x1000 + address - 0xe000];
|
return *(Memory.audiorom + *(audio_cpu_banks + 1) * 0x1000 + address - 0xe000);
|
||||||
}
|
}
|
||||||
else if (address >= 0xf000 && address <= 0xf7ff)
|
else if (address >= 0xf000 && address <= 0xf7ff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[0] * 0x800 + address - 0xf000];
|
return *(Memory.audiorom + (*audio_cpu_banks * 0x800 + address - 0xf000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xf800 && address <= 0xffff)
|
else if (address >= 0xf800 && address <= 0xffff)
|
||||||
{
|
{
|
||||||
result = Memory.audioram[address - 0xf800];
|
return *(Memory.audioram + (address - 0xf800));
|
||||||
}
|
}
|
||||||
return result;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//public static byte ZReadMemory(ushort address)
|
||||||
|
//{
|
||||||
|
// byte result = 0;
|
||||||
|
// if (address >= 0x0000 && address <= 0x7fff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[address];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0x8000 && address <= 0xbfff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[3] * 0x4000 + address - 0x8000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xc000 && address <= 0xdfff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[2] * 0x2000 + address - 0xc000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xe000 && address <= 0xefff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[1] * 0x1000 + address - 0xe000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xf000 && address <= 0xf7ff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audiorom[audio_cpu_banks[0] * 0x800 + address - 0xf000];
|
||||||
|
// }
|
||||||
|
// else if (address >= 0xf800 && address <= 0xffff)
|
||||||
|
// {
|
||||||
|
// result = Memory.audioram[address - 0xf800];
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
//}
|
||||||
|
|
||||||
public static byte ZReadMemory(ushort address)
|
public static byte ZReadMemory(ushort address)
|
||||||
{
|
{
|
||||||
byte result = 0;
|
byte result = 0;
|
||||||
if (address >= 0x0000 && address <= 0x7fff)
|
if (address >= 0x0000 && address <= 0x7fff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[address];
|
result = *(Memory.audiorom + address);
|
||||||
}
|
}
|
||||||
else if (address >= 0x8000 && address <= 0xbfff)
|
else if (address >= 0x8000 && address <= 0xbfff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[3] * 0x4000 + address - 0x8000];
|
result = *(Memory.audiorom + (*(audio_cpu_banks + 3) * 0x4000 + address - 0x8000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xc000 && address <= 0xdfff)
|
else if (address >= 0xc000 && address <= 0xdfff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[2] * 0x2000 + address - 0xc000];
|
result = *(Memory.audiorom + (*(audio_cpu_banks + 2) * 0x2000 + address - 0xc000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xe000 && address <= 0xefff)
|
else if (address >= 0xe000 && address <= 0xefff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[1] * 0x1000 + address - 0xe000];
|
result = *(Memory.audiorom + (*(audio_cpu_banks + 1) * 0x1000 + address - 0xe000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xf000 && address <= 0xf7ff)
|
else if (address >= 0xf000 && address <= 0xf7ff)
|
||||||
{
|
{
|
||||||
result = Memory.audiorom[audio_cpu_banks[0] * 0x800 + address - 0xf000];
|
result = *(Memory.audiorom + (*audio_cpu_banks * 0x800 + address - 0xf000));
|
||||||
}
|
}
|
||||||
else if (address >= 0xf800 && address <= 0xffff)
|
else if (address >= 0xf800 && address <= 0xffff)
|
||||||
{
|
{
|
||||||
result = Memory.audioram[address - 0xf800];
|
result = *(Memory.audioram + (address - 0xf800));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,49 @@ namespace MAME.Core
|
|||||||
public static int main_cpu_bank_address;
|
public static int main_cpu_bank_address;
|
||||||
public static byte main_cpu_vector_table_source;
|
public static byte main_cpu_vector_table_source;
|
||||||
//public static byte audio_result;
|
//public static byte audio_result;
|
||||||
public static byte[] audio_cpu_banks;
|
//public static byte[] audio_cpu_banks;
|
||||||
public static byte[] mainbiosrom, /*mainram2,*/ audiobiosrom, fixedrom, fixedbiosrom, zoomyrom, /*spritesrom,*/ pvc_cartridge_ram;
|
|
||||||
|
|
||||||
|
#region //指针化 audio_cpu_banks
|
||||||
|
static byte[] audio_cpu_banks_src;
|
||||||
|
static GCHandle audio_cpu_banks_handle;
|
||||||
|
public static byte* audio_cpu_banks;
|
||||||
|
public static int audio_cpu_banksLength;
|
||||||
|
public static bool audio_cpu_banks_IsNull => audio_cpu_banks == null;
|
||||||
|
public static byte[] audio_cpu_banks_set
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
audio_cpu_banks_handle.ReleaseGCHandle();
|
||||||
|
audio_cpu_banks_src = value;
|
||||||
|
audio_cpu_banksLength = value.Length;
|
||||||
|
audio_cpu_banks_src.GetObjectPtr(ref audio_cpu_banks_handle, ref audio_cpu_banks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public static byte[]/* mainbiosrom, *//*mainram2,*/ audiobiosrom, fixedrom, fixedbiosrom, zoomyrom, /*spritesrom,*/ pvc_cartridge_ram;
|
||||||
|
|
||||||
|
|
||||||
|
#region //指针化 mainbiosrom
|
||||||
|
static byte[] mainbiosrom_src;
|
||||||
|
static GCHandle mainbiosrom_handle;
|
||||||
|
public static byte* mainbiosrom;
|
||||||
|
public static int mainbiosromLength;
|
||||||
|
public static bool mainbiosrom_IsNull => mainbiosrom == null;
|
||||||
|
public static byte[] mainbiosrom_set
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
mainbiosrom_handle.ReleaseGCHandle();
|
||||||
|
mainbiosrom_src = value;
|
||||||
|
mainbiosromLength = value.Length;
|
||||||
|
mainbiosrom_src.GetObjectPtr(ref mainbiosrom_handle, ref mainbiosrom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public static byte[] extra_ram = new byte[0x2000];
|
public static byte[] extra_ram = new byte[0x2000];
|
||||||
public static uint fatfury2_prot_data;
|
public static uint fatfury2_prot_data;
|
||||||
public static ushort neogeo_rng;
|
public static ushort neogeo_rng;
|
||||||
@ -73,7 +114,7 @@ namespace MAME.Core
|
|||||||
|
|
||||||
public static void NeogeoInit()
|
public static void NeogeoInit()
|
||||||
{
|
{
|
||||||
audio_cpu_banks = new byte[4];
|
audio_cpu_banks_set = new byte[4];
|
||||||
pvc_cartridge_ram = new byte[0x2000];
|
pvc_cartridge_ram = new byte[0x2000];
|
||||||
Memory.Set_mainram(new byte[0x10000]);
|
Memory.Set_mainram(new byte[0x10000]);
|
||||||
mainram2_set = new byte[0x10000];
|
mainram2_set = new byte[0x10000];
|
||||||
@ -83,7 +124,7 @@ namespace MAME.Core
|
|||||||
fixedbiosrom = MameMainMotion.resource.sfix;
|
fixedbiosrom = MameMainMotion.resource.sfix;
|
||||||
zoomyrom = MameMainMotion.resource._000_lo;
|
zoomyrom = MameMainMotion.resource._000_lo;
|
||||||
audiobiosrom = MameMainMotion.resource.sm1;
|
audiobiosrom = MameMainMotion.resource.sm1;
|
||||||
mainbiosrom = MameMainMotion.resource.mainbios;
|
mainbiosrom_set = MameMainMotion.resource.mainbios;
|
||||||
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
|
Memory.Set_mainrom(Machine.GetRom("maincpu.rom"));
|
||||||
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
|
Memory.Set_audiorom(Machine.GetRom("audiocpu.rom"));
|
||||||
fixedrom = Machine.GetRom("fixed.rom");
|
fixedrom = Machine.GetRom("fixed.rom");
|
||||||
@ -100,7 +141,7 @@ namespace MAME.Core
|
|||||||
{
|
{
|
||||||
case "irrmaze":
|
case "irrmaze":
|
||||||
case "kizuna4p":
|
case "kizuna4p":
|
||||||
mainbiosrom = Machine.GetRom("mainbios.rom");
|
mainbiosrom_set = Machine.GetRom("mainbios.rom");
|
||||||
break;
|
break;
|
||||||
case "kof99":
|
case "kof99":
|
||||||
case "kof99h":
|
case "kof99h":
|
||||||
|
|||||||
@ -88,7 +88,7 @@ namespace MAME.Core
|
|||||||
controller_select = reader.ReadByte();
|
controller_select = reader.ReadByte();
|
||||||
main_cpu_bank_address = reader.ReadInt32();
|
main_cpu_bank_address = reader.ReadInt32();
|
||||||
main_cpu_vector_table_source = reader.ReadByte();
|
main_cpu_vector_table_source = reader.ReadByte();
|
||||||
audio_cpu_banks = reader.ReadBytes(4);
|
audio_cpu_banks_set = reader.ReadBytes(4);
|
||||||
save_ram_unlocked = reader.ReadByte();
|
save_ram_unlocked = reader.ReadByte();
|
||||||
audio_cpu_nmi_enabled = reader.ReadBoolean();
|
audio_cpu_nmi_enabled = reader.ReadBoolean();
|
||||||
audio_cpu_nmi_pending = reader.ReadBoolean();
|
audio_cpu_nmi_pending = reader.ReadBoolean();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user