Пример #1
0
		public InstructionArg this[int idx]
		{
			get
			{
				switch(idx)
				{
					case 0:
						return Arg1;
					case 1:
						return Arg2;
					case 2:
						return Arg3;
					default:
						throw new Exception("Invalid arg index!");
				}
			}
			set
			{
				switch(idx)
				{
					case 0:
						Arg1 = value;
						break;
					case 1:
						Arg2 = value;
						break;
					case 2:
						Arg3 = value;
						break;
					default:
						throw new Exception("Invalid arg index!");
				}
			}
		}
Пример #2
0
		public void RequestParameters(InstructionArg arg, bool hasSizeArg, CodeParameterDeclarationExpressionCollection prs)
		{
			if (hasSizeArg)
			{
				switch (ID)
				{
					case None_ID:
						return;
					case Imm8_ID:
					case Imm16_ID:
					case Imm32_ID:
						prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.UInt, arg.Name + ImmArgSuffix) 
							{
								DefaultValueExpression = (arg.DefaultValue.HasValue ? new CodePrimitiveExpression(arg.DefaultValue.Value) : null) 
							}
						);
						return;
						
					default:
						break;
				}
			}
			switch (ID)
			{
				case None_ID:
					break;
				case Dis8_ID:
					prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.SByte, arg.Name + DisArgSuffix));
					break;
				case Dis16_ID:
					prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.Short, arg.Name + DisArgSuffix));
					break;
				case Dis32_ID:
					prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.Int, arg.Name + DisArgSuffix));
					break;

				case Imm8_ID:
					prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.Byte, arg.Name + ImmArgSuffix) 
						{
							DefaultValueExpression = (arg.DefaultValue.HasValue ? new CodePrimitiveExpression(arg.DefaultValue.Value) : null) 
						}
					);
					return;
				case Imm16_ID:
					prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.UShort, arg.Name + ImmArgSuffix) 
						{
							DefaultValueExpression = (arg.DefaultValue.HasValue ? new CodePrimitiveExpression(arg.DefaultValue.Value) : null) 
						}
					);
					return;
				case Imm32_ID:
					prs.Add(new CodeParameterDeclarationExpression(StaticTypeReferences.UInt, arg.Name + ImmArgSuffix) 
						{
							DefaultValueExpression = (arg.DefaultValue.HasValue ? new CodePrimitiveExpression(arg.DefaultValue.Value) : null) 
						}
					);
					return;

				default:
					foreach (CustomInstructionArgParameter p in mParameters.Values)
					{
						prs.Add(new CodeParameterDeclarationExpression(FieldTypeRegistry.Fields[p.ArgType].CodeType, arg.Name + p.ArgNameSuffix));
					}
					return;
			}
		}