private ResultInfo AnalyzeNibble2Byte() { int nibble2 = (int)_command & 0b_0000_1111_0000_0000; int file = (int)_command & 0b_0000_0000_0111_1111; int d = ((int)_command & 0b_0000_0000_1000_0000) >> 7; switch (nibble2) { case 0b_0000_0000_0000_0000: return(_byteOperations.MOVWF(file)); case 0b_0000_0001_0000_0000: return(_byteOperations.CLRF(file)); case 0b_0000_0010_0000_0000: return(_byteOperations.SUBWF(file, d)); case 0b_0000_0011_0000_0000: return(_byteOperations.DECF(file, d)); case 0b_0000_0100_0000_0000: return(_byteOperations.IORWF(file, d)); case 0b_0000_0101_0000_0000: return(_byteOperations.ANDWF(file, d)); case 0b_0000_0110_0000_0000: return(_byteOperations.XORWF(file, d)); case 0b_0000_0111_0000_0000: return(_byteOperations.ADDWF(file, d)); case 0b_0000_1000_0000_0000: return(_byteOperations.MOVF(file, d)); case 0b_0000_1001_0000_0000: return(_byteOperations.COMF(file, d)); case 0b_0000_1010_0000_0000: return(_byteOperations.INCF(file, d)); case 0b_0000_1011_0000_0000: return(_byteOperations.DECFSZ(file, d)); case 0b_0000_1100_0000_0000: return(_byteOperations.RRF(file, d)); case 0b_0000_1101_0000_0000: return(_byteOperations.RLF(file, d)); case 0b_0000_1110_0000_0000: return(_byteOperations.SWAPF(file, d)); case 0b_0000_1111_0000_0000: return(_byteOperations.INCFSZ(file, d)); default: return(null); } }
public void ADDWF_d0() { _ram.SetupGet(p => p[_file]).Returns(10); _mem.SetupGet(p => p.WReg).Returns(250); ResultInfo op_result = _opService.ADDWF(_file, _d1); Assert.AreEqual(10, op_result.OverflowInfo.Operand1); Assert.AreEqual(250, op_result.OverflowInfo.Operand2); Assert.AreEqual("+", op_result.OverflowInfo.Operator); Assert.AreEqual(1, op_result.Cycles); Assert.AreEqual(1, op_result.PCIncrement); Assert.IsTrue(op_result.CheckZ); Assert.AreEqual(260, op_result.OperationResults[0].Value); Assert.AreEqual(_file, op_result.OperationResults[0].Address); _ram.Verify(p => p[_file]); _mem.Verify(p => p.WReg); }