Ejemplo n.º 1
0
 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");
 }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 3
0
 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");
 }
Ejemplo n.º 4
0
 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");
 }
Ejemplo n.º 5
0
 public void LD_dd_nnTest()
 {
     PrivateObject param0 = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(param0);
     target.Memory[0] = 0x00;
     target.Memory[1] = 0x50;
     target.LD_dd_nn(2);
     Assert.IsTrue(target.Get16BitRegisters(2) == 0x5000, "Error: LD dd, nn");
 }
Ejemplo n.º 6
0
 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");
 }
Ejemplo n.º 7
0
 public void SBC_HLTest()
 {
     PrivateObject z = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(z);
     target.Set16BitRegisters(2, 0x9999);
     target.Set16BitRegisters(1, 0x1111);
     target.Set(Flag.Carry);
     target.SBC_HL(1);
     Assert.IsTrue(target.Get16BitRegisters(2) == 0x8887, "Error: SBC HL, ss");
 }
Ejemplo n.º 8
0
 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");
 }
Ejemplo n.º 9
0
 public void OUTITest()
 {
     PrivateObject z = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(z);
     target.C = 0x07;
     target.B = 0x10;
     target.Set16BitRegisters(2, 0x1000);
     target.Memory[0x1000] = 0x59;
     target.OUTI();
     Assert.IsTrue(target.B == 0x0f && target.Get16BitRegisters(2) == 0x1001, "Error: OUTI");
 }
Ejemplo n.º 10
0
 public void POP_qqTest()
 {
     PrivateObject z = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(z);
     target.SP = 0x1000;
     target.Memory[0x1000] = 0x55;
     target.Memory[0x1001] = 0x33;
     target.POP_qq(2);
     Assert.IsTrue(target.Get16BitRegisters(2) == 0x3355 && target.SP == 0x1002, "Error: POP qq");
 }
Ejemplo n.º 11
0
 public void OTIRTest()
 {
     PrivateObject z = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(z);
     target.C = 0x07;
     target.B = 0x03;
     target.Set16BitRegisters(2, 0x1000);
     target.Memory[0x1000] = 0x51;
     target.Memory[0x1001] = 0xa9;
     target.Memory[0x1002] = 0x03;
     //  Simulate PC-=2 (repeat instruction)
     target.OTIR();
     target.OTIR();
     target.OTIR();
     Assert.IsTrue(target.Get16BitRegisters(2) == 0x1003 && target.B == 0, "Error: OTIR");
 }
Ejemplo n.º 12
0
 public void ADD_HL_ssTest()
 {
     PrivateObject param0 = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(param0);
     target.Set16BitRegisters(2, 0x4242);
     target.Set16BitRegisters(1, 0x1111);
     target.ADD_HL_ss(1);
     Assert.IsTrue(target.Get16BitRegisters(2) == 0x5353, "Error: ADD HL ss");
 }
Ejemplo n.º 13
0
 public void LD_HL_nnTest()
 {
     PrivateObject param0 = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(param0);
     target.Memory[0x4545] = 0x37;
     target.Memory[0x4546] = 0xa1;
     target.Memory[0] = 0x45;
     target.Memory[1] = 0x45;
     target.LD_HL_nn();
     Assert.IsTrue(target.Get16BitRegisters(2) == 0xa137, "Error: LD HL, (nn)");
 }
Ejemplo n.º 14
0
 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");
 }
Ejemplo n.º 15
0
 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");
 }
Ejemplo n.º 16
0
 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);
 }
Ejemplo n.º 17
0
 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");
 }
Ejemplo n.º 18
0
 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");
 }
Ejemplo n.º 19
0
 public void LD_dd_nn2Test()
 {
     PrivateObject param0 = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(param0);
     target.Memory[0] = 0x30;
     target.Memory[1] = 0x21;
     target.Memory[0x2130] = 0x65;
     target.Memory[0x2131] = 0x78;
     target.LD_dd_nn2(0);
     Assert.IsTrue(target.Get16BitRegisters(0) == 0x7865, "Error: LD dd, (nn)");
 }