Ejemplo n.º 1
0
        public static ushort GetZeroPage(MOS6502 CPU)
        {
            var pc = CPU.ReadNextByte();

            CPU.IncrementPC();

            return(pc);
        }
Ejemplo n.º 2
0
        public static ushort GetAbsolute(MOS6502 CPU)
        {
            var nextShort = CPU.ReadNextShort();

            CPU.IncrementPC(2);

            return(nextShort);
        }
Ejemplo n.º 3
0
        public static ushort GetAbsoluteX(MOS6502 CPU)
        {
            intermediateAddress = CPU.ReadNextShort();
            var nextShort = (ushort)(intermediateAddress + CPU.Registers.X);

            CPU.IncrementPC(2);

            return(nextShort);
        }
Ejemplo n.º 4
0
        public static ushort GetImmediate(MOS6502 CPU)
        {
            var pc = CPU.Registers.PC.Read();

            operandValue = CPU.ReadNextByte(isCycle: false);

            CPU.IncrementPC();

            return(pc);
        }
Ejemplo n.º 5
0
        public static ushort GetZeroPageY(MOS6502 CPU)
        {
            intermediateAddress = CPU.ReadNextByte();
            var address = (ushort)(intermediateAddress + CPU.Registers.Y);

            address &= 0xFF;

            CPU.CycleFinished();
            CPU.IncrementPC();

            return(address);
        }
Ejemplo n.º 6
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));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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);
        }