From b4219b8242828ae5371b309b8e17c853bcab3cd5 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Fri, 21 Dec 2018 09:57:49 +0000 Subject: [PATCH] Z80: convert .Length lookups to integer --- .../CPUs/Z80A/Interrupts.cs | 8 +- .../CPUs/Z80A/Tables_Direct.cs | 78 +++++++++---------- .../CPUs/Z80A/Tables_Indirect.cs | 58 +++++++------- BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs | 10 +-- 4 files changed, 77 insertions(+), 77 deletions(-) diff --git a/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs b/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs index 08ed963128..1645c8c659 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80A/Interrupts.cs @@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 11;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } // Mode 0 interrupts only take effect if a CALL or RST is on the data bus @@ -72,7 +72,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, PCh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } // Just jump to $0038 @@ -95,7 +95,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 13;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } // Interrupt mode 2 uses the I vector combined with a byte on the data bus @@ -124,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0, W, 0, 0, W, 0 ,0 }; MEMRQ = new ushort[] { 0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0, W, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 19;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void ResetInterrupts() diff --git a/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Direct.cs b/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Direct.cs index 1b7fddac66..b24b68c67f 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Direct.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Direct.cs @@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } // NOTE: In a real Z80, this operation just flips a switch to choose between 2 registers @@ -26,7 +26,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void EXX_() @@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } // this exchanges 2 16 bit registers @@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void INC_16(ushort src_l, ushort src_h) @@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, I }; MEMRQ = new ushort[] { 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 1 }; + IRQS = 3;// BUSRQ.Length;// new ushort[] { 0, 0, 1 }; } @@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, I, I, I, I, I, I }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1}; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1}; } private void REG_OP(ushort operation, ushort dest, ushort src) @@ -101,7 +101,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } // Operations using the I and R registers take one T-cycle longer @@ -113,7 +113,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I }; MEMRQ = new ushort[] { 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 1 }; + IRQS = 2;// BUSRQ.Length;// new ushort[] { 0, 1 }; } // note: do not use DEC here since no flags are affected by this operation @@ -135,7 +135,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, PCh, 0, 0, PCh, PCh, PCh, PCh, PCh }; MEMRQ = new ushort[] { 0, 0, PCh, 0, 0, 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 10;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } else { @@ -148,7 +148,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, PCh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; } } @@ -159,7 +159,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void JR_COND(bool cond) @@ -179,7 +179,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, PCh, PCh, PCh, PCh }; MEMRQ = new ushort[] { 0, PCh, 0, 0, 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 9;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } else { @@ -191,7 +191,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; } } @@ -210,7 +210,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } else { @@ -225,7 +225,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } } @@ -242,7 +242,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } private void RETI_() @@ -258,7 +258,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } private void RETN_() @@ -274,7 +274,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } @@ -294,7 +294,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } else { @@ -304,7 +304,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I }; MEMRQ = new ushort[] { 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 1 }; + IRQS = 2;// BUSRQ.Length;// new ushort[] { 0, 1 }; } } @@ -330,7 +330,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, PCh, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 14;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } else { @@ -345,7 +345,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } } @@ -356,7 +356,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void BIT_OP(ushort operation, ushort bit, ushort src) @@ -366,7 +366,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void PUSH_(ushort src_l, ushort src_h) @@ -383,7 +383,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } @@ -400,7 +400,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] {0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] {0, 0, 0, 0, 0, 0, 1 }; } private void RST_(ushort n) @@ -417,7 +417,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, SPh, 0, 0, SPh, 0, 0 }; MEMRQ = new ushort[] { 0, 0, SPh, 0, 0, SPh, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } private void PREFIX_(ushort src) @@ -474,7 +474,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void EI_() @@ -484,7 +484,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void JP_16(ushort src_l, ushort src_h) @@ -494,7 +494,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void LD_SP_16(ushort src_l, ushort src_h) @@ -506,7 +506,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, I }; MEMRQ = new ushort[] { 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 1 }; + IRQS = 3;// BUSRQ.Length;// new ushort[] { 0, 0, 1 }; } private void OUT_() @@ -523,7 +523,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, WIO1, WIO2, WIO3, WIO4 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, WIO1, WIO2, WIO3, WIO4 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1}; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1}; } private void OUT_REG_(ushort dest, ushort src) @@ -537,7 +537,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, BIO1, BIO2, BIO3, BIO4 }; MEMRQ = new ushort[] { 0, BIO1, BIO2, BIO3, BIO4 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; } private void IN_() @@ -554,7 +554,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, PCh, 0, 0, WIO1, WIO2, WIO3, WIO4 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, WIO1, WIO2, WIO3, WIO4 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } private void IN_REG_(ushort dest, ushort src) @@ -568,7 +568,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, BIO1, BIO2, BIO3, BIO4 }; MEMRQ = new ushort[] { 0, BIO1, BIO2, BIO3, BIO4 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; } private void REG_OP_16_(ushort op, ushort dest_l, ushort dest_h, ushort src_l, ushort src_h) @@ -585,7 +585,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, I, I, I, I, I, I, I }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } private void INT_MODE_(ushort src) @@ -595,7 +595,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0 }; MEMRQ = new ushort[] { 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 1 }; + IRQS = 1;// BUSRQ.Length;// new ushort[] { 1 }; } private void RRD_() @@ -615,7 +615,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, H, 0, 0, H, H, H, H, W, 0, 0 }; MEMRQ = new ushort[] { 0, H, 0, 0, 0, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 11;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void RLD_() @@ -635,7 +635,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { 0, H, 0, 0, H, H, H, H, W, 0, 0 }; MEMRQ = new ushort[] { 0, H, 0, 0, 0, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 11;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } } } diff --git a/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Indirect.cs b/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Indirect.cs index c611444d99..ddd6f0372a 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Indirect.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Indirect.cs @@ -16,7 +16,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, src_h, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0, 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } private void BIT_OP_IND(ushort operation, ushort bit, ushort src_l, ushort src_h) @@ -33,7 +33,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, src_h, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0, 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } // Note that this operation uses I_BIT, same as indexed BIT. @@ -51,7 +51,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, src_h }; MEMRQ = new ushort[] { 0, src_h, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; } private void REG_OP_IND_INC(ushort operation, ushort dest, ushort src_l, ushort src_h) @@ -64,7 +64,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1}; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1}; } private void REG_OP_IND(ushort operation, ushort dest, ushort src_l, ushort src_h) @@ -77,7 +77,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; } // different because HL doesn't effect WZ @@ -91,7 +91,7 @@ BUSRQ = new ushort[] { 0, H, 0, 0 }; MEMRQ = new ushort[] { 0, H, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; } private void LD_16_IND_nn(ushort src_l, ushort src_h) @@ -113,7 +113,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 13;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void LD_IND_16_nn(ushort dest_l, ushort dest_h) @@ -135,7 +135,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 13;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void LD_8_IND_nn(ushort src) @@ -154,7 +154,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 10;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void LD_IND_8_nn(ushort dest) @@ -173,7 +173,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 10;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void LD_8_IND(ushort dest_l, ushort dest_h, ushort src) @@ -186,7 +186,7 @@ BUSRQ = new ushort[] { 0, dest_h, 0, 0 }; MEMRQ = new ushort[] { 0, dest_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; } // seperate HL needed since it doesn't effect the WZ pair @@ -200,7 +200,7 @@ BUSRQ = new ushort[] { 0, H, 0, 0 }; MEMRQ = new ushort[] { 0, H, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; } private void LD_8_IND_IND(ushort dest_l, ushort dest_h, ushort src_l, ushort src_h) @@ -216,7 +216,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, dest_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0, dest_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } private void LD_IND_8_INC(ushort dest, ushort src_l, ushort src_h) @@ -229,7 +229,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; } private void LD_IND_16(ushort dest_l, ushort dest_h, ushort src_l, ushort src_h) @@ -245,7 +245,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 7;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 1 }; } private void INC_8_IND(ushort src_l, ushort src_h) @@ -262,7 +262,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, src_h, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0, 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } private void DEC_8_IND(ushort src_l, ushort src_h) @@ -279,7 +279,7 @@ BUSRQ = new ushort[] { 0, src_h, 0, 0, src_h, src_h, 0, 0 }; MEMRQ = new ushort[] { 0, src_h, 0, 0, 0, src_h, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } // NOTE: WZ implied for the wollowing 3 functions @@ -297,7 +297,7 @@ BUSRQ = new ushort[] { 0, W, 0, 0, W, W, 0, 0 }; MEMRQ = new ushort[] { 0, W, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1 }; } private void I_BIT_OP(ushort operation, ushort bit, ushort dest) @@ -314,7 +314,7 @@ BUSRQ = new ushort[] { 0, W, 0, 0, W, W, 0, 0 }; MEMRQ = new ushort[] { 0, W, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1}; + IRQS = 8;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1}; } private void I_BIT_TE(ushort bit) @@ -328,7 +328,7 @@ BUSRQ = new ushort[] { 0, W, 0, 0, W }; MEMRQ = new ushort[] { 0, W, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; } private void I_OP_n(ushort operation, ushort src_l, ushort src_h) @@ -353,7 +353,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, PCh, PCh, PCh, PCh, W, 0, 0, W, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, 0, 0, 0, 0, 0, W, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 16;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void I_OP_n_n(ushort src_l, ushort src_h) @@ -374,7 +374,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, PCh, PCh, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, PCh, 0, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 12;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void I_REG_OP_IND_n(ushort operation, ushort dest, ushort src_l, ushort src_h) @@ -395,7 +395,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, PCh, PCh, PCh, PCh, W, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, 0, 0, 0, 0, 0, W, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 12;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void I_LD_8_IND_n(ushort dest_l, ushort dest_h, ushort src) @@ -416,7 +416,7 @@ BUSRQ = new ushort[] { 0, PCh, 0, 0, PCh, PCh, PCh, PCh, PCh, Z, 0, 0 }; MEMRQ = new ushort[] { 0, PCh, 0, 0, 0, 0, 0, 0, 0, Z, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 12;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void LD_OP_R(ushort operation, ushort repeat_instr) @@ -434,7 +434,7 @@ BUSRQ = new ushort[] { 0, H, 0, 0, D, 0, 0, D, D }; MEMRQ = new ushort[] { 0, H, 0, 0, D, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 9;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void CP_OP_R(ushort operation, ushort repeat_instr) @@ -452,7 +452,7 @@ BUSRQ = new ushort[] { 0, H, 0, 0, H, H, H, H, H }; MEMRQ = new ushort[] { 0, H, 0, 0, 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 9;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void IN_OP_R(ushort operation, ushort repeat_instr) @@ -470,7 +470,7 @@ BUSRQ = new ushort[] { 0, I, BIO1, BIO2, BIO3, BIO4, H, 0, 0}; MEMRQ = new ushort[] { 0, 0, BIO1, BIO2, BIO3, BIO4, H, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 9;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } private void OUT_OP_R(ushort operation, ushort repeat_instr) @@ -488,7 +488,7 @@ BUSRQ = new ushort[] { 0, I, H, 0, 0, BIO1, BIO2, BIO3, BIO4 }; MEMRQ = new ushort[] { 0, 0, H, 0, 0, BIO1, BIO2, BIO3, BIO4 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 9;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } // this is an indirect change of a a 16 bit register with memory @@ -514,7 +514,7 @@ BUSRQ = new ushort[] { 0, dest_h, 0, 0, dest_h, 0, 0, dest_h, dest_h, 0, 0, dest_h, 0, 0, dest_h, dest_h }; MEMRQ = new ushort[] { 0, dest_h, 0, 0, dest_h, 0, 0, 0, dest_h, 0, 0, dest_h, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + IRQS = 16;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; } } } diff --git a/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs b/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs index 9572660737..25129c1b99 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80A/Z80A.cs @@ -468,7 +468,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { D, D, D, D, D }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; instr_pntr = mem_pntr = bus_pntr = irq_pntr = 0; I_skip = true; @@ -497,7 +497,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { H, H, H, H, H }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; instr_pntr = mem_pntr = bus_pntr = irq_pntr = 0; I_skip = true; @@ -571,7 +571,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { H, H, H, H, H }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; instr_pntr = mem_pntr = bus_pntr = irq_pntr = 0; I_skip = true; @@ -622,7 +622,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { B, B, B, B, B }; MEMRQ = new ushort[] { 0, 0, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; + IRQS = 5;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 0, 1 }; instr_pntr = mem_pntr = bus_pntr = irq_pntr = 0; I_skip = true; @@ -715,7 +715,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A BUSRQ = new ushort[] { PCh, 0, 0, 0 }; MEMRQ = new ushort[] { PCh, 0, 0, 0 }; - IRQS = BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; + IRQS = 4;// BUSRQ.Length;// new ushort[] { 0, 0, 0, 1 }; instr_pntr = mem_pntr = bus_pntr = irq_pntr = 0; }