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