コード例 #1
0
ファイル: Switch.cs プロジェクト: invisal/Cosmos
 public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
 {
     ILOpCodes.OpSwitch OpSw = (ILOpCodes.OpSwitch)aOpCode;
     XS.Pop(XSRegisters.EAX);
     for (int i = 0; i < OpSw.BranchLocations.Length; i++)
     {
         XS.Compare(XSRegisters.EAX, ( uint )i);
         //string DestLabel = AssemblerNasm.TmpBranchLabel( aMethod, new ILOpCodes.OpBranch( ILOpCode.Code.Jmp, aOpCode.Position, OpSw.BranchLocations[ i ] ) );
         string xDestLabel = AppAssembler.TmpPosLabel(aMethod, OpSw.BranchLocations[i]);
         XS.Jump(CPUx86.ConditionalTestEnum.Equal, xDestLabel);
     }
 }
コード例 #2
0
 public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
 {
     ILOpCodes.OpSwitch OpSw = (ILOpCodes.OpSwitch)aOpCode;
     new CPUx86.Pop {
         DestinationReg = CPUx86.Registers.EAX
     };
     for (int i = 0; i < OpSw.BranchLocations.Length; i++)
     {
         new CPUx86.Compare {
             DestinationReg = CPUx86.Registers.EAX, SourceValue = ( uint )i
         };
         //string DestLabel = AssemblerNasm.TmpBranchLabel( aMethod, new ILOpCodes.OpBranch( ILOpCode.Code.Jmp, aOpCode.Position, OpSw.BranchLocations[ i ] ) );
         string xDestLabel = AppAssembler.TmpPosLabel(aMethod, OpSw.BranchLocations[i]);
         new CPUx86.ConditionalJump {
             Condition          = CPUx86.ConditionalTestEnum.Equal
             , DestinationLabel = xDestLabel
         };
     }
 }