static bool STCTest() { return(Harness.CheckConditions( program: new byte[] { 0x37 }, conditions: (cpu) => { return cpu.Flag.Carry; } )); }
static bool LXITest() { return(Harness.CheckConditions( program: new byte[] { 0x01, 0xAA, 0xAB, 0x11, 0xED, 0xFE, 0x21, 0xFE, 0xCA, 0x31, 0x0D, 0xF0 }, conditions: (cpu) => { return cpu.Registers.BC == 0xABAA && cpu.Registers.DE == 0xFEED && cpu.Registers.HL == 0xCAFE && cpu.Registers.SP == 0xF00D; } )); }
static bool JMPTest() { return(Harness.CheckConditions( program: new byte[] { 0xC3, 0x00, 0x3E }, conditions: (cpu) => { return cpu.Registers.PC == 0x3E00; } )); }
static bool DCRTest() { return(Harness.CheckConditions( program: new byte[] { 0x3D }, conditions: (cpu) => { return cpu.Registers.A == 0xFF && cpu.Flag.Sign && cpu.Flag.Parity; } )); }
static bool STAXLDAXTest() { return(Harness.CheckConditions( program: new byte[] { 0x04, 0x0C, 0x0A, 0x3C, 0x14, 0x14, 0x1C, 0x12 }, conditions: (cpu) => { return cpu.Registers.A == 0x01 && cpu.Registers.BC == 0x101 && cpu.Memory[cpu.Registers.DE] == 0x01; } )); }
static bool JMTest() { return(Harness.CheckConditions( program: new byte[] { 0xFA, 0xAF, 0xDE }, conditions: (cpu) => { return cpu.Registers.PC == 0xDEAF; }, setup: (cpu) => { cpu.Flag.Sign = true; } )); }
static bool JPTest() { return(Harness.CheckConditions( program: new byte[] { 0xF2, 0xED, 0x0F }, conditions: (cpu) => { return cpu.Registers.PC == 0xFED; }, setup: (cpu) => { cpu.Flag.Sign = false; } )); }
static bool CMCTest() { return(Harness.CheckConditions( program: new byte[] { 0x3F }, conditions: (cpu) => { return !cpu.Flag.Carry; }, setup: (cpu) => { cpu.Flag.Carry = true; } )); }
static bool SPHLTest() { return(Harness.CheckConditions( program: new byte[] { 0xF9 }, conditions: (cpu) => { return cpu.Registers.SP == 0x506C; }, setup: (cpu) => { cpu.Registers.HL = 0x506C; } )); }
static bool CMATest() { return(Harness.CheckConditions( program: new byte[] { 0x2F }, conditions: (cpu) => { return cpu.Registers.A == 0xAE; }, setup: (cpu) => { cpu.Registers.A = 0x51; } )); }
static bool CNZTest() { return(Harness.CheckConditions( program: new byte[] { 0x00, 0x00, 0x00, 0x00, 0xC4, 0x0F, 0x0F }, conditions: (cpu) => { return cpu.Memory[0x7EFF] == 0x00 && cpu.Memory[0x7EFE] == 0x07 && cpu.Registers.SP == 0x7EFE && cpu.Registers.PC == 0x0F0F; }, setup: (cpu) => { cpu.Registers.SP = 0x7F00; } )); }
static bool JNZTest() { return(Harness.CheckConditions( program: new byte[] { 0xC2, 0xFE, 0xCA }, conditions: (cpu) => { return cpu.Registers.PC == 0xCAFE; }, setup: (cpu) => { cpu.Flag.Zero = false; } )); }
static bool CPITest() { return(Harness.CheckConditions( program: new byte[] { 0xFE, 0x40 }, conditions: (cpu) => { return cpu.Registers.A == 0x4A && cpu.Flag.Parity && !cpu.Flag.Sign && !cpu.Flag.Zero && !cpu.Flag.Carry; }, setup: (cpu) => { cpu.Registers.A = 0x4A; } )); }
static bool XRITest() { return(Harness.CheckConditions( program: new byte[] { 0xEE, 0x81 }, conditions: (cpu) => { return cpu.Registers.A == 0xBA && !cpu.Flag.Parity && cpu.Flag.Sign && !cpu.Flag.Zero; }, setup: (cpu) => { cpu.Registers.A = 0x3B; } )); }
static bool ANITest() { return(Harness.CheckConditions( program: new byte[] { 0x79, 0xE6, 0x0F }, conditions: (cpu) => { return cpu.Registers.A == 0x0A && cpu.Flag.Parity && !cpu.Flag.Sign && !cpu.Flag.Zero; }, setup: (cpu) => { cpu.Registers.C = 0x3A; } )); }
static bool RST1Test() { return(Harness.CheckConditions( program: new byte[] { 0xCF, 0x3E, 0xFE, 0xC3, 0x09, 0x00, 0x00, 0x00, 0xC9, 0x00 }, conditions: (cpu) => { return cpu.Registers.A == 0xFE && cpu.Registers.SP == 0x7F00; }, setup: (cpu) => { cpu.Registers.SP = 0x7F00; } )); }
static bool CPOTest() { return(Harness.CheckConditions( program: new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0x98, 0x21 }, conditions: (cpu) => { return cpu.Memory[0x7EFF] == 0x00 && cpu.Memory[0x7EFE] == 0x0B && cpu.Registers.SP == 0x7EFE && cpu.Registers.PC == 0x2198; }, setup: (cpu) => { cpu.Registers.SP = 0x7F00; } )); }
static bool PCHLTest() { return(Harness.CheckConditions( program: new byte[] { 0xE9 }, conditions: (cpu) => { return cpu.Registers.PC == 0x413E; }, setup: (cpu) => { cpu.Registers.HL = 0x413E; } )); }
static bool JNCTest() { return(Harness.CheckConditions( program: new byte[] { 0xD2, 0xAD, 0xDE }, conditions: (cpu) => { return cpu.Registers.PC == 0xDEAD; }, setup: (cpu) => { cpu.Flag.Carry = false; } )); }
static bool CALLTest() { return(Harness.CheckConditions( program: new byte[] { 0x00, 0x00, 0x00, 0xCD, 0x12, 0x34 }, conditions: (cpu) => { return cpu.Memory[0x7EFF] == 0x00 && cpu.Memory[0x7EFE] == 0x06 && cpu.Registers.SP == 0x7EFE && cpu.Registers.PC == 0x3412; }, setup: (cpu) => { cpu.Registers.SP = 0x7F00; } )); }
static bool JZTest() { return(Harness.CheckConditions( program: new byte[] { 0xCA, 0xBE, 0xBA }, conditions: (cpu) => { return cpu.Registers.PC == 0xBABE; }, setup: (cpu) => { cpu.Flag.Zero = true; } )); }
static bool MVITest() { return(Harness.CheckConditions( program: new byte[] { 0x06, 0xFE, 0x1E, 0x20, 0x36, 0x3E, 0x3E, 0xF2 }, conditions: (cpu) => { return cpu.Registers.B == 0xFE && cpu.Registers.E == 0x20 && cpu.Memory[0x200] == 0x3E && cpu.Registers.A == 0xF2; }, setup: (cpu) => { cpu.Registers.HL = 0x200; } )); }
static bool JCTest() { return(Harness.CheckConditions( program: new byte[] { 0xDA, 0xEF, 0xBE }, conditions: (cpu) => { return cpu.Registers.PC == 0xBEEF; }, setup: (cpu) => { cpu.Flag.Carry = true; } )); }
static bool ACITest() { return(Harness.CheckConditions( program: new byte[] { 0xCE, 0xBE, 0xCE, 0x42 }, conditions: (cpu) => { return cpu.Registers.A == 0x57 && !cpu.Flag.Carry && !cpu.Flag.AuxCarry && !cpu.Flag.Parity && !cpu.Flag.Zero && !cpu.Flag.Sign; }, setup: (cpu) => { cpu.Registers.A = 0x56; } )); }
static bool INRTest() { return(Harness.CheckConditions( program: new byte[] { 0x3C }, conditions: (cpu) => { return cpu.Registers.A == 0x00 && cpu.Flag.Zero && cpu.Flag.Parity && cpu.Flag.AuxCarry; }, setup: (cpu) => { cpu.Registers.A = 0xFF; } )); }
static bool SUITest() { return(Harness.CheckConditions( program: new byte[] { 0xD6, 0x01 }, conditions: (cpu) => { return cpu.Registers.A == 0xFF && cpu.Flag.Carry && !cpu.Flag.AuxCarry && cpu.Flag.Parity && !cpu.Flag.Zero && cpu.Flag.Sign; }, setup: (cpu) => { cpu.Registers.A = 0x00; } )); }
static bool DAATest() { return(Harness.CheckConditions( program: new byte[] { 0x27 }, conditions: (cpu) => { return cpu.Registers.A == 0x01 && cpu.Flag.AuxCarry && cpu.Flag.Carry; }, setup: (cpu) => { cpu.Registers.A = 0x9B; } )); }
static bool JPOTest() { return(Harness.CheckConditions( program: new byte[] { 0xE2, 0x0F, 0xD0 }, conditions: (cpu) => { return cpu.Registers.PC == 0xD00F; }, setup: (cpu) => { cpu.Flag.Parity = false; } )); }
static bool DCXTest() { return(Harness.CheckConditions( program: new byte[] { 0x2B }, conditions: (cpu) => { return cpu.Registers.HL == 0x97FF; }, setup: (cpu) => { cpu.Registers.HL = 0x9800; } )); }
static bool JPETest() { return(Harness.CheckConditions( program: new byte[] { 0xEA, 0x0D, 0xF0 }, conditions: (cpu) => { return cpu.Registers.PC == 0xF00D; }, setup: (cpu) => { cpu.Flag.Parity = true; } )); }