예제 #1
0
파일: X86.cs 프로젝트: Verlio-H/URCL.NET
 private static Operand GetA(UrclInstruction instruction)
 {
     return(instruction.AType switch
     {
         OperandType.None => Operand.Imm("0"),
         OperandType.Register => instruction.A == 0 ? Operand.Imm("0") : Operand.Abs(((instruction.A - 1) * 2) + RegistersOffset),
         OperandType.Immediate => Operand.Imm(instruction.A.ToString()),
         OperandType.Label => Operand.Imm(LabelToString(instruction.ALabel)),
         _ => throw new ArgumentException($"Unsupported operand type {instruction.AType}.", "A"),
     });