private bool readOpCode(out OpCodeValues opCodeValue) { var valueInt = _stream.ReadByte(); if (valueInt == -1) { opCodeValue = 0; return(false); } var xByteValue = (byte)valueInt; if (xByteValue == 0xFE) { valueInt = _stream.ReadByte(); if (valueInt == -1) { opCodeValue = 0; return(false); } opCodeValue = (OpCodeValues)(xByteValue << 8 | valueInt); } else { opCodeValue = (OpCodeValues)xByteValue; } return(true); }
private bool ReadOpCode(out OpCodeValues opCodeValue) { var valueInt = stream.ReadByte(); if (valueInt == -1) { opCodeValue = 0; return false; } var xByteValue = (byte)valueInt; if (xByteValue == 0xFE) { valueInt = stream.ReadByte(); if (valueInt == -1) { opCodeValue = 0; return false; } opCodeValue = (OpCodeValues)(xByteValue << 8 | valueInt); } else { opCodeValue = (OpCodeValues)xByteValue; } return true; }
public OpCode(OpCodeValues opcode, OperandType operand) { this.value = opcode; this.operand = operand; size = (int)opcode < 256 ? 1 : 2; prefix = (byte)((short)opcode >> 8); this.opcode = (byte)opcode; }
public static OpCode GetOpCode(this OpCodeValues code) { var value = (ushort)code; if (((uint)code & MultiBytePrefix) == MultiBytePrefix) { return(multiByteOpCodes[value & 0xff]); } return(singleByteOpCodes[value]); }
public static bool IsLabel(this OpCodeValues opCodeValue) { return(opCodeValue == OpCodeValues.Br_S || opCodeValue == OpCodeValues.Br || opCodeValue == OpCodeValues.Brfalse || opCodeValue == OpCodeValues.Brfalse_S || opCodeValue == OpCodeValues.Brtrue || opCodeValue == OpCodeValues.Brtrue_S || opCodeValue == OpCodeValues.Leave || opCodeValue == OpCodeValues.Leave_S); }
static (ControlLines[], ControlLines2[]) GenerateExtendedSet(Flags flags, OpCodeValues op) { switch (op) { case LD_SP_IMM16: return(LdReg16Imm16(SP)); case LD_IV_IMM16: return(LdReg16Imm16(IV)); case LD_B_ABS: return(LdReg8Abs(B)); case LD_C_ABS: return(LdReg8Abs(C)); case LD_D_ABS: return(LdReg8Abs(D)); case LD_E_ABS: return(LdReg8Abs(E)); case LD_H_ABS: return(LdReg8Abs(H)); case LD_L_ABS: return(LdReg8Abs(L)); case LD_BC_ABS: return(LdReg16Abs(BC)); case LD_DE_ABS: return(LdReg16Abs(DE)); case LD_IX_ABS: return(LdReg16Abs(IX)); case LD_IY_ABS: return(LdReg16Abs(IY)); case LD_SP_ABS: return(LdReg16Abs(BC)); case LD_IV_ABS: default: // we really would want to generate a fault, but that doesn't exist :D return(Nop()); // Do nothing; } }
internal OpCode(OpCodeValues value, int flags) { m_stringname = null; // computed lazily m_pop = (StackBehaviour)((flags >> StackBehaviourPopShift) & StackBehaviourMask); m_push = (StackBehaviour)((flags >> StackBehaviourPushShift) & StackBehaviourMask); m_operand = (OperandType)(flags & OperandTypeMask); m_type = (OpCodeType)((flags >> OpCodeTypeShift) & OpCodeTypeMask); m_size = (flags >> SizeShift) & SizeMask; m_s1 = (byte)((int)value >> 8); m_s2 = (byte)(int)value; m_ctrl = (FlowControl)((flags >> FlowControlShift) & FlowControlMask); m_endsUncondJmpBlk = (flags & EndsUncondJmpBlkFlag) != 0; m_stackChange = (flags >> StackChangeShift); }
// Token: 0x06004B86 RID: 19334 RVA: 0x0011210C File Offset: 0x0011030C internal OpCode(OpCodeValues value, int flags) { this.m_stringname = null; this.m_pop = (StackBehaviour)(flags >> 12 & 31); this.m_push = (StackBehaviour)(flags >> 17 & 31); this.m_operand = (OperandType)(flags & 31); this.m_type = (OpCodeType)(flags >> 9 & 7); this.m_size = (flags >> 22 & 3); this.m_s1 = (byte)(value >> 8); this.m_s2 = (byte)value; this.m_ctrl = (FlowControl)(flags >> 5 & 15); this.m_endsUncondJmpBlk = ((flags & 16777216) != 0); this.m_stackChange = flags >> 28; }
internal OpCode(OpCodeValues value, int flags) { m_value = value; m_flags = flags; }
private static bool IsSupportedOpCode(OpCodeValues currentOpCode) { return Enum.IsDefined(typeof(OpCodeValues), currentOpCode); }
private static bool IsSupportedOpCode(OpCodeValues currentOpCode) { return(Enum.IsDefined(typeof(OpCodeValues), currentOpCode)); }
static (ControlLines[], ControlLines2[]) GenerateNormalSet(Flags flags, OpCodeValues op) { switch (op) { case LD_A_IMM8: return(LdAImm8()); case LD_B_IMM8: return(LdReg8Imm8(B)); case LD_C_IMM8: return(LdReg8Imm8(C)); case LD_D_IMM8: return(LdReg8Imm8(D)); case LD_E_IMM8: return(LdReg8Imm8(E)); case LD_H_IMM8: return(LdReg8Imm8(H)); case LD_L_IMM8: return(LdReg8Imm8(L)); case LD_BC_IMM16: return(LdReg16Imm16(BC)); case LD_DE_IMM16: return(LdReg16Imm16(DE)); case LD_HL_IMM16: return(LdReg16Imm16(HL)); case LD_IX_IMM16: return(LdReg16Imm16(IX)); case LD_IY_IMM16: return(LdReg16Imm16(IY)); case LD_A_ABS: return(LdAAbs()); case LD_HL_ABS: return(LdReg16Abs(HL)); case LD_A_IND_BC: return(LdAInd(BC)); case LD_HL_IND_BC: return(LdReg16Ind(HL, BC)); case LD_A_IND_DE: return(LdAInd(DE)); case LD_HL_IND_DE: return(LdReg16Ind(HL, DE)); case LD_A_IND_HL: return(LdAInd(HL)); case LD_B_IND_HL: return(LdReg8Ind(B, HL)); case LD_C_IND_HL: return(LdReg8Ind(C, HL)); case LD_D_IND_HL: return(LdReg8Ind(D, HL)); case LD_E_IND_HL: return(LdReg8Ind(E, HL)); case LD_H_IND_HL: return(LdReg8Ind(H, HL)); case LD_L_IND_HL: return(LdReg8Ind(L, HL)); case LD_A_IND_IX: return(LdAInd(IX)); case LD_A_IND_IY: return(LdAInd(IY)); case LD_A_IND_SP: return(LdAInd(SP)); /*case JL_IMM16: * return JlImm16(); * case JL_HL: * return JlReg16(HL);*/ case NOP: default: return(Nop()); // Do nothing; } }
public UnsupportedInstructionException(OpCodeValues instruction) { Instruction = instruction; }