ReadUInt32() public method

public ReadUInt32 ( ) : uint
return uint
Beispiel #1
0
        /// <summary>
        /// Call a function; push the instruction pointer and jump to the given address.
        /// </summary>
        public static HITResult Call(HITThread thread)
        {
            uint targ = thread.ReadUInt32();

            thread.Stack.Push((int)thread.PC);
            thread.PC = PCTrans(targ, thread);

            return(HITResult.CONTINUE);
        }
Beispiel #2
0
        /// <summary>
        /// If the sign flag is set or the zero flag is set, jump to the given address.
        /// </summary>
        public static HITResult IfLessOrEq(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (thread.SignFlag || thread.ZeroFlag)
            {
                thread.PC = PCTrans(loc, thread);                                     //last set/compare result was <= 0
            }
            return(HITResult.CONTINUE);
        }
Beispiel #3
0
        /// <summary>
        /// If the sign flag is not set and the zero flag is not set, jump to the given address
        /// </summary>
        public static HITResult IfGreater(HITThread thread) //0x40
        {
            var loc = thread.ReadUInt32();

            if (!thread.SignFlag && !thread.ZeroFlag)
            {
                thread.PC = PCTrans(loc, thread);                                       //last set/compare result was > 0
            }
            return(HITResult.CONTINUE);
        }
Beispiel #4
0
        /// <summary>
        /// If the sign flag is not set, jump to the given address.
        /// </summary>
        public static HITResult IfGreatOrEq(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (!thread.SignFlag)
            {
                thread.PC = loc;                   //last set/compare result was >= 0
            }
            return(HITResult.CONTINUE);
        }
Beispiel #5
0
        /// <summary>
        /// If the zero flag is not set, jump to the given address.
        /// </summary>
        public static HITResult IfNotEqual(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (!thread.ZeroFlag)
            {
                thread.PC = PCTrans(loc, thread);
            }

            return(HITResult.CONTINUE);
        }
Beispiel #6
0
        /// <summary>
        /// If the zero flag is set, jump to the given address.
        /// </summary>
        public static HITResult IfEqual(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (thread.ZeroFlag)
            {
                thread.PC = loc;
            }

            return(HITResult.CONTINUE);
        }
Beispiel #7
0
        /// <summary>
        /// Jump to a given address.
        /// </summary>
        public static HITResult Jump(HITThread thread)
        {
            var read = thread.ReadByte();

            if (read > 15)   //literal
            {
                thread.PC--; //backtraaackkk
                thread.PC = PCTrans(thread.ReadUInt32(), thread);
            }
            else //no idea if there are collisions. if there are i'm blaming fatbag. >:)
            {
                thread.PC = PCTrans((uint)thread.ReadVar(read), thread);
                if (thread.ReadByte() == 0)
                {
                    thread.PC += 2;                         //if next is no-op, the operand is 4 byte
                }
                else
                {
                    thread.PC--;  //operand is 1 byte (next is an instruction), backtrack
                }
            }

            return(HITResult.CONTINUE);
        }
Beispiel #8
0
        /// <summary>
        /// Jump to a given address.
        /// </summary>
        public static HITResult Jump(HITThread thread)
        {
            var read = thread.ReadByte();

            if (read > 15) //literal
            {
                thread.PC--; //backtraaackkk
                thread.PC = thread.ReadUInt32();
            }
            else //no idea if there are collisions. if there are i'm blaming fatbag. >:)
            {
                thread.PC = (uint)thread.ReadVar(read);
                if (thread.ReadByte() == 0) thread.PC += 2; //if next is no-op, the operand is 4 byte
                else thread.PC--; //operand is 1 byte (next is an instruction), backtrack
            }

            return HITResult.CONTINUE;
        }
Beispiel #9
0
        /// <summary>
        /// If the zero flag is not set, jump to the given address.
        /// </summary>
        public static HITResult IfNotEqual(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (!thread.ZeroFlag) thread.PC = loc;

            return HITResult.CONTINUE;
        }
Beispiel #10
0
        /// <summary>
        /// If the sign flag is set or the zero flag is set, jump to the given address.
        /// </summary>
        public static HITResult IfLessOrEq(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (thread.SignFlag || thread.ZeroFlag) thread.PC = loc; //last set/compare result was <= 0

            return HITResult.CONTINUE;
        }
Beispiel #11
0
        /// <summary>
        /// If the sign flag is not set, jump to the given address.
        /// </summary>
        public static HITResult IfGreatOrEq(HITThread thread)
        {
            var loc = thread.ReadUInt32();

            if (!thread.SignFlag) thread.PC = loc; //last set/compare result was >= 0

            return HITResult.CONTINUE;
        }
Beispiel #12
0
        /// <summary>
        /// Call a function; push the instruction pointer and jump to the given address.
        /// </summary>
        public static HITResult Call(HITThread thread)
        {
            uint targ = thread.ReadUInt32();
            thread.Stack.Push((int)thread.PC);
            thread.PC = targ;

            return HITResult.CONTINUE;
        }