Beispiel #1
0
        private ResultInfo InvokeCommand()
        {
            switch (_command)
            {
            case 0b_0000_0000_0000_1000:
                return(_literalControlOperations.RETURN());    //Return from Subroutine

            case 0b_0000_0000_0000_1001:
                return(_literalControlOperations.RETFIE());    //return from interrupt

            case 0b_0000_0000_0110_0011:
                return(_literalControlOperations.SLEEP());    //Go to standby mode

            case 0b_0000_0000_0110_0100:
                return(_literalControlOperations.CLRWDT()); //clear watchdog timer

            case 0b_0000_0000_0000_0000:                    // ab hier nop
            case 0b_0000_0000_0010_0000:
            case 0b_0000_0000_0100_0000:
            case 0b_0000_0000_0110_0000:
                return(_byteOperations.NOP());    //no operation

            case short n when(n >= 0b_0000_0001_0000_0000 && n <= 0b_0000_0001_0111_1111):
                return(_byteOperations.CLRW());    //clear w

            default:
                return(AnalyzeNibble3());
            }
        }
        public void RETFIE_Address()
        {
            _ram.SetupGet(p => p[MemoryConstants.INTCON_B1]).Returns(5);

            _mem.Object.PCStack.Push(0x_0f);
            int value = 5 | 0b_1000_0000;

            ResultInfo op_result = _opService.RETFIE();

            Assert.AreEqual(2, op_result.Cycles);
            Assert.IsTrue(op_result.ClearISR);
            Assert.AreEqual(0x_0f, op_result.OperationResults[0].Value);
            Assert.AreEqual(MemoryConstants.PCL_B1, op_result.OperationResults[0].Address);
            Assert.AreEqual(value, op_result.OperationResults[1].Value);
            Assert.AreEqual(MemoryConstants.INTCON_B1, op_result.OperationResults[1].Address);

            _ram.Verify(p => p[MemoryConstants.INTCON_B1]);
        }