Exemplo n.º 1
0
 public void LD_r_nTest()
 {
     PrivateObject param0 = new PrivateObject(new Z80(new Memory48K()));
     Z80_Accessor target = new Z80_Accessor(param0);
     //  At execution of LD E, A5H the contents of register E are A5H.
     target.Memory[0] = 0xa5;
     target.LD_r_n(4);
     Assert.IsTrue(target.GetRegister(4) == 0xa5, "Error: LD E, n");
     //  If the HL register pair contains 4444H, the instructionLD (HL), 28H
     //  results in the memory location 4444Hcontaining byte 28H.
     target.Reset();
     target.Set16BitRegisters(2, 0x4444);
     target.Memory[0] = 0x28;
     target.LD_r_n(6);
     Assert.IsTrue(target.Memory[0x4444] == 0x28, "Error: LD (HL), n");
     //  If the Index Register IX contains the number 219AH, the instruction
     //  LD (IX+5H), 5AH results in byte 5AHin the memory address 219AH.
     target.Reset();
     target.prefix = 0xdd;
     target.Set16BitRegisters(2, 0x219a);
     target.Memory[0] = 0x5;
     target.Memory[1] = 0x5a;
     target.LD_r_n(6);
     Assert.IsTrue(target.Memory[0x219a] != 0x5a, "Error: LD (IX+d), n");
     //  If the Index Register IY contains the number A940H, the instruction
     //  LD (IY+10H), 97H results in byte 97Hin memory location A940H.
     target.Reset();
     target.prefix = 0xfd;
     target.Set16BitRegisters(2, 0xa940);
     target.Memory[0] = 0x10;
     target.Memory[1] = 0x97;
     target.LD_r_n(6);
     Assert.IsTrue(target.Memory[0xa940] != 0x97, "Error: LD (IY+d), n");
 }