public void DNJZTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.DJNZ(); /// Hard to fully test this instruction in isolation /// }
public void ADC_HLTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(0, 0x16); target.Set(Flag.Carry); target.Set16BitRegisters(2, 0x10); target.ADC_HL(0); Assert.IsTrue(target.Get16BitRegisters(2) == 0x27, "Error: ADC HL"); }
public void ADC_A_rTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0x16; target.Set(Flag.Carry); target.B = 0x10; target.ADC_A_r(0); Assert.IsTrue(target.A == 0x27, "Error: ADD A r"); }
public void IMTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.IM(2); Assert.IsTrue(target.interruptMode == 1, "Error: IM"); }
public void INC_rTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.D = 0x28; target.INC_r(2); Assert.IsTrue(target.D == 0x29, "Error: INC r"); }
public void LDDTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(2, 0x1111); target.Memory[0x1111] = 0x88; target.Set16BitRegisters(1, 0x2222); target.Memory[0x2222] = 0x66; target.Set16BitRegisters(0, 0x7); target.LDD(); Assert.IsTrue(target.Get16BitRegisters(2) == 0x1110 && target.Memory[0x1111] == 0x88 && target.Get16BitRegisters(1) == 0x2221 && target.Memory[0x2222] == 0x88 && target.Get16BitRegisters(0) == 0x6, "Error: LDD"); }
public void CCFTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set(Flag.Carry); target.CCF(); Assert.IsTrue((target.F & Flag.Carry) != Flag.Carry, "Error: CCF"); }
public void JP_HLTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.PC = 0x1000; target.Set16BitRegisters(2, 0x4800); target.JP_HL(); Assert.IsTrue(target.PC == 0x4800, "Error: JP (HL)"); }
public void JRTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.PC = 481; target.Memory[481] = 3; target.JR(-1); Assert.IsTrue(target.PC == 485, "Error JR e"); }
public void INITest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.C = 0x07; target.B = 0x10; target.Set16BitRegisters(2, 0x1000); target.INI(); Assert.IsTrue(target.Memory[0x1000] == 0xc1 && target.Get16BitRegisters(2) == 0x1001 && target.B == 0x0f, "Error: INI"); }
public void CPLTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0xb4; target.CPL(); Assert.IsTrue(target.A == 0x4b, "Error: CPL"); }
public void CPIRTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(2, 0x1111); target.A = 0xf3; target.Set16BitRegisters(0, 0x0007); target.Memory[0x1111] = 0x52; target.Memory[0x1112] = 0x00; target.Memory[0x1113] = 0xf3; target.CPIR(); target.CPIR(); target.CPIR(); Assert.IsTrue(target.Get16BitRegisters(2) == 0x1114 && target.Get16BitRegisters(0) == 0x0004 && (target.F & Flag.ParityOverflow) == Flag.ParityOverflow && (target.F & Flag.Zero) == Flag.Zero, "Error: CPIR"); }
public void EITest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.IFF1 = false; target.IFF2 = false; target.EI(); Assert.IsTrue(target.IFF1 == true && target.IFF2 == true, "Error: EI"); }
public void DAATest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0x15; target.B = 0x27; target.ADD_A_r(0); target.DAA(); Assert.IsTrue(target.A == 0x42, "Error: DAA"); }
public void CP_rTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0x63; target.Set16BitRegisters(2, 0x6000); target.Memory[0x6000] = 0x60; target.CP_r(6); Assert.IsTrue((target.F & Flag.Zero) != Flag.Zero, "Error: CP r"); }
public void CP_nTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0x63; target.Memory[0] = 0x60; target.CP_n(); Assert.IsTrue((target.F & Flag.Zero) != Flag.Zero, "Error: CP n"); target.Memory[1] = 0x63; target.CP_n(); Assert.IsTrue((target.F & Flag.Zero) == Flag.Zero, "Error: CP n"); }
public void INC_ssTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(2, 0x1000); target.INC_ss(2); Assert.IsTrue(target.Get16BitRegisters(2) == 0x1001, "Error: INC ss"); }
public void JimmyTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(0, 0x0000); target.DEC_ss(0); Assert.IsTrue(target.Get16BitRegisters(0) == 0xffff); target.A = 199; target.CPL(); Assert.IsTrue(target.A == 56); target.A = 100; target.NEG(); Assert.IsTrue(target.A == 156); target.A = 16; target.B = 1; target.SUB_r(0); Assert.IsTrue(target.A == 15 && (target.F & Flag.HalfCarry) == Flag.HalfCarry); }
public void EXXTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(0, 0x0988); target.Set16BitRegisters(1, 0x9300); target.Set16BitRegisters(2, 0x00e7); target.EXX(); target.Set16BitRegisters(0, 0x445a); target.Set16BitRegisters(1, 0x3da2); target.Set16BitRegisters(2, 0x8859); target.EXX(); Assert.IsTrue(target.Get16BitRegisters(0) == 0x0988 && target.Get16BitRegisters(1) == 0x9300 && target.Get16BitRegisters(2) == 0x00e7, "Error: EXX"); }
public void CPITest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(2, 0x1111); target.Memory[0x1111] = 0x3b; target.A = 0x3b; target.Set16BitRegisters(0, 0x0001); target.CPI(); Assert.IsTrue(target.Get16BitRegisters(0) == 0 && target.Get16BitRegisters(2) == 0x1112 && (target.F & Flag.Zero) == Flag.Zero && (target.F & Flag.ParityOverflow) != Flag.ParityOverflow && target.A == 0x3b && target.Memory[0x1111] == 0x3b, "Error: CPI"); }
public void IN_r_CTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.C = 0x07; target.B = 0x10; target.IN_r_C(2); Assert.IsTrue(target.D == 0xc1, "Error: IN r, C"); }
public void EX_AF_AF2Test() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0x99; target.F = (target.F & 0x00); target.A2 = 0x59; target.F2 = Flag.Carry & Flag.HalfCarry & Flag.F3 & Flag.F5 & Flag.ParityOverflow & Flag.Sign & Flag.Subtract & Flag.Zero; target.EX_AF_AF2(); Assert.IsTrue(target.A == 0x59 && target.F == (Flag.Carry & Flag.HalfCarry & Flag.F3 & Flag.F5 & Flag.ParityOverflow & Flag.Sign & Flag.Subtract & Flag.Zero) && target.A2 == 0x99 && target.F2 == 0, "Error: EX AF, AF'"); }
public void JP_cc_nnTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set(Flag.Carry); target.Memory[0x1520] = 0x03; target.Memory[0] = 0x20; target.Memory[1] = 0x15; target.JP_cc_nn(3); Assert.IsTrue(target.PC == 0x1520, "Error: JP cc, nn"); }
public void EX_DE_HLTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(1, 0x2822); target.Set16BitRegisters(2, 0x499a); target.EX_DE_HL(); Assert.IsTrue(target.Get16BitRegisters(1) == 0x499a && target.Get16BitRegisters(2) == 0x2822, "Error: EX DE, HL"); }
public void JP_nnTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Memory[0] = 0x34; target.Memory[1] = 0x45; target.JP_nn(); Assert.IsTrue(target.PC == 0x4534, "Error: JP nn"); }
public void EX_SP_HLTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(2, 0x7012); target.SP = 0x8856; target.Memory[0x8856] = 0x11; target.Memory[0x8857] = 0x22; target.EX_SP_HL(); Assert.IsTrue(target.Get16BitRegisters(2) == 0x2211 && target.Memory[0x8856] == 0x12 && target.Memory[0x8857] == 0x70 && target.SP == 0x8856, "Error: EX (SP), HL"); }
public void ADD_A_nTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 0x01; target.Memory[0] = 0x04; target.ADD_A_n(); Assert.IsTrue(target.A == 0x05, "Error: ADD A, n"); }
public void HALTTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.isHalted = false; target.HALT(); Assert.IsTrue(target.isHalted == true, "Error: HALT"); }
public void LDIRTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.Set16BitRegisters(2, 0x1111); target.Set16BitRegisters(1, 0x2222); target.Set16BitRegisters(0, 0x0003); target.Memory[0x1111] = 0x88; target.Memory[0x1112] = 0x36; target.Memory[0x1113] = 0xa5; target.Memory[0x2222] = 0x66; target.Memory[0x2223] = 0x59; target.Memory[0x2224] = 0xc5; target.LDIR(); target.LDIR(); target.LDIR(); Assert.IsTrue(target.Get16BitRegisters(2) == 0x1114 && target.Get16BitRegisters(1) == 0x2225 && target.Get16BitRegisters(0) == 0x0000 && target.Memory[0x1111] == 0x88 && target.Memory[0x1112] == 0x36 && target.Memory[0x1113] == 0xa5 && target.Memory[0x2222] == 0x88 && target.Memory[0x2223] == 0x36 && target.Memory[0x2224] == 0xa5, "Error: LDIR"); }
public void CarryTest() { PrivateObject param0 = new PrivateObject(new Z80(new Memory48K())); Z80_Accessor target = new Z80_Accessor(param0); target.A = 5; target.Memory[0] = 3; target.ADD_A_n(); Assert.IsTrue((target.F & Flag.Carry) != Flag.Carry && (target.F & Flag.HalfCarry) != Flag.HalfCarry); target.Memory[1] = 255; target.ADD_A_n(); Assert.IsTrue((target.F & Flag.Carry) == Flag.Carry && (target.F & Flag.HalfCarry) == Flag.HalfCarry); target.Memory[2] = 248; target.ADC_A_n(); Assert.IsTrue(target.A == 0 && (target.F & Flag.Zero) == Flag.Zero); }