/// <summary> /// Method for creating an object in memory. If object already exists /// an error is thrown. /// </summary> /// <param name="mem"></param> public static void Create(Memory mem) { if (instance != null) { throw new Exception("Object already created"); } instance = new CPU6502(mem); }
/// <summary> /// Writes data to PPUDMA register /// </summary> /// <param name="value"></param> private void writeDMA(byte value) { CPU6502 cpu = CPU6502.Instance; ushort addr = (ushort)(value << 8); for (int i = 0; i < 256; i++) { oamData[oamAddress] = cpu.RAM.ReadMemory(addr); oamAddress++; addr++; } cpu.Stall += 513; if (cpu.Cycle % 2 == 1) { cpu.Stall++; } }