Exemple #1
0
        public void NoKeyPressedIsSendedBySpectrumRom()
        {
            // --- Arrange
            var machine = new SpectrumKeyboardTestMachine();

            // --- Act
            machine.CallIntoRom(SpectrumKeyboardTestMachine.KEY_SCAN);

            // --- Assert
            machine.Cpu.Registers.DE.ShouldBe((ushort)0xFFFF);
        }
Exemple #2
0
        private void TestSingleKeyPress(SpectrumKeyCode key, byte romCode)
        {
            // --- Arrange
            var machine = new SpectrumKeyboardTestMachine();

            machine.KeyboardDevice.SetStatus(key, true);

            // --- Act
            machine.CallIntoRom(SpectrumKeyboardTestMachine.KEY_SCAN);

            // --- Assert
            var regs = machine.Cpu.Registers;

            regs.D.ShouldBe((byte)0xFF);
            regs.E.ShouldBe(romCode);
            regs.ZFlag.ShouldBeTrue();
        }