       MiNES: "Mateusz's iNES Editor" Copyright (C) Mateusz Viste 2009
              http://www.viste-family.net/mateusz/software/mines/


    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.


MiNES is free.  It works fine for me,  but I make no  guarantees or  take any
responsibility  for what happens.  You use this product at your own risk.  If
there is a problem, let me know, and I will attempt to fix it.

MiNES doesn't have to be registered,  and you do not need to buy a license to
use it. However, if you want to send me money, I won't stop you.

MiNES was written in FreeBASIC and compiled with FBC v0.20.0.
Minimum requirements are a 386 running DOS 5.0.  Windows and  Linux versions
are available too.

I wrote MiNES because I needed a portable iNES editor  that would allow me to
change the  PAL/NTSC bit of  the iNES header.  MiNES acts accordingly  to the
Marat  Fayzullin's  specification,  and take  care to  not change  any unused
(reserved for  future use) bits.  That way you  can be sure  that it will not
break your ROMs (unless you do something stupid),  and preserve compatibility
with future versions of the iNES format.

The current MiNES version is  much more than just a dumb  header editor - it
computes the ROM's  CRC32 and uses an internal  database to guess the game's
title and correct header settings.

I hope you will find MiNES to be a useful tool.


* Features:
 - Takes care to not change any unused bits,  as these may  be used in future
   versions of the iNES format,
 - Allows to "clean" the  header from  garbage (like "DiskDude!" entries...),
   by reseting all "reserved/unused" bits to zero,
 - Does not write anything to the ROM file, until the user confirm it,
 - Recognises over 120 documented mappers,
 - Finds some header misconfigurations and displays appropriated warnings,
 - Guess the game's title and correct header settings using a GoodNES
   database,
 - May be used to add/edit additional ROM's informations (game's title)...


* COMMAND-LINE SYNTAX
Usage:
 mines <rom.nes | path> [-h] [-gui | -tui] [-list] [-audit]

Available switches:
 -h     - Shows a help screen
 -gui   - Switches to graphic mode (default in the Windows and Linux versions)
 -tui   - Switches to text mode (default in the DOS version)
 -list  - Lists all iNES ROMs (*.nes) in the given directory
 -audit - Checks iNES ROMs in the given directory and displays a detailed log


* ERRORLEVELS
MiNES may quits with various errorlevel code. Here is the complete list:
Errorlevel 0 = Nothing to say
Errorlevel 1 = Command-line help screen has been displayed
Errorlevel 2 = The specified ROM file could not be found
Errorlevel 3 = The specified file is not a valid iNES ROM
Errorlevel 4 = Program aborted, because MINES.DAT file is missing
Errorlevel 9 = Undefined abort


* iNES format specification
When I was writing MiNES, I needed some informations about the iNES format.
Here is the exact iNES header's specification used in MiNES:
 =======================================================
 | Byte | Bit | Description                            |
 -------------------------------------------------------
 | 1-4  |  -  | Signature ("NES" + 1Ah)                |
 |  5   |  -  | Number of 16K PRG-ROM pages            |
 |  6   |  -  | Number of 8K CHR-ROM (VROM pages)      |
 |  7   | 7-4 | Lower 4 bits of the mapper number      |
 |  7   |  3  | Four-screen VRAM layout (1 = TRUE)     |
 |  7   |  2  | 512 byte trainer/patch at 7000h        |
 |  7   |  1  | Battery-backed RAM (SRAM)              |
 |  7   |  0  | Mirroring (0 = Horiz. ; 1 = Vert.)     |
 |  8   | 7-4 | Upper 4 bits of the mapper number      |
 |  8   | 3-2 | Reserved (zero)                        |
 |  8   |  1  | PC10 game (arcade machine)             |
 |  8   |  0  | VS Unisystem game (another arcade)     |
 |  9   |  -  | Number of 8K RAM banks (0 = undefined) |
 | 10-16|  -  | Reserved (zero)                        |
 =======================================================
 The following segments are placed after the header:
 - 512 byte long trainer (if any),
 - N*16K PRG-ROM banks,
 - N*8K CHR-ROM (VROM) banks,
 - 8K PlayChoice 10 Z80-ROM (PC10 games only),
 - Optional 128 (sometime 127) bytes long title tag (ASCII, zero-padded).

 Notes:
 - Bytes are counted from 1. Bits are numerated by weight (bit 0 is the
   weakest).
 - Some ROM tools put garbages into the header. To avoid being fooled by such
   corrupted headers, bytes 8-16 should be ignored if the 16 byte has a
   non-zero value.
 - Many PC10 files declares their Z80-ROM as an additional VROM bank.


Questions or Comments?
  Don't understand one of the features?
  Think MiNES needs another feature?
  You found a bug?!

        *** Please note, that I will ignore any requests for ROM! ***

Mateusz Viste
mateusz [that-funny-round-sign] viste-family.net
