예제 #1
0
파일: EX_EXX.cs 프로젝트: dolbz/Z80Sharp
 public void Clock()
 {
     if (!_read.IsComplete)
     {
         _read.Clock();
         if (_read.IsComplete)
         {
             _write.AddressedValue = _targetRegister.GetValue(_cpu);
             _targetRegister.SetValueOnProcessor(_cpu, _read.AddressedValue);
         }
         return;
     }
     if (_additionalReadCycles-- > 0)
     {
         // http://www.baltazarstudios.com/files/xx.html#E3 shows that the cpu read/write signals aren't affected by
         // the extended cycles so we can just do nothing for these cycles
         return;
     }
     if (!_write.IsComplete)
     {
         _write.Clock();
         return;
     }
     _additionalWriteCycles--;
 }
예제 #2
0
파일: LoadTests.cs 프로젝트: dolbz/Z80Sharp
        public void LoadRegisterToRegisterPointer()
        {
            // Arrange
            WideRegister pointerRegister = WideRegister.BC;
            Register     source          = Register.A;
            byte         opcode          = 0x02;

            byte   loadValue = 0xe3;
            ushort pointer   = 0xdead;

            pointerRegister.SetValueOnProcessor(_cpu, pointer);
            source.SetValueOnProcessor(_cpu, loadValue);
            _ram[0] = opcode;

            // Act
            RunUntil(2);

            // Assert
            Assert.That(_ram[pointer], Is.EqualTo(loadValue));
        }
예제 #3
0
파일: LoadTests.cs 프로젝트: dolbz/Z80Sharp
        public void LoadRegisterPointerToRegister()
        {
            // Arrange
            // Again these 3 can be parameterized
            Register     destination = Register.A;
            WideRegister source      = WideRegister.HL;
            byte         opcode      = 0x7e;

            byte   value   = 0x1f;
            ushort pointer = 0x0bad;

            source.SetValueOnProcessor(_cpu, pointer);
            _ram[0]       = opcode;
            _ram[pointer] = value;

            // Act
            RunUntil(2);

            // Assert
            Assert.That(destination.GetValue(_cpu), Is.EqualTo(value));
        }
예제 #4
0
파일: LoadTests.cs 프로젝트: dolbz/Z80Sharp
        public void LoadImmediateToIndexedPointer()
        {
            // Arrange
            WideRegister indexRegister    = WideRegister.IX;
            byte         instructionByte1 = 0xdd;
            byte         instructionByte2 = 0x36;

            byte   loadValue = 0x86;
            ushort pointer   = 0xb00b;

            indexRegister.SetValueOnProcessor(_cpu, pointer);
            _ram[0] = instructionByte1;
            _ram[1] = instructionByte2;
            _ram[2] = 0xf;
            _ram[3] = loadValue;

            // Act
            RunUntil(5);

            // Assert
            Assert.That(_ram[pointer + 0xf], Is.EqualTo(loadValue));
        }
예제 #5
0
파일: LoadTests.cs 프로젝트: dolbz/Z80Sharp
        public void LoadRegisterToIndexedPointer()
        {
            // Arrange
            WideRegister indexRegister    = WideRegister.IY;
            Register     source           = Register.E;
            byte         instructionByte1 = 0xfd;
            byte         instructionByte2 = 0x73;

            byte   loadValue = 0x28;
            ushort pointer   = 0xdeaf;

            indexRegister.SetValueOnProcessor(_cpu, pointer);
            source.SetValueOnProcessor(_cpu, loadValue);
            _ram[0] = instructionByte1;
            _ram[1] = instructionByte2;
            _ram[2] = 0x10;

            // Act
            RunUntil(4);

            // Assert
            Assert.That(_ram[pointer + 0x10], Is.EqualTo(loadValue));
        }