Пример #1
0
 static bool STCTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0x37 },
                conditions: (cpu) => {
         return cpu.Flag.Carry;
     }
                ));
 }
Пример #2
0
 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;
     }
                ));
 }
Пример #3
0
 static bool JMPTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0xC3, 0x00, 0x3E },
                conditions: (cpu) => {
         return cpu.Registers.PC == 0x3E00;
     }
                ));
 }
Пример #4
0
 static bool DCRTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0x3D },
                conditions: (cpu) => {
         return cpu.Registers.A == 0xFF && cpu.Flag.Sign && cpu.Flag.Parity;
     }
                ));
 }
Пример #5
0
 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;
     }
                ));
 }
Пример #6
0
 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;
     }
                ));
 }
Пример #7
0
 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;
     }
                ));
 }
Пример #8
0
 static bool CMCTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0x3F },
                conditions: (cpu) => {
         return !cpu.Flag.Carry;
     },
                setup: (cpu) => {
         cpu.Flag.Carry = true;
     }
                ));
 }
Пример #9
0
 static bool SPHLTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0xF9 },
                conditions: (cpu) => {
         return cpu.Registers.SP == 0x506C;
     },
                setup: (cpu) => {
         cpu.Registers.HL = 0x506C;
     }
                ));
 }
Пример #10
0
 static bool CMATest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0x2F },
                conditions: (cpu) => {
         return cpu.Registers.A == 0xAE;
     },
                setup: (cpu) => {
         cpu.Registers.A = 0x51;
     }
                ));
 }
Пример #11
0
 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;
     }
                ));
 }
Пример #12
0
 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;
     }
                ));
 }
Пример #13
0
 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;
     }
                ));
 }
Пример #14
0
 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;
     }
                ));
 }
Пример #15
0
 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;
     }
                ));
 }
Пример #16
0
 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;
     }
                ));
 }
Пример #17
0
 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;
     }
                ));
 }
Пример #18
0
 static bool PCHLTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0xE9 },
                conditions: (cpu) => {
         return cpu.Registers.PC == 0x413E;
     },
                setup: (cpu) => {
         cpu.Registers.HL = 0x413E;
     }
                ));
 }
Пример #19
0
 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;
     }
                ));
 }
Пример #20
0
 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;
     }
                ));
 }
Пример #21
0
 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;
     }
                ));
 }
Пример #22
0
 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;
     }
                ));
 }
Пример #23
0
 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;
     }
                ));
 }
Пример #24
0
 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;
     }
                ));
 }
Пример #25
0
 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;
     }
                ));
 }
Пример #26
0
 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;
     }
                ));
 }
Пример #27
0
 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;
     }
                ));
 }
Пример #28
0
 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;
     }
                ));
 }
Пример #29
0
 static bool DCXTest()
 {
     return(Harness.CheckConditions(
                program: new byte[] { 0x2B },
                conditions: (cpu) => {
         return cpu.Registers.HL == 0x97FF;
     },
                setup: (cpu) => {
         cpu.Registers.HL = 0x9800;
     }
                ));
 }
Пример #30
0
 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;
     }
                ));
 }