/// <summary> /// Same as memcpy, but copies from cart rom /// The code section( >= 0x4300) is protected and can not be read. /// If filename specified, load data from a different cartridge. /// </summary> /// <param name="dest_addr">The destination address to write to.</param> /// <param name="source_addr">The source address to read from.</param> /// <param name="len">The length of data to read/write.</param> /// <param name="filename">The path to a different cartridge.</param> /// <returns>Returns null everytime.</returns> public object Reload(int dest_addr, int source_addr, int len, string filename = "") { Trace.Assert(dest_addr < 0x4300); Cartridge cart = filename.Length == 0 ? loadedGame.cartridge : new Cartridge(filename); memory.Memcpy(dest_addr, source_addr, len, cart.rom); return(null); }
/// <summary> /// Same as memcpy, but copies from base ram to cart rom /// cstore() is equivalent to cstore(0, 0, 0x4300) /// Can use for writing tools to construct carts or to visualize the state /// of the map / spritesheet using the map editor / gfx editor. /// The code section ( >= 0x4300) is protected and can not be written to. /// </summary> /// <param name="dest_addr">The destination address to write to.</param> /// <param name="source_addr">The source address to read from.</param> /// <param name="len">The length of data to read/write.</param> /// <param name="filename">The path to a different cartridge.</param> /// <returns>Returns null everytime.</returns> public object Cstore(int dest_addr, int source_addr, int len, string filename = null) { Trace.Assert(dest_addr < 0x4300); Cartridge cart = filename == null ? loadedGame.cartridge : new Cartridge(filename, true); Buffer.BlockCopy(memory.ram, source_addr, cart.rom, dest_addr, len); cart.SaveP8(); return(null); }