示例#1
0
        /// <summary>
        /// Goes to a label (Arg1).
        /// </summary>
        /// <param name="Args">An int that specifies the address to go to.</param>
        public static void Goto(ref ScriptArguments Args)
        {
            var Thread = Args.GetThread();
            int Arg1   = Args.GetIntParameter(0);

            Thread.ProgramCounter = (uint)(Arg1 < 0 ? Thread.BaseAddress - Arg1 : Arg1);
        }
示例#2
0
        /// <summary>
        /// Ends a thread on the ScriptMachine.
        /// </summary>
        /// <param name="Args">A ScriptArguments instance.</param>
        public static void EndThread(ref ScriptArguments Args)
        {
            SCMThread Thread = Args.GetThread();

            Thread.WakeCounter = -1;
            Thread.Finished    = true;
        }
示例#3
0
        /// <summary>
        /// Waits for a specified number of millisecs.
        /// Opcode: 0001
        /// </summary>
        /// <param name="Args">An instance of ScriptArguments.</param>
        public static void Wait(ref ScriptArguments Args)
        {
            int Time = Args.GetIntParameter(0);

            Debug.Assert(Time >= 0, "negative wait time is not supported");
            var Thread = Args.GetThread();

            // Scripts use wait 0 to yield
            Thread.WakeCounter = Time > 0 ? Time : -1;
        }