summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs16
-rw-r--r--src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs2020
2 files changed, 2028 insertions, 8 deletions
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs
index 5db6c21..c7d8a5b 100644
--- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs
+++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeCB.cs
@@ -401,7 +401,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 0);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x47: // BIT 0,A
@@ -443,7 +443,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 1);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x4f: // BIT 1,A
@@ -485,7 +485,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 2);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x57: // BIT 2,A
@@ -527,7 +527,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 3);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x5f: // BIT 3,A
@@ -569,7 +569,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 4);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x67: // BIT 4,A
@@ -611,7 +611,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 5);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x6f: // BIT 5,A
@@ -653,7 +653,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 6);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x77: // BIT 6,A
@@ -695,7 +695,7 @@ namespace Noddybox.Emulation.EightBit.Z80
mem = memory.Read(HL.reg);
BIT(ref mem, 7);
memory.Write(HL.reg, mem);
- clock.Add(15);
+ clock.Add(12);
break;
case 0x7f: // BIT 7,A
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs
index 4545fbc..731e474 100644
--- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs
+++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuDecodeShiftedCB.cs
@@ -28,6 +28,2026 @@ namespace Noddybox.Emulation.EightBit.Z80
/// <param name="addr">The address to use for indirection.</param>
private void DecodeShiftedCB(byte opcode, ushort addr)
{
+ byte result = 0;
+
+ switch(opcode)
+ {
+ case 0x00: // RLC (ix+d) -> B
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x01: // RLC (ix+d) -> C
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x02: // RLC (ix+d) -> D
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x03: // RLC (ix+d) -> E
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x04: // RLC (ix+d) -> H
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x05: // RLC (ix+d) -> L
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x06: // RLC (ix+d)
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x07: // RLC (ix+d) -> A
+ result = memory.Read(addr);
+ RLC(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x08: // RRC (ix+d) -> B
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x09: // RRC (ix+d) -> C
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x0a: // RRC (ix+d) -> D
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x0b: // RRC (ix+d) -> E
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x0c: // RRC (ix+d) -> H
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x0d: // RRC (ix+d) -> L
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x0e: // RRC (ix+d)
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x0f: // RRC (ix+d) -> A
+ result = memory.Read(addr);
+ RRC(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x10: // RL (ix+d) -> B
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x11: // RL (ix+d) -> C
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x12: // RL (ix+d) -> D
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x13: // RL (ix+d) -> E
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x14: // RL (ix+d) -> H
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x15: // RL (ix+d) -> L
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x16: // RL (ix+d)
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x17: // RL (ix+d) -> A
+ result = memory.Read(addr);
+ RL(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x18: // RR (ix+d) -> B
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x19: // RR (ix+d) -> C
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x1a: // RR (ix+d) -> D
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x1b: // RR (ix+d) -> E
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x1c: // RR (ix+d) -> H
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x1d: // RR (ix+d) -> L
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x1e: // RR (ix+d)
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x1f: // RR (ix+d) -> A
+ result = memory.Read(addr);
+ RR(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x20: // SLA (ix+d) -> B
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x21: // SLA (ix+d) -> C
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x22: // SLA (ix+d) -> D
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x23: // SLA (ix+d) -> E
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x24: // SLA (ix+d) -> H
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x25: // SLA (ix+d) -> L
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x26: // SLA (ix+d)
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x27: // SLA (ix+d) -> A
+ result = memory.Read(addr);
+ SLA(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x28: // SRA (ix+d) -> B
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x29: // SRA (ix+d) -> C
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x2a: // SRA (ix+d) -> D
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x2b: // SRA (ix+d) -> E
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x2c: // SRA (ix+d) -> H
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x2d: // SRA (ix+d) -> L
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x2e: // SRA (ix+d)
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x2f: // SRA (ix+d) -> A
+ result = memory.Read(addr);
+ SRA(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x30: // SLL (ix+d) -> B
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x31: // SLL (ix+d) -> C
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x32: // SLL (ix+d) -> D
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x33: // SLL (ix+d) -> E
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x34: // SLL (ix+d) -> H
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x35: // SLL (ix+d) -> L
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x36: // SLL (ix+d)
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x37: // SLL (ix+d) -> A
+ result = memory.Read(addr);
+ SLL(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x38: // SRL (ix+d) -> B
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x39: // SRL (ix+d) -> C
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x3a: // SRL (ix+d) -> D
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x3b: // SRL (ix+d) -> E
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x3c: // SRL (ix+d) -> H
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x3d: // SRL (ix+d) -> L
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x3e: // SRL (ix+d)
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x3f: // SRL (ix+d) -> A
+ result = memory.Read(addr);
+ SRL(ref result);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x40: // BIT 0,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x41: // BIT 0,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x42: // BIT 0,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x43: // BIT 0,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x44: // BIT 0,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x45: // BIT 0,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x46: // BIT 0,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x47: // BIT 0,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 0);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x48: // BIT 1,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x49: // BIT 1,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x4a: // BIT 1,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x4b: // BIT 1,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x4c: // BIT 1,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x4d: // BIT 1,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x4e: // BIT 1,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x4f: // BIT 1,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 1);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x50: // BIT 2,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x51: // BIT 2,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x52: // BIT 2,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x53: // BIT 2,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x54: // BIT 2,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x55: // BIT 2,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x56: // BIT 2,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x57: // BIT 2,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 2);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x58: // BIT 3,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x59: // BIT 3,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x5a: // BIT 3,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x5b: // BIT 3,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x5c: // BIT 3,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x5d: // BIT 3,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x5e: // BIT 3,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x5f: // BIT 3,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 3);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x60: // BIT 4,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x61: // BIT 4,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x62: // BIT 4,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x63: // BIT 4,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x64: // BIT 4,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x65: // BIT 4,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x66: // BIT 4,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x67: // BIT 4,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 4);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x68: // BIT 5,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x69: // BIT 5,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x6a: // BIT 5,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x6b: // BIT 5,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x6c: // BIT 5,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x6d: // BIT 5,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x6e: // BIT 5,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x6f: // BIT 5,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 5);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x70: // BIT 6,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x71: // BIT 6,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x72: // BIT 6,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x73: // BIT 6,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x74: // BIT 6,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x75: // BIT 6,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x76: // BIT 6,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x77: // BIT 6,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 6);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x78: // BIT 7,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x79: // BIT 7,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x7a: // BIT 7,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x7b: // BIT 7,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x7c: // BIT 7,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(20);
+ break;
+
+ case 0x7d: // BIT 7,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(20);
+ break;
+
+ case 0x7e: // BIT 7,(ix+d)
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ clock.Add(20);
+ break;
+
+ case 0x7f: // BIT 7,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT(ref result, 7);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(20);
+ break;
+
+ case 0x80: // RES 0,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x81: // RES 0,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x82: // RES 0,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x83: // RES 0,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x84: // RES 0,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x85: // RES 0,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x86: // RES 0,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x87: // RES 0,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 0);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x88: // RES 1,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x89: // RES 1,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x8a: // RES 1,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x8b: // RES 1,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x8c: // RES 1,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x8d: // RES 1,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x8e: // RES 1,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x8f: // RES 1,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 1);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x90: // RES 2,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x91: // RES 2,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x92: // RES 2,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x93: // RES 2,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x94: // RES 2,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x95: // RES 2,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x96: // RES 2,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x97: // RES 2,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 2);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0x98: // RES 3,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x99: // RES 3,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x9a: // RES 3,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x9b: // RES 3,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x9c: // RES 3,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0x9d: // RES 3,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0x9e: // RES 3,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0x9f: // RES 3,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 3);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xa0: // RES 4,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xa1: // RES 4,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xa2: // RES 4,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xa3: // RES 4,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xa4: // RES 4,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xa5: // RES 4,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xa6: // RES 4,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xa7: // RES 4,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 4);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xa8: // RES 5,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xa9: // RES 5,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xaa: // RES 5,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xab: // RES 5,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xac: // RES 5,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xad: // RES 5,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xae: // RES 5,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xaf: // RES 5,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 5);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xb0: // RES 6,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xb1: // RES 6,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xb2: // RES 6,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xb3: // RES 6,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xb4: // RES 6,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xb5: // RES 6,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xb6: // RES 6,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xb7: // RES 6,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 6);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xb8: // RES 7,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xb9: // RES 7,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xba: // RES 7,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xbb: // RES 7,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xbc: // RES 7,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xbd: // RES 7,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xbe: // RES 7,(ix+d)
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xbf: // RES 7,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_RES(ref result, 7);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xc0: // SET 0,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xc1: // SET 0,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xc2: // SET 0,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xc3: // SET 0,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xc4: // SET 0,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xc5: // SET 0,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xc6: // SET 0,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xc7: // SET 0,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 0);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xc8: // SET 1,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xc9: // SET 1,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xca: // SET 1,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xcb: // SET 1,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xcc: // SET 1,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xcd: // SET 1,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xce: // SET 1,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xcf: // SET 1,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 1);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xd0: // SET 2,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xd1: // SET 2,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xd2: // SET 2,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xd3: // SET 2,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xd4: // SET 2,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xd5: // SET 2,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xd6: // SET 2,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xd7: // SET 2,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 2);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xd8: // SET 3,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xd9: // SET 3,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xda: // SET 3,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xdb: // SET 3,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xdc: // SET 3,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xdd: // SET 3,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xde: // SET 3,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xdf: // SET 3,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 3);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xe0: // SET 4,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xe1: // SET 4,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xe2: // SET 4,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xe3: // SET 4,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xe4: // SET 4,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xe5: // SET 4,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xe6: // SET 4,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xe7: // SET 4,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 4);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xe8: // SET 5,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xe9: // SET 5,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xea: // SET 5,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xeb: // SET 5,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xec: // SET 5,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xed: // SET 5,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xee: // SET 5,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xef: // SET 5,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 5);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xf0: // SET 6,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xf1: // SET 6,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xf2: // SET 6,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xf3: // SET 6,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xf4: // SET 6,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xf5: // SET 6,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xf6: // SET 6,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xf7: // SET 6,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 6);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+
+ case 0xf8: // SET 7,(ix+d) -> B
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ BC.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xf9: // SET 7,(ix+d) -> C
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ BC.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xfa: // SET 7,(ix+d) -> D
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ DE.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xfb: // SET 7,(ix+d) -> E
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ DE.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xfc: // SET 7,(ix+d) -> H
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ HL.high = result;
+ clock.Add(23);
+ break;
+
+ case 0xfd: // SET 7,(ix+d) -> L
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ HL.low = result;
+ clock.Add(23);
+ break;
+
+ case 0xfe: // SET 7,(ix+d)
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ clock.Add(23);
+ break;
+
+ case 0xff: // SET 7,(ix+d) -> A
+ result = memory.Read(addr);
+ BIT_SET(ref result, 7);
+ memory.Write(addr, result);
+ A = result;
+ clock.Add(23);
+ break;
+ }
}
}
}