Exemple #1
0
        private ResultInfo AnalyzeNibble3()
        {
            int nibble3 = (int)_command & 0b_0011_0000_0000_0000; //bitoperation nur auf int ausführbar

            switch (nibble3)
            {
            case 0b_0010_0000_0000_0000:
                int bit12   = (int)_command & 0b_0000_1000_0000_0000;
                int address = (int)_command & 0b_0000_0111_1111_1111;
                if (bit12 == 0b_0000_1000_0000_0000)
                {
                    return(_literalControlOperations.GOTO(address));
                }
                else
                {
                    return(_literalControlOperations.CALL(address));
                }

            case 0b_0001_0000_0000_0000:     //bit oriented operations
                return(AnalyzeBits11_12());

            case 0b_0011_0000_0000_0000:     //literal operations
                return(AnalyzeNibble2Literal());

            case 0b_0000_0000_0000_0000:     //byte oriented operations
                return(AnalyzeNibble2Byte());

            default:
                return(null);
            }
        }
        public void Goto()
        {
            _ram.SetupGet(p => p[MemoryConstants.PCLATH_B1]).Returns(8);

            int address = 0x_0f;
            int newPc   = address + (8 << 8);

            ResultInfo op_result = _opService.GOTO(address);

            Assert.AreEqual(newPc, op_result.JumpAddress);
            Assert.AreEqual(2, op_result.Cycles);
            Assert.AreEqual(0x_0f, op_result.OperationResults[0].Value);
            Assert.AreEqual(MemoryConstants.PCL_B1, op_result.OperationResults[0].Address);

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