private Expression TestFromCondition(CondCode c) { ConditionCode cc; FlagGroupStorage flagGroup; switch (c) { case CondCode.cc_Z: cc = ConditionCode.EQ; flagGroup = Registers.Z; break; case CondCode.cc_NZ: cc = ConditionCode.EQ; flagGroup = Registers.Z; break; case CondCode.cc_V: cc = ConditionCode.OV; flagGroup = Registers.V; break; case CondCode.cc_NV: cc = ConditionCode.NO; flagGroup = Registers.V; break; case CondCode.cc_N: cc = ConditionCode.LT; flagGroup = Registers.N; break; case CondCode.cc_NN: cc = ConditionCode.GE; flagGroup = Registers.N; break; case CondCode.cc_C: cc = ConditionCode.ULT; flagGroup = Registers.C; break; case CondCode.cc_NC: cc = ConditionCode.UGE; flagGroup = Registers.C; break; case CondCode.cc_SGT: cc = ConditionCode.GT; flagGroup = _ZV_N; break; case CondCode.cc_SLE: cc = ConditionCode.LE; flagGroup = _ZV_N; break; case CondCode.cc_SLT: cc = ConditionCode.LT; flagGroup = __V_N; break; case CondCode.cc_SGE: cc = ConditionCode.GE; flagGroup = __V_N; break; case CondCode.cc_UGT: cc = ConditionCode.UGT; flagGroup = _Z_C_; break; case CondCode.cc_ULE: cc = ConditionCode.ULE; flagGroup = _Z_C_; break; default: throw new NotImplementedException($"Not implemented cc: {c}"); } return(m.Test(cc, binder.EnsureFlagGroup(flagGroup))); }
public ConditionOperand(CondCode code) : base(PrimitiveType.Byte) { this.Code = code; }
public ConditionalOperand(CondCode cc) : base(PrimitiveType.Bool) { this.CondCode = cc; }
private void ConditionalEditor_Shown(object sender, EventArgs e) { cbType.SelectedIndex = 0; cbComp.SelectedIndex = 0; if (!isEditing) { tbCodes.Text = String.Join("\r\n", code.Split(new char[] { '\r', '\n' })); cond = new CondCode(); cond.addr = 0; cond.codes = tbCodes.Text; cond.value = "00000000"; cond.type = CodeType.Hex; } else { Form1.ncCode ncCd = codes.ParseCodeStringFull(code)[0]; string text = ""; // ncCd.codeType.ToString() + " " + ncCd.codeArg1.ToString("X8") + " " + misc.ByteAToStringHex(ncCd.codeArg2, "") + "\r\n"; int selStart = rtb.SelectionStart, selEnd = 0; SelStart = selStart; while (rtb.Text[selStart] != '\n') { selStart++; } selStart++; for (int x = (int)ncCd.codeArg0; x > 0;) { if (selStart >= rtb.Text.Length) { break; } selEnd = selStart + 1; while (selEnd < rtb.Text.Length && rtb.Text[selEnd] != '\n') { selEnd++; } string line = rtb.Text.Substring(selStart, selEnd - selStart); if (codes.ParseCodeStringFull(line)[0].codeType != '\0') { text += line + "\r\n"; x--; } else { text += ((line.IndexOf("\n") >= 0 && line.IndexOf("\r") < 0) ? line.Replace("\n", "\r\n") : line) + "\r\n"; } selStart = selEnd + 1; } SelEnd = selEnd; cond = new CondCode(); cond.addr = (uint)ncCd.codeArg1; cond.codes = text; cond.value = misc.ByteAToStringHex(ncCd.codeArg2, ""); cond.type = CodeType.Hex; tbCodes.Text = text; tbAddr.Text = ncCd.codeArg1.ToString("X8"); tbValue.Text = cond.value; cbType.SelectedIndex = 0; cbComp.SelectedIndex = ncCd.codeType.ToString().ToUpper() == "D" ? 0 : 1; } }