/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }