Ejemplo n.º 1
0
        /// <summary>
        /// Emits the specified platform instruction.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="emitter">The emitter.</param>
        protected override void Emit(Context context, MachineCodeEmitter emitter)
        {
            if (context.OperandCount == 0)
            {
                int displacement = context.BranchTargets[0];

                if (IsBetween(displacement, -1024, 1022))
                {
                    emitter.EmitRelativeJumpAndCall(0x01, context.BranchTargets[0]);
                }
                else
                    if (IsBetween(displacement, -2097151, 2097150))
                    {
                        emitter.EmitNoRegisterAndK21(0x50, context.BranchTargets[0]);
                    }
                    else
                        throw new OverflowException();
            }
            else
                throw new Exception("Not supported combination of operands");
        }