public void LSR(OpcodeContainer container, ushort address) { switch (container.AddressingMode) { case AddressingModes.Accumulator: CPU.IsCarry = (CPU.Registers.A & 1) == 1; CPU.Registers.A.Write((byte)(CPU.Registers.A >> 1)); CPU.IsNegative = false; this.HandleZero(CPU.Registers.A); break; default: var value = CPU.ReadByteAt(address); CPU.IsCarry = (value & 1) == 1; byte shiftedValue = (byte)(value >> 1); // Spin cycle for the work above. CPU.CycleFinished(); CPU.WriteByteAt(address, shiftedValue); CPU.IsNegative = false; this.HandleZero(shiftedValue); break; } }