MAME:减少GC taito igs011 nec 三个地方

This commit is contained in:
sin365 2025-10-24 01:58:37 +08:00
parent 6abda2df0f
commit ac83c236ef
3 changed files with 37 additions and 10 deletions

View File

@ -426,14 +426,17 @@ namespace cpu.nec
I.regs.b[Reg * 2] = (byte)((ushort)tmp1 % 0x100);
I.regs.b[Reg * 2 + 1] = (byte)((ushort)tmp1 / 0x100);
}
static byte[] JMP_table = new byte[] { 3, 10, 10 };
public void JMP(bool flag)
{
int tmp = (int)((sbyte)FETCH());
if (flag)
{
byte[] table = new byte[] { 3, 10, 10 };
//使用外部定义减少GC压力
//byte[] table = new byte[] { 3, 10, 10 };
I.ip = (ushort)(I.ip + tmp);
pendingCycles -= table[chip_type / 8];
pendingCycles -= JMP_table[chip_type / 8];
//PC = (I.sregs[1] << 4) + I.ip;
return;
}
@ -689,17 +692,20 @@ namespace cpu.nec
I.regs.b[5] = (byte)((ushort)result2 / 0x100);
}
}
static byte[] ADD4S_table = new byte[] { 18, 19, 19 };
public void ADD4S(ref int tmp, ref int tmp2)
{
int i, v1, v2, result;
int count = (I.regs.b[2] + 1) / 2;
ushort di = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100);
ushort si = (ushort)(I.regs.b[12] + I.regs.b[13] * 0x100);
byte[] table = new byte[] { 18, 19, 19 };
//使用外部定义减少GC压力
//byte[] table = new byte[] { 18, 19, 19 };
I.ZeroVal = I.CarryVal = 0;
for (i = 0; i < count; i++)
{
pendingCycles -= table[chip_type / 8];
pendingCycles -= ADD4S_table[chip_type / 8];
tmp = GetMemB(3, si);
tmp2 = GetMemB(0, di);
v1 = (tmp >> 4) * 10 + (tmp & 0xf);

View File

@ -199,16 +199,24 @@ namespace MAME.Core
{
igs_dips_sel = data;
}
static byte[] igs_dips_r_dip = new byte[] { dsw1, dsw2, dsw3, dsw4, dsw5 };
private static byte igs_dips_r(int num)
{
int i;
byte ret = 0;
byte[] dip = new byte[] { dsw1, dsw2, dsw3, dsw4, dsw5 };
//使用外部定义减少GC压力(其实赋值也可以简化TODO)
igs_dips_r_dip[0] = dsw1;
igs_dips_r_dip[1] = dsw2;
igs_dips_r_dip[2] = dsw3;
igs_dips_r_dip[0] = dsw4;
igs_dips_r_dip[0] = dsw5;
//byte[] dip = new byte[] { dsw1, dsw2, dsw3, dsw4, dsw5 };
for (i = 0; i < num; i++)
{
if (((~igs_dips_sel) & (1 << i)) != 0)
{
ret = dip[i];
ret = igs_dips_r_dip[i];
}
}
return ret;

View File

@ -139,9 +139,15 @@
{
return (byte)((port2_out & ddr2) | (port2_in & ~ddr2));
}
static byte[] bublbobl_mcu_port2_w_ports = new byte[] { dsw0, dsw1, (byte)sbyte1, (byte)sbyte2 };
public static void bublbobl_mcu_port2_w(byte data)
{
byte[] ports = new byte[] { dsw0, dsw1, (byte)sbyte1, (byte)sbyte2 };
//使用外部定义减少GC压力
bublbobl_mcu_port2_w_ports[0] = dsw0;
bublbobl_mcu_port2_w_ports[1] = dsw1;
bublbobl_mcu_port2_w_ports[2] = (byte)sbyte1;
bublbobl_mcu_port2_w_ports[3] = (byte)sbyte2;
//byte[] ports = new byte[] { dsw0, dsw1, (byte)sbyte1, (byte)sbyte2 };
if ((~port2_out & 0x10) != 0 && (data & 0x10) != 0)
{
int address = port4_out | ((data & 0x0f) << 8);
@ -149,7 +155,7 @@
{
if ((address & 0x0800) == 0x0000)
{
port3_in = ports[address & 3];
port3_in = bublbobl_mcu_port2_w_ports[address & 3];
}
else if ((address & 0x0c00) == 0x0c00)
{
@ -332,9 +338,16 @@
{
return (byte)((portB_out & ddrB) | (portB_in & ~ddrB));
}
static byte[] bublbobl_68705_portB_w_ports = new byte[] { dsw0, dsw1, (byte)sbyte1, (byte)sbyte2 };
public static void bublbobl_68705_portB_w(byte data)
{
byte[] ports = new byte[] { dsw0, dsw1, (byte)sbyte1, (byte)sbyte2 };
//使用外部定义减少GC压力
bublbobl_68705_portB_w_ports[0] = dsw0;
bublbobl_68705_portB_w_ports[1] = dsw1;
bublbobl_68705_portB_w_ports[2] = (byte)sbyte1;
bublbobl_68705_portB_w_ports[3] = (byte)sbyte2;
//byte[] ports = new byte[] { dsw0, dsw1, (byte)sbyte1, (byte)sbyte2 };
if (((ddrB & 0x01) != 0) && ((~data & 0x01) != 0) && ((portB_out & 0x01) != 0))
{
portA_in = (byte)latch;
@ -353,7 +366,7 @@
{
if ((address & 0x0800) == 0x0000)
{
latch = ports[address & 3];
latch = bublbobl_68705_portB_w_ports[address & 3];
}
else if ((address & 0x0c00) == 0x0c00)
{