private void LaunchBootROMToolStripMenuItem_Click(object sender, EventArgs e) { CPU cpu = new CPU(); RAM ram = new RAM(); ROM rom = new ROM(); //ram = rom.LoadROM(ram, @"C:\Users\Taireru\source\repos\MatrixGB\DMG_ROM.bin"); ram = rom.LoadROM(ram, @"C:\Users\Taireru\source\repos\MatrixGB\06-ld r,r.gb"); cpu.ProgramCounter = 0x100; //byte[] ROMBytes = File.ReadAllBytes(@"C:\Users\Taireru\source\repos\MatrixGB\06-ld r,r.gb"); cpu.RunROM(ram); }
public RAM LoadROM(RAM ram, string Path) { CurrentROM = File.ReadAllBytes(Path); switch (CurrentROM[0x147]) { default: throw new NotImplementedException("Cartridge Type: " + CurrentROM[0x147] + " is not implemented!!!"); case 0: ROMOnly = true; break; case 1: IsMBC1 = true; break; case 2: IsMBC1 = true; break; case 3: IsMBC1 = true; break; case 5: IsMBC2 = true; break; case 6: IsMBC2 = true; break; } Array.Copy(CurrentROM, 0, ram.Memory, 0, 0x7FFF); return(ram); }