public ReadOperands(UInt16 numberOfOperands, OperandTypes operandType, UInt16 startAddress) { m_numberOfOperands = numberOfOperands; m_OperandType = operandType; m_StartAddress = startAddress; m_timerValueFormat = TimerValueFormat.None; }
public WriteOperands(UInt16 numberOfOperands, OperandTypes operandType, UInt16 startAddress, object[] values) { m_numberOfOperands = numberOfOperands; m_OperandType = operandType; m_StartAddress = startAddress; m_Values = values; m_timerValueFormat = TimerValueFormat.None; }
// Функция обработки нессылочных операндов private bool LoadRealOperand(Lexeme Operand, out OperandTypes OperandType, out double OperandValue /*, out uint OperandIndex*/) { // Контроль операнда 1 switch (Operand.LexemeType) { case Lexeme.LexemeTypes.E: OperandType = OperandTypes.Number; OperandValue = Math.E; //OperandIndex = 0; return(true); case Lexeme.LexemeTypes.Number: OperandType = OperandTypes.Number; OperandValue = double.Parse(Operand.LexemeValue); //OperandIndex = 0; return(true); case Lexeme.LexemeTypes.Pi: OperandType = OperandTypes.Number; OperandValue = Math.PI; //OperandIndex = 0; return(true); case Lexeme.LexemeTypes.Variable: OperandType = OperandTypes.Variable; OperandValue = 0.0; //OperandIndex = Operand.LexemeIndex; return(true); // В остальных случаях инициализация считается неуспешной default: OperandType = OperandTypes.Nothing; OperandValue = 0.0; //OperandIndex = 0; return(false); } }
private int DetermineOp(string op, int lineCounter, out OperandTypes opType) { int op1 = 0; var regMatch = _regRegister.Match(op); var intMatch = _regInt.Match(op); if (regMatch.Success) { opType = OperandTypes.Register; switch (op) { case "FP": op1 = (int)SpeicalRegister.FP; break; case "SB": op1 = (int)SpeicalRegister.SB; break; case "SL": op1 = (int)SpeicalRegister.SL; break; case "SP": op1 = (int)SpeicalRegister.SP; break; case "PC": op1 = (int)SpeicalRegister.PC; break; default: string reg = op.Substring(1); op1 = int.Parse(reg); break; } } else if (intMatch.Success) { op1 = int.Parse(op); opType = OperandTypes.Immediate; } else { if (!_symbolTable.TryGetValue(op, out op1)) { throw new SyntaxError(string.Format("Label is not in symbol table. Label: {0} , line: {1}", op, lineCounter)); } opType = OperandTypes.Label; } return op1; }
// Returns the number of operans from a specific operand type. // The max openrad address is obviously Operand Count - 1 (Since the address starts with 0) internal int OperandCount(OperandTypes operandType) { return(m_OperandsCount[operandType]); }
public Operand(OperandTypes type, object value) { this.Type = type; this.Value = value; }
// Функция обработки ссылочных операндов private bool LoadLinkedOperand(uint Operand, out OperandTypes OperandType, out double LinkNumber) { OperandType = OperandTypes.Link; LinkNumber = Operand; return(true); }