示例#1
0
        /// <summary>
        /// Calculate a special debug opcode that sets a position entry.
        /// </summary>
        /// <returns>True if the special opcode is valid, false otherwise</returns>
        private static bool TryCalculateSpecialOpcode(int lineAdv, int addressAdv, out DebugOpCodes opcode)
        {
            const int lineBase  = -4;
            const int lineRange = 15;

            opcode = DebugOpCodes.Special;
            if ((lineAdv < -4) || (lineAdv > 10) || (addressAdv > 16))
            {
                return(false);
            }

            if (addressAdv < 0)
            {
                throw new ArgumentOutOfRangeException("addressAdv > 0");
            }

            var adjusted    = (lineAdv - lineBase) + (addressAdv * lineRange);
            var opcodeAsInt = (int)DebugOpCodes.Special + adjusted;
            var result      = (opcodeAsInt >= 0x0A) && (opcodeAsInt <= 0xFF);

            opcode = result ? (DebugOpCodes)opcodeAsInt : DebugOpCodes.Special;
            return(result);
        }
示例#2
0
        /// <summary>
        /// Calculate a special debug opcode that sets a position entry.
        /// </summary>
        /// <returns>True if the special opcode is valid, false otherwise</returns>
        private static bool TryCalculateSpecialOpcode(int lineAdv, int addressAdv, out DebugOpCodes opcode)
        {
            const int lineBase = -4;
            const int lineRange = 15;

            opcode = DebugOpCodes.Special;
            if ((lineAdv < -4) || (lineAdv > 10) || (addressAdv > 16))
                return false;

            if (addressAdv < 0)
                throw new ArgumentOutOfRangeException("addressAdv > 0");

            var adjusted = (lineAdv - lineBase) + (addressAdv * lineRange);
            var opcodeAsInt = (int)DebugOpCodes.Special + adjusted;
            var result = (opcodeAsInt >= 0x0A) && (opcodeAsInt <= 0xFF);
            opcode = result ? (DebugOpCodes) opcodeAsInt : DebugOpCodes.Special;
            return result;
        }
示例#3
0
 public DebugInstruction(DebugOpCodes opCode, IEnumerable <object> operands)
 {
     this.opCode   = opCode;
     this.operands = new List <object>(operands);
 }
示例#4
0
 public DebugInstruction(DebugOpCodes opCode, params object[] operands)
     : this(opCode, (IEnumerable <object>)operands)
 {
 }
示例#5
0
 public DebugInstruction(DebugOpCodes opCode, IEnumerable<object> operands)
 {
     this.opCode = opCode;
     this.operands = new List<object>(operands);
 }
示例#6
0
 public DebugInstruction(DebugOpCodes opCode, params object[] operands)
     : this(opCode, (IEnumerable<object>)operands)
 {
 }