shithub: rgbds

ref: 895d1d581382bfbcf67827318328d6efc1be463f
dir: /docs/rgbfix.1.html/

View raw version
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"/>
  <style>
    table.head, table.foot { width: 100%; }
    td.head-rtitle, td.foot-os { text-align: right; }
    td.head-vol { text-align: center; }
    div.Pp { margin: 1ex 0ex; }
  </style>
  <link rel="stylesheet" href="mandoc.css" type="text/css" media="all"/>
  <title>RGBFIX(1)</title>
</head>
<body>
<table class="head">
  <tr>
    <td class="head-ltitle">RGBFIX(1)</td>
    <td class="head-vol">General Commands Manual</td>
    <td class="head-rtitle">RGBFIX(1)</td>
  </tr>
</table>
<div class="manual-text">
<h1 class="Sh" title="Sh" id="NAME"><a class="selflink" href="#NAME">NAME</a></h1>
<b class="Nm" title="Nm">rgbfix</b> &#x2014; <span class="Nd" title="Nd">Game
  Boy checksum fixer</span>
<h1 class="Sh" title="Sh" id="SYNOPSIS"><a class="selflink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<table class="Nm">
  <tr>
    <td><b class="Nm" title="Nm">rgbfix</b></td>
    <td>[<span class="Op"><b class="Fl" title="Fl">-CcjsVv</b></span>]
      [<span class="Op"><b class="Fl" title="Fl">-f</b>
      <var class="Ar" title="Ar">fix_spec</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-i</b>
      <var class="Ar" title="Ar">game_id</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-k</b>
      <var class="Ar" title="Ar">licensee_str</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-l</b>
      <var class="Ar" title="Ar">licensee_id</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-m</b>
      <var class="Ar" title="Ar">mbc_type</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-n</b>
      <var class="Ar" title="Ar">rom_version</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-p</b>
      <var class="Ar" title="Ar">pad_value</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-r</b>
      <var class="Ar" title="Ar">ram_size</var></span>]
      [<span class="Op"><b class="Fl" title="Fl">-t</b>
      <var class="Ar" title="Ar">title_str</var></span>]
      <var class="Ar" title="Ar">file</var></td>
  </tr>
</table>
<h1 class="Sh" title="Sh" id="DESCRIPTION"><a class="selflink" href="#DESCRIPTION">DESCRIPTION</a></h1>
The <b class="Nm" title="Nm">rgbfix</b> program changes headers of Game Boy ROM
  images. It also performs other filetype operations, such as truncation. The
  arguments are as follows:
