public void BIT(OpcodeContainer container, ushort address) { var value = CPU.ReadByteAt(address); CPU.IsOverflowed = (value & 0x40) != 0; CPU.IsNegative = (value & 0x80) != 0; CPU.IsZero = (value & CPU.Registers.A) == 0; }
public static ushort GetIndirectX(MOS6502 CPU) { var incompleteXAddress = CPU.ReadNextByte(); CPU.IncrementPC(); var intermediateAddress = (byte)(incompleteXAddress + CPU.Registers.X); return(intermediateAddress == 0xFF ? (ushort)(CPU.ReadByteAt(0xFF) | CPU.ReadByteAt(0x00) << 8) : CPU.ReadShortAt(intermediateAddress)); }
public static ushort GetIndirectYWrite(MOS6502 CPU) { intermediateAddress = CPU.ReadNextByte(); CPU.IncrementPC(); var baseAddress = intermediateAddress == 0xFF ? (ushort)(CPU.ReadByteAt(0xFF) | CPU.ReadByteAt(0x00) << 8) : CPU.ReadShortAt((ushort)intermediateAddress); CPU.CycleFinished(); return((ushort)(baseAddress + CPU.Registers.Y)); }
public static ushort GetIndirect(MOS6502 CPU) { intermediateAddress = CPU.ReadNextShort(); // 6502 bug in indirect JMP... if ((intermediateAddress & 0x00FF) == 0xFF) { byte lowByte = CPU.ReadByteAt(intermediateAddress); byte highByte = CPU.ReadByteAt((ushort)(intermediateAddress - 0x00FF)); return((ushort)(highByte << 8 | lowByte)); } return(CPU.ReadShortAt(intermediateAddress)); }
public static ushort GetIndirectY(MOS6502 CPU) { intermediateAddress = CPU.ReadNextByte(); CPU.IncrementPC(); var baseAddress = intermediateAddress == 0xFF ? (ushort)(CPU.ReadByteAt(0xFF) | CPU.ReadByteAt(0x00) << 8) : CPU.ReadShortAt((ushort)intermediateAddress); var finalAddress = (ushort)(baseAddress + CPU.Registers.Y); if (AddressingMode.NotSamePage(baseAddress, CPU.Registers.Y)) { CPU.CycleFinished(); } return(finalAddress); }