public static OpCodeDef GetOpCode(string opName) { OpCodeDef o = opcodes.Find( (OpCodeDef op) => { return(op.Name == opName); } ); if (o == null) { throw new Exception(opName + " has no modes!"); } return(o); }
public static bool SupportsMode(string opCode, string mode) { OpCodeDef o = opcodes.Find( (OpCodeDef op) => { return(op.Name == opCode); } ); if (o == null) { throw new Exception(opCode + " has no modes!"); } return(o.SupportsMode(mode)); }
/// <summary> /// Adds a mode to the opcode def table /// </summary> /// <param name="opcode"></param> /// <param name="mode"></param> /// <param name="byte1"></param> /// <param name="byte2"></param> /// <param name="byte3"></param> private static void AddMode(string opcode, OperandMode mode, byte byte1, byte byte2 = 0, byte byte3 = 0) { byte[] codes; if (byte3 != 0 && byte2 != 0) { codes = new byte[] { byte1, byte2, byte3 }; } else if (byte3 == 0 && byte2 != 0) { codes = new byte[] { byte1, byte2 }; } else { codes = new byte[] { byte1 }; } OpCodeDef op = opcodes.Find( (o) => { return(o.Name == opcode); } ); if (op == null) { throw new Exception("Opcode " + opcode + " not found while trying to add mode" + mode.ToString()); } op.AddMode(mode, codes); }