public static int Ret(Opcode op, GbMemory mem) { byte low = mem.ReadCyclePop(); mem.R.Pc = new GbUInt16(mem.ReadCyclePop(), low); mem.Update(); mem.IME |= op.Dest != 0; // Unlike EI IME gets enabled right away. mem.NextIMEValue = mem.IME; return(4); }
/// <summary> /// Conditional Return. /// </summary> /// <param name="op">The opcode.</param> /// <param name="mem">The memory.</param> public static int RetC(Opcode op, GbMemory mem) { mem.Update(); if (GetConditionalJumpState(op.Dest, op.Src, mem.R.F)) { return(2); } byte low = mem.ReadCyclePop(); mem.R.Pc = new GbUInt16(mem.ReadCyclePop(), low); mem.Update(); return(5); }
public static int Pop(Opcode op, GbMemory mem) { if (op.Dest == 3) { mem.R.F = (byte)(mem.ReadCyclePop() & 0xF0); mem.R.A = mem.ReadCyclePop(); } else { mem.R.SetR8((op.Dest * 2) + 1, mem.ReadCyclePop()); mem.R.SetR8(op.Dest * 2, mem.ReadCyclePop()); } return(3); }