Транспортная карта «тройка». как работает? можно обмануть?

Other scripts

You can run custom C# scripts to interact with dumper and cartridge. It’s usefull for reverse engineering. Each script must contain namespace (any name allowed) with class (also any name) that contains void Run(IFamicomDumperConnection dumper) method. This method will be executed if —csfile option is specified. Also you can use NesFile and UnifFile containers.

You can run script alone like this:

Or execute it before main action like this:

So you can write your own code to interact with dumper object and read/write data from/to cartridge. This dumper object can be even on another PC (read below)! Check DemoScript.cs file for example script.

Examples

Dump NROM-cartridge using dumper on port «COM14» to file «game.nes». PRG and CHR sizes are default.

Dump MMC1-cartridge (iNES mapper #1) using dumper with serial number (Windows only) «A9Z1A0WD». PRG size is 128 kilobytes, CHR size is 128 kilobytes too.

Dump 32K of PRG and 8K of CHR as simple NROM cartridge but execute C# script first:

Dump 32MBytes of COOLBOY cartridge using C# script and save it as UNIF file with some extra info:

Read battery-backed save from MMC1 cartridge:

Write battery-backed save back to MMC1 cartridge:

Rewrite ultracheap chinese COOLBOY cartridge using GPIO pins on /OE-/WE and play sound when it’s done:

You need to unsolder pins /OE and /WE and connect them to TCK and TDO pins on JTAG connector.

Same for new COOLBOY where /OE and /WE are connected to mapper, soldering not required:

Also you can rewrite COOLGIRL cartridges:

Usage

It’s a command-line application.

Usage: famicom-dumper.exe <command>

Available commands:

  • list-mappers — list available mappers to dump
  • dump — dump cartridge
  • server — start server for remote dumping
  • script — execute C# script specified by —csfile option
  • reset — simulate reset (M2 goes to Z-state for a second)
  • dump-tiles — dump CHR data to PNG file
  • read-prg-ram — read PRG RAM (battery backed save if exists)
  • write-prg-ram — write PRG RAM
  • write-coolboy-gpio — write COOLBOY cartridge using GPIO
  • write-coolboy-direct — write COOLBOY cartridge directly
  • write-coolgirl — write COOLGIRL cartridge
  • write-eeprom — write EEPROM-based cartridge
  • test-prg-ram — run PRG RAM test
  • test-chr-ram — run CHR RAM test
  • test-battery — test battery-backed PRG RAM
  • test-prg-ram-coolgirl — run PRG RAM test for COOLGIRL cartridge
  • test-chr-ram-coolgirl — run CHR RAM test for COOLGIRL cartridge
  • test-coolgirl — run all RAM tests for COOLGIRL cartridge
  • test-bads-coolgirl — find bad sectors on COOLGIRL cartridge
  • read-crc-coolgirl — show CRC checksum for COOLGIRL
  • info-coolboy — show information about COOLBOY’s flash memory
  • info-coolgirl — show information about COOLGIRL’s flash memory

Available options:

  • —port <com> — serial port of dumper or serial number of FTDI device, default — auto
  • —tcpport <port> — TCP port for client/server communication, default — 26672
  • —host <host> — enable network client and connect to specified host
  • —mapper <mapper> — number, name or path to C# script of mapper for dumping, default is 0 (NROM)
  • —file <output.nes> — output filename (.nes, .png or .sav)
  • —psize <size> — size of PRG memory to dump, you can use «K» or «M» suffixes
  • —csize <size> — size of CHR memory to dump, you can use «K» or «M» suffixes
  • —reset — simulate reset first
  • —csfile <C#_file> — execute C# script from file
  • —unifname <name> — internal ROM name for UNIF dumps
  • —unifauthor <name> — author of dump for UNIF dumps
  • —badsectors — comma separated list of bad sectors for COOLBOY/COOLGIRL writing
  • —sound — play sound when done or error occured
  • —check — verify COOLBOY/COOLGIRL checksum after writing
  • —lock — write-protect COOLBOY/COOLGIRL sectors after writing

Mapper script files

Mapper files are stored in «mappers» subdirectory. When you specify a mapper number or name, the application compiles the scripts in that directory to find a matching one.

Mapper scripts are written in C# language. Each script must contain namespace (any name allowed) with class (also any name) that impliments IMapper interface.

    public interface IMapper
    {
        /// <summary>
        /// Name of the mapper
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Number of the mapper to spore in the iNES header (-1 if none)
        /// </summary>
        int Number { get; }

        /// <summary>
        /// Name of the mapper to store in UNIF container (null if none)
        /// </summary>
        string UnifName { get; }

        /// <summary>
        /// Default PRG size to dump (in bytes)
        /// </summary>
        int DefaultPrgSize { get; }

        /// <summary>
        /// Default CHR size to dump (in bytes)
        /// </summary>
        int DefaultChrSize { get; }

        /// <summary>
        /// This method will be called to dump PRG
        /// </summary>
        /// <param name="dumper">FamicomDumperConnection object to access cartridge</param>
        /// <param name="data">This list must be filled with dumped PRG data</param>
        /// <param name="size">Size of PRG to dump requested by user (in bytes)</param>
        void DumpPrg(IFamicomDumperConnection dumper, List<byte> data, int size = );

        /// <summary>
        /// This method will be called to dump CHR
        /// </summary>
        /// <param name="dumper">FamicomDumperConnection object to access cartridge</param>
        /// <param name="data">This list must be filled with dumped CHR data</param>
        /// <param name="size">Size of CHR to dump requested by user (in bytes)</param>
        void DumpChr(IFamicomDumperConnection dumper, List<byte> data, int size = );

        /// <summary>
        /// This method will be called to enable PRG RAM
        /// </summary>
        /// <param name="dumper"></param>
        void EnablePrgRam(IFamicomDumperConnection dumper);
    }

FamicomDumperConnection implements IFamicomDumperConnection interface:

    public interface IFamicomDumperConnection
    {
        /// <summary>
        /// Simulate reset (M2 goes to Z-state for a second)
        /// </summary>
        void Reset();

        /// <summary>
        /// Read data from CPU (PRG) bus
        /// </summary>
        /// <param name="address">Address to read from</param>
        /// <param name="length">Number of bytes to read</param>
        /// <returns></returns>
        byte[] ReadCpu(ushort address, int length);

        /// <summary>
        /// Read data from PPU (CHR) bus
        /// </summary>
        /// <param name="address">Address to read from</param>
        /// <param name="length">Number of bytes to read</param>
        /// <returns></returns>
        byte[] ReadPpu(ushort address, int length);

        /// <summary>
        /// Write data to CPU (PRG) bus
        /// </summary>
        /// <param name="address">Address to write to</param>
        /// <param name="data">Data to write (single byte)</param>
        void WriteCpu(ushort address, byte data);

        /// <summary>
        /// Write data to CPU (PRG) bus
        /// </summary>
        /// <param name="address">Address to write to</param>
        /// <param name="data">Data to write, address will be incremented after each byte</param>
        void WriteCpu(ushort address, byte[] data);

        /// <summary>
        /// Write data to PPU (CHR) bus
        /// </summary>
        /// <param name="address">Address to write to</param>
        /// <param name="data">Data to write (single byte)</param>
        void WritePpu(ushort address, byte data);


        /// <summary>
        /// Write data to PPU (CHR) bus
        /// </summary>
        /// <param name="address">Address to write to</param>
        /// <param name="data">Data to write, address will be incremented after each byte</param>
        void WritePpu(ushort address, byte[] data);

        /// <summary>
        /// Get current mirroring
        /// </summary>
        /// <returns>bool array with CIRAM A10 values for each region: $0000-$07FF, $0800-$0FFF, $1000-$17FF and $1800-$1FFF</returns>
        bool[] GetMirroring();
    }

Check «mappers» directory for examples.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock
detector