<dl class="Bl-tag">
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#C"><b class="Fl" title="Fl" id="C">-C</b></a></dt>
  <dd class="It-tag">Set the Game Boy Color&#x2013;only flag:
      <i class="Ad">0x143</i> = 0xC0. If both this and the
      <b class="Fl" title="Fl">-c</b> flag are set, this takes precedence.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#c"><b class="Fl" title="Fl" id="c">-c</b></a></dt>
  <dd class="It-tag">Set the Game Boy Color&#x2013;compatible flag:
      <i class="Ad">0x143</i> = 0x80. If both this and the
      <b class="Fl" title="Fl">-C</b> flag are set,
      <b class="Fl" title="Fl">-C</b> takes precedence.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#f"><b class="Fl" title="Fl" id="f">-f</b></a>
    <var class="Ar" title="Ar">fix_spec</var></dt>
  <dd class="It-tag">Fix certain header values that the Game Boy checks for
      correctness. Alternatively, intentionally trash these values by writing
      their binary inverse instead. <var class="Ar" title="Ar">fix_spec</var> is
      a string containing any combination of the following characters:
    <div class="Pp"></div>
    <dl class="Bl-tag Bl-compact" style="margin-left: 5.40ex;">
      <dt class="It-tag" style="margin-left: -5.40ex;"><a class="selflink" href="#l"><b class="Cm" title="Cm" id="l">l</b></a></dt>
      <dd class="It-tag">Fix the Nintendo logo
          (<i class="Ad">0x104</i>&#x2013;<i class="Ad">0x133</i>).</dd>
      <dt class="It-tag" style="margin-left: -5.40ex;"><a class="selflink" href="#L"><b class="Cm" title="Cm" id="L">L</b></a></dt>
      <dd class="It-tag">Trash the Nintendo logo.</dd>
      <dt class="It-tag" style="margin-left: -5.40ex;"><a class="selflink" href="#h"><b class="Cm" title="Cm" id="h">h</b></a></dt>
      <dd class="It-tag">Fix the header checksum (<i class="Ad">0x14D</i>).</dd>
      <dt class="It-tag" style="margin-left: -5.40ex;"><a class="selflink" href="#H"><b class="Cm" title="Cm" id="H">H</b></a></dt>
      <dd class="It-tag">Trash the header checksum.</dd>
      <dt class="It-tag" style="margin-left: -5.40ex;"><a class="selflink" href="#g"><b class="Cm" title="Cm" id="g">g</b></a></dt>
      <dd class="It-tag">Fix the global checksum
          (<i class="Ad">0x14E</i>&#x2013;<i class="Ad">0x14F</i>).</dd>
      <dt class="It-tag" style="margin-left: -5.40ex;"><a class="selflink" href="#G"><b class="Cm" title="Cm" id="G">G</b></a></dt>
      <dd class="It-tag">Trash the global checksum.</dd>
    </dl>
  </dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#i"><b class="Fl" title="Fl" id="i">-i</b></a>
    <var class="Ar" title="Ar">game_id</var></dt>
  <dd class="It-tag">Set the game ID string
      (<i class="Ad">0x13F</i>&#x2013;<i class="Ad">0x142</i>) to a given string
      of exactly 4 characters. If both this and the title are set, the game ID
      will overwrite the overlapping portion of the title.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#j"><b class="Fl" title="Fl" id="j">-j</b></a></dt>
  <dd class="It-tag">Set the non-Japanese region flag: <i class="Ad">0x14A</i> =
      1.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#k"><b class="Fl" title="Fl" id="k">-k</b></a>
    <var class="Ar" title="Ar">licensee_str</var></dt>
  <dd class="It-tag">Set the new licensee string
      (<i class="Ad">0x144</i>&#x2013;<i class="Ad">0x145</i>) to a given
      string, truncated to at most two characters.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#l"><b class="Fl" title="Fl" id="l">-l</b></a>
    <var class="Ar" title="Ar">licensee_id</var></dt>
  <dd class="It-tag">Set the old licensee code, <i class="Ad">0x14B</i>, to a
      given value from 0 to 0xFF. This value is deprecated and should be set to
      0x33 in all new software.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#m"><b class="Fl" title="Fl" id="m">-m</b></a>
    <var class="Ar" title="Ar">mbc_type</var></dt>
  <dd class="It-tag">Set the MBC type, <i class="Ad">0x147</i>, to a given value
      from 0 to 0xFF.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#n"><b class="Fl" title="Fl" id="n">-n</b></a>
    <var class="Ar" title="Ar">rom_version</var></dt>
  <dd class="It-tag">Set the ROM version, <i class="Ad">0x14C</i>, to a given
      value from 0 to 0xFF.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#p"><b class="Fl" title="Fl" id="p">-p</b></a>
    <var class="Ar" title="Ar">pad_value</var></dt>
  <dd class="It-tag">Pad the image to a valid size with a given pad value from 0
      to 0xFF. <b class="Nm" title="Nm">rgbfix</b> will automatically pick a
      size from 32KiB, 64KiB, 128KiB, ..., 8192KiB and give a warning
      thereafter. The cartridge size byte (<i class="Ad">0x148</i>) will be
      changed to reflect this new size.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#r"><b class="Fl" title="Fl" id="r">-r</b></a>
    <var class="Ar" title="Ar">ram_size</var></dt>
  <dd class="It-tag">Set the RAM size, <i class="Ad">0x149</i>, to a given value
      from 0 to 0xFF.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#s"><b class="Fl" title="Fl" id="s">-s</b></a></dt>
  <dd class="It-tag">Set the SGB flag: <i class="Ad">0x146</i> = 3.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#t"><b class="Fl" title="Fl" id="t">-t</b></a>
    <var class="Ar" title="Ar">title</var></dt>
  <dd class="It-tag">Set the title string
      (<i class="Ad">0x134</i>&#x2013;<i class="Ad">0x143</i>) to a given
      string, truncated to at most 16 characters. It is recommended to use 15
      characters instead, to avoid clashing with the CGB flag
      (<b class="Fl" title="Fl">-c</b> or <b class="Fl" title="Fl">-C</b>). If
      both this and the game ID are set, the game ID will overwrite the
      overlapping portion of the title.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#V"><b class="Fl" title="Fl" id="V">-V</b></a></dt>
  <dd class="It-tag">Print the version of the program and exit.</dd>
  <dt class="It-tag">&#x00A0;</dt>
  <dd class="It-tag">&#x00A0;</dd>
  <dt class="It-tag"><a class="selflink" href="#v"><b class="Fl" title="Fl" id="v">-v</b></a></dt>
  <dd class="It-tag">Equivalent to <b class="Fl" title="Fl">-f</b>
      <b class="Cm" title="Cm">lhg</b>.</dd>
</dl>
<h1 class="Sh" title="Sh" id="EXAMPLES"><a class="selflink" href="#EXAMPLES">EXAMPLES</a></h1>
Most values in the ROM header are only cosmetic. The bare minimum requirements
  for a workable image are checksums, the Nintendo logo, and (if needed) the
  CGB/SGB flags. It is a good idea to pad the image to a valid size as well
  (&#x201C;valid&#x201D; meaning a multiple of 32KiB).
<div class="Pp"></div>
The following will make a plain, no-color Game Boy game without checking for a
  valid size:
<div class="Pp"></div>
<div class="D1">$ rgbfix -v foo.gb</div>
<div class="Pp"></div>
The following will make a SGB-enabled, color-enabled game with a title of
  &#x201C;foobar&#x201D;, and pad it to a multiple of 32KiB. (The Game Boy
  itself does not use the title, but some emulators or ROM managers might.)
<div class="Pp"></div>
<div class="D1">$ rgbfix -vcs -l 0x33 -p 0 -t foobar baz.gb</div>
<div class="Pp"></div>
The following will duplicate the header (sans global checksum) of the game
  &#x201C;Survival Kids&#x201D;:
<div class="Pp"></div>
<div class="D1">$ rgbfix -cjsv -k A4 -l 0x33 -m 0x1B -p 0xFF -r 3 -t
  SURVIVALKIDAVKE SurvivalKids.gbc</div>
<h1 class="Sh" title="Sh" id="SEE_ALSO"><a class="selflink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<a class="Xr" title="Xr">rgbasm(1)</a>, <a class="Xr" title="Xr">rgblink(1)</a>,
  <a class="Xr" title="Xr">rgbds(7)</a>
<h1 class="Sh" title="Sh" id="HISTORY"><a class="selflink" href="#HISTORY">HISTORY</a></h1>
<b class="Nm" title="Nm">rgbfix</b> was originally released by Carsten
  S&#x00F8;rensen as a standalone program called gbfix, and was later packaged
  in RGBDS by Justin Lloyd. It is now maintained by a number of contributors at
  <a class="Lk" title="Lk" href="https://github.com/rednex/rgbds">https://github.com/rednex/rgbds</a>.</div>
<table class="foot">
  <tr>
    <td class="foot-date">March 11, 2018</td>
    <td class="foot-os">RGBDS Manual</td>
  </tr>
</table>
</body>
</html>