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 SWAPF() { _ram.SetupGet(p => p[_file]).Returns(0x_A5); ResultInfo op_result = _opService.SWAPF(_file, _d1); Assert.AreEqual(1, op_result.Cycles); Assert.AreEqual(1, op_result.PCIncrement); Assert.AreEqual(0x_5A, op_result.OperationResults[0].Value); Assert.AreEqual(_file, op_result.OperationResults[0].Address); _ram.Verify(p => p[_file]); }