public InstructionLogicResult ExecuteWithByte(CPU cpu, Memory mem, byte value, AddrModeCalcResult addrModeCalcResult) { BinaryArithmeticHelpers.SetFlagsAfterCompare(cpu.A, value, cpu.ProcessorStatus); return(InstructionLogicResult.WithExtraCycles( InstructionExtraCyclesCalculator.CalculateExtraCycles( addrModeCalcResult.OpCode.AddressingMode, addrModeCalcResult.AddressCalculationCrossedPageBoundary) )); }
public InstructionLogicResult ExecuteWithByte(CPU cpu, Memory mem, byte value, AddrModeCalcResult addrModeCalcResult) { bool branchSucceeded = false; bool addressCalculationCrossedPageBoundary = false; if(!cpu.ProcessorStatus.Carry) { // The instruction value is signed byte with the relative address (positive or negative) cpu.PC = BranchHelper.CalculateNewAbsoluteBranchAddress(cpu.PC, (sbyte)value, out ulong _, out addressCalculationCrossedPageBoundary); branchSucceeded = true; } return InstructionLogicResult.WithExtraCycles( InstructionExtraCyclesCalculator.CalculateExtraCyclesForBranchInstructions( branchSucceeded, addressCalculationCrossedPageBoundary) ); }