public override void Execute(PICController controller) { uint a = controller.GetBankedRegister(Register); uint b = controller.GetWRegister(); bool carry; bool dc = BinaryHelper.getSubtractionDigitCarry(a, b); if (carry = a < b) { a += 0x100; } uint Result = a - b; controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, (Result % 0x100) == 0); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_DC, dc); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C, !carry); Result %= 0x100; if (Target) { controller.SetBankedRegister(Register, Result); } else { controller.SetWRegister(Result); } }
public override void Execute(PICController controller) { bool Cond = TestCondition(controller); uint Result = controller.GetBankedRegister(Register); if (Result == 0) { Result = 0xFF; } else { Result -= 1; } if (Target) { controller.SetBankedRegister(Register, Result); } else { controller.SetWRegister(Result); } if (Cond) { controller.SetPC_13Bit(controller.GetPC() + 1); } }
public override void Execute(PICController controller) { uint Result = controller.GetBankedRegister(Register); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, Result == 0); if (Target) { controller.SetBankedRegister(Register, Result); } else { controller.SetWRegister(Result); } }
public override void Execute(PICController controller) { uint Result = controller.GetBankedRegister(Register); uint Low = Result & 0x0F; uint High = Result & 0xF0; Result = (Low << 4) | (High >> 4); if (Target) { controller.SetBankedRegister(Register, Result); } else { controller.SetWRegister(Result); } }
public override void Execute(PICController controller) { uint Result = controller.GetBankedRegister(Register); uint Carry_Old = controller.GetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C) ? 1u : 0u; uint Carry_New = (Result & 0x80) >> 7; Result = Result << 1; Result &= 0xFF; Result |= Carry_Old; controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C, Carry_New != 0); if (Target) { controller.SetBankedRegister(Register, Result); } else { controller.SetWRegister(Result); } }
public override void Execute(PICController controller) { uint a = controller.GetBankedRegister(Register); uint b = controller.GetWRegister(); uint Result = a + b; bool dc = BinaryHelper.getAdditionDigitCarry(a, b); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, (Result % 0x100) == 0); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_DC, dc); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C, Result > 0xFF); Result %= 0x100; if (Target) { controller.SetBankedRegister(Register, Result); } else { controller.SetWRegister(Result); } }
public override void Execute(PICController controller) { controller.SetBankedRegister(Register, 0x00); controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, true); }
public override void Execute(PICController controller) { controller.SetBankedRegister(Register, controller.GetWRegister()); }