makerom[.TWL]

# makerom

# makerom.TWL

## Description

The `makerom` tool creates ROM images for NITRO applications. It creates the ROM image based on the entries in a file called the ROM Spec file.

`makerom.TWL` is a tool that adds the ability to create ROM images for TWL to the features of the `makerom` tool. It has more parameters that can be specified.

ROM images for TWL that are created with this tool will only run on TWL development hardware. The TWL-SDK environment cannot be used to create ROM images that run on retail TWL hardware. (ROM images created for NITRO will not run on retail TWL hardware, either.)

## How to Use

### Start Command

#### (1) Normal Start

    % makerom [-d] [-DNAME=VALUE...] [-MDEFINES_FILE] [-F] [-A]
                [-VFMT_VER] [-WWARNING_TYPE] SPECFILE [ROMFILE] [LISTFILE]

    % makerom.TWL [-DTARGET_PLATFORM=target] [-d] [-DNAME=VALUE...] [-MDEFINES_FILE] [-F] [-A]
                [-VFMT_VER] [-WWARNING_TYPE] SPECFILE [ROMFILE] [LISTFILE]

This links files in accordance with the contents of the ROM Spec file specified by `SPECFILE`, and creates a ROM image file named `ROMFILE`. (The ROM Spec file is described below.) At this stage, the ROM structure information is output to the file specified by `LISTFILE`.

`ROMFILE` and `LISTFILE` can be omitted. If you omit them, the two files use the same name as that specified by `SPECFILE` but with the extension changed to ROM and NLF, respectively. You can also use the `-D` option to define a variable and its value. The value of this variable can be referenced in the contents of the ROM Spec file.

When using the `-D` option with `makerom.TWL.exe`, you must specify the target parameter in `TARGET_PLATFORM`. Specify `TWL-HYB` for the target parameter to build a TWL-enhanced application and `TWL-LTD` to build a TWL-exclusive application. Normally, the build system specifies the appropriate value.If this specification is not made, `'TWL-LTD'` is set by default.

You can define variables and their values with the `-M` option, similar to the `-D` option. This takes as an argument a text file consisting of `[NAME=VALUE]` lines. Use this option to encode definitions of variables and variable values that might otherwise be too long for the length restrictions of the command line.When you use the `-D` option to define variable values that include whitespace (such as when enumerating object filenames), you must delimit the values with either `"` or `'` because of how command line arguments are interpreted. However, when you use the `-M` option, variable values coded inside the definition file do not need to be delimited with quotation marks. If you use quotation marks, they are taken as part of the value itself.

When the `-F` option is specified, a ROM image file is created even if the ROM file size exceeds the size limit (see `RomSize` in the `Property` section).

If you specify the `-A` option, a check is performed to determine whether the ROM size limit (see `RomSize` in the `Property` section) is exceeded when adding a digital signature with the `attachsign` command. Exceeding the limit causes an error. However, if the above-mentioned `-F` option has been specified, processing continues anyway.

Use the `-V` option to specify the output ROM image format number `FMT_VER`. This option ensures compatibility with previous versions. The default value is 2. For details, see ROM Format Versions below.

The `-W` options output warnings that are normally suppressed. With `-Wrom_speedtype_undefined`, warnings are displayed when `RomSpeedType` in the `Property` section is not explicitly defined and is instead left in the SDK default setting. With the `-Wall` option, all warnings are output.

The `-d` option is for outputting messages when debugging `makerom`. This is usually not necessary.

#### (2) The -l Option

`% makerom [-d] [-DNAME=VALUE...] [-MDEFINES_FILE] [-VFMT_VER] -l SPECFILE [LISTFILE]`

`% makerom.TWL [-d] [-DNAME=VALUE...] [-MDEFINES_FILE] [-VFMT_VER] -l SPECFILE [LISTFILE]`

This operates in the same way as the Normal Start method (1) except that a ROM image is not output. The file specified by `SPECFILE` is loaded, and the ROM structure information is output to `LISTFILE`.

`LISTFILE` can be omitted. If you omit it, the filename is set to the name specified by `SPECFILE`, with the extension replaced by the default extension for each platform. The default extension when creating NITRO ROM images is NLF, and the default extension when creating TWL ROM images is TLF. The `-D` option can be used to define a variable and its value. The value of this variable can be referenced in the contents of the ROM Spec file.

The `-V` option behaves the same as described above in (1) Normal Start.

#### (3) The -r Option

`% makerom [-d] [-F] [-A] [-VFMT_VER] -r LISTFILE [ROMFILE]`

`% makerom.TWL [-d] [-F] [-A] [-VFMT_VER] -r LISTFILE [ROMFILE]`

This command constructs a ROM image from the ROM structure information specified by `LISTFILE` and outputs it as a file with the name specified by `ROMFILE`.

`ROMFILE` can be omitted. If you omit it, the filename is set to the same name as that specified by `SPECFILE`, but with the extension ROM.

The `-F`, `-A`, and `-V` options behave in the same way as described above in (1) Normal Start.

#### (4) The -m Option

`% makerom -m [ROMFILE] [ROMPATH] [HOSTPATH]`

`% makerom.TWL -m [ROMFILE] [ROMPATH] [HOSTPATH]`

Replaces the content of the file specified by `HOSTPATH` with the content of the file stored at `ROMPATH` in the SRL file specified by `ROMFILE`. Using this option is effective when it is acceptable to replace only a single piece of data stored in an existing SRL file.

- You must specify `ROMPATH` as a ROM archive path, such as "`rom:/foo/bar.dat`."
- The file specified by `HOSTPATH` must have the same size as the file, specified by `ROMPATH`, to be replaced.

### ROM Spec File Format

The contents of NITRO and TWL ROM images are managed using a simple file system. The ROM Spec file is a text file that encodes the structure of this file system. The file is divided into four sections for NITRO and six sections for TWL. The ROM Image Section must come after all other sections.Section definitions are formatted with a declaration at start of each section definition, followed by section parameters enclosed in curly brackets (`{ }`).

Section Definition | Section Definition Format
--- | ---

ARM9 Executable Binary

    Arm9
    {
      [ARM9 parameters]
      ....
    }

ARM7 Executable Binary

    Arm7
    {
      [ARM7 parameters]
      ....
    }

ARM9 TWL-Exclusive Executable Binary

    Arm9.Ltd
    {
      [ARM9 TWL-exclusive parameters]
      ....
    }

ARM7 TWL-Exclusive Executable Binary

    Arm7.Ltd
    {
      [ARM7 TWL-exclusive parameters]
      ....
    }

Incidental
Information
`(Property)`

    Property
    {
      [Incidental information parameters]
      ....
    }

Additional
Incidental
Information
`(AppendProperty)`

    AppendProperty
    {
      [Additional incidental information parameters]
      ....
    }

Rating Information
`(Rating)`

    Rating
    {
      [Rating information parameters]
      ....
    }

ROM Image

    RomSpec
    {
      [ROM image parameters]
      ....
    }

### Section Parameters

#### ARM9 Section (ARM9 Executable Binary Definition Section)

Configures settings for ARM9-side executable binaries.

> `Static` [ARM9 Static Module filename]
>   Filename of the static module of the ARM9 executable file.
> `OverlayDefs` [ARM9 Overlay Names filename]
>   Filename of the ARM9 `OverlayDefs` file.
> `OverlayTable` [ARM9 OverlayTable filename]
>   Filename of the ARM9 `OverlayTable` file. This file is not needed if overlays are not used. In such cases, you can omit the `OverlayTable` define statement.
>   However, this omission cannot be made when using overlays in the Arm9.Ltd section.
> `Nef` [ARM9 NEF or TEF (debug information file) filename]
>   NEF file in which ARM9 debug information is saved.
>   If you will not perform debugging, this `NEF` definition is not needed. If so, it can be omitted from the file.
>   Instead of `Nef`, you can use the alternative keyword `Elf`.

#### ARM7 Section (ARM7 Executable File Definition Section)

Configures settings for ARM7-side executable binaries.

> `Static` [ARM7 Static Module filename]
> `OverlayDefs` [ARM7 Overlay Names filename]
> `OverlayTable` [ARM7 OverlayTable filename]
> `Nef` [ARM7 NEF or TEF (debug information file) filename]
>   Same as the ARM9 parameters.

#### Arm9.Ltd Section (ARM9 TWL-Exclusive Executable Binary Definition Section)

Configures settings for ARM9-side executable binaries that are only used when the application is run on a TWL.

> `Static` [ARM9 TWL-Exclusive Static Module filename]
> `OverlayDefs` [ARM9 TWL-Exclusive Overlay Names filename]
> `OverlayTable` [ARM9 TWL-Exclusive OverlayTable filename]
>   Same as the ARM9 parameters.

#### Arm7.Ltd Section (ARM7 TWL-Exclusive Executable File Definition Section)

Configures settings for ARM7-side executable files that are only used when the application is run on a TWL.

> `Static` [ARM7 TWL-Exclusive Static Module filename]
> `OverlayDefs` [ARM7 TWL-Exclusive Overlay Names filename]
> `OverlayTable` [ARM7 TWL-Exclusive OverlayTable filename]
>   Same as the ARM9 parameters.

#### Property Section (Incidental Information Definition Section)

The "◎" symbol indicates settings that must be specified when creating the master ROM.

Property Section (Items Common to NITRO/TWL)

> `RomHeaderTemplate` [ROM Header Template filename] ◎
>   Template file for the ROM image header. When not specified, the default setting is `"rom_header.template.sbin"` in the same directory as `makerom[.TWL].exe`. For the filename, specify the name of the master ROM template file (distributed by Nintendo) for each game application to use when creating the master ROM.We do not recommend modifying the binary contents of the ROM header template file.Set the incidental information for each master ROM by encoding the parameters below (such as `TitleName`) in a ROM Spec file.
> `TitleName` [Title name] ◎
>   Title name. Up to 12 alphanumeric ASCII-encoded characters. When it is shorter than 12 characters, the unused area is padded with zeros. When not specified, the value embedded in `RomHeaderTemplate` is used.
> `MakerCode` [Manufacturer code] ◎
>   Manufacturer code that was assigned when the licensing agreement was signed with Nintendo. Two ASCII characters.
>   When not specified, the value embedded in `RomHeaderTemplate` is used.
> `RemasterVersion` [Remaster version] ◎
>   Remaster version number of the ROM being manufactured for retail products. Hexadecimal, decimal, or octal notation can be used. When not specified, the value embedded in `RomHeaderTemplate` is used. This is equivalent to the "ROM version" used in earlier versions. In previous versions of `makerom`, the definition of the term "ROM version" differed from Nintendo's standard definition, so this parameter's name was changed. For compatibility with previous ROM Spec files, the `"RomVersion"` keyword can be used as an alternate name.
> `RomSpeedType` [1TROM|MROM|UNDEFINED] ◎
>   Defines the ROM type and selects the proper access speed. `1TROM` specifies one-time PROM, and `MROM` specifies mask ROM. Because one-time PROM is the slower setting, if one-time PROM is selected, both one-time PROM and mask ROM will operate. However, the reverse is not true.
>   If this parameter is not specified, it is treated as if `UNDEFINED` is specified. `UNDEFINED` takes the same setting for access speed as `1TROM`. However, when this parameter is `UNDEFINED`, a warning flag is set in the ROM registration data when the ROM binary is created, so that binary cannot be submitted as the final master ROM. This prevents the mistake of shipping the master ROM with the limited access speed unintentionally set. When creating the final master ROM, always specify either `1TROM` or `MROM` in the ROM Spec file.
> `RomSize` [64M|128M|256M|512M|1G|2G|4G] ◎
>   ROM capacity in bits. At present, you can select from `64M`, `128M`, `256M`, `512M`, `1G`, `2G`, or `4G`, specified as a string.
>   An error is output if the ROM image exceeds the specified value. (If the `-F` option is specified, only a warning is output.)
>   However, if you specify 1 gigabit (`1G`) or more, note that this specified value will differ from the actual usable size. (For details, see ROM Format Versions.)
>   When no specification is made, the value embedded in `RomHeaderTemplate` (currently `2G`) is used.
>   With NAND applications, this specification is ignored and optimum values are selected automatically.
> `RomFootPadding` [TRUE|FALSE] ◎
>   Specify `TRUE` if you want to fill the unused region above the program storage area in ROM with data to create a binary that matches the ROM capacity specified by `RomSize`. The data stored in the unused region is the value specified with the `Padding` parameter in the `RomSpec` section. To enable this feature, you must specify `RomSize`. If this parameter is not specified, it takes the value `FALSE`.
>   For NAND applications, always specify `FALSE`.
> `RomHeader` [ROM Header filename]
>   Name of the image file forming the header portion of the ROM image. This file is generated by embedding information from the ROM Spec file (and any other appropriate sources) into a copy of the template mentioned above.
>   Normally there is no need to specify this. When it is not specified, a default filename is created by removing the file extension from the ARM9 static module filename, then appending `_header.sbin`.
> `FileName` [FileNameTable filename]
>   Name of the image file in the filename table portion of the ROM file system. This file is generated from the `RomSpec` item in the ROM Spec file. Normally there is no need to specify this. When not specified, a default filename is created by removing the file extension from the ARM9 static module filename, then appending `_files.sbin`.
> `BannerFile` [Banner filename] ◎
>   The banner file composed of the application identification image information and displayed on the NITRO startup menu.
> `ForChina` [TRUE|FALSE]
>   Whether this application supports running on Chinese version systems. It will run on the Chinese version of the system only when this property is set to `TRUE`. Also, to determine if the Chinese language was selected on a Chinese version of the System Settings menu, this property must be set to `TRUE`.
>   `FALSE` results if there is no specification. Instead, the English language code is obtained. The value embedded in `RomHeaderTemplate` is not used.
> `ForKorea` [TRUE|FALSE]
>   Whether the application supports running on Korean version systems. Setting this property to `TRUE` does not apply any limits on the systems on which the applications can run. Also, to determine if the Korean language was selected on a Korean version of the System Settings menu, this property must be set to `TRUE` ahead of time. `FALSE` results if there is no specification. Instead, the English language code is obtained. The value embedded in `RomHeaderTemplate` is not used.
> `PermitLandingTmpJump` [TRUE|FALSE]
>   Specify `TRUE` only if instructed to do so. The default is `FALSE`.

Property Section (TWL-Exclusive Items)

> `RomHeaderLtd` [ROM Header Template filename] ◎
>   Template file for the header of the ROM image TWL-exclusive region.
>   Normally, specify `$(TWLSDK_ROOT)/tools/bin/rom_header.LTD.sbin`.
> `DigestParam` 1024 32 ◎
>   Specifies the units for calculating the hash-check table, described in the ROM Archive Overview in the FS library. Do not change the arguments from `1024 32`.
> `WramMapping` [MAP2_TS_HYB|MAP2_TS_LTD] ◎
>   Specifies the WRAM memory mapping. Specify `MAP2_TS_HYB` for a HYBRID ROM, and `MAP2_TS_LTD` for a LIMITED ROM.
>   Normally, specifying `$(MAKEROM_WRAM_MAPPING)` ensures that the build system sets this appropriately.
> `CardRegion` [Japan|America|Europe|Australia|EuropeAndAustralia|AmericaAndAustralia|AmericaEuropeAndAustralia|China|Korea] ◎
>   Software's region.
>   Note: If the software region and system region differ, the launcher will not recognize the software.
>   Although `ALL` has been set for the samples, that is a demo-specific setting and cannot be used when submitting a master ROM.
>   To specify `China`, you must also set the `ForChina` property to `TRUE`. To specify `Korea`, you must also set the `ForKorea` property to `TRUE`.
> `CodecMode` [NTR|TWL] ◎
>   Specifies the CODEC operating mode when the application is run on a TWL system. For details on the CODEC operating mode, see TWL Extended Sound Features: Overview. Specify `NTR` to run in CODEC-DS mode, and `TWL` to run in CODEC-TWL mode.
>   Normally, specifying `$(MAKEROM_CODEC_MODE)` ensures that the build system sets this appropriately.
> `WiFiConnectionIcon` [TRUE|FALSE]
>   Specifies whether to display the Nintendo Wi-Fi Connection icon simultaneously when displaying the software's banner in the launcher. By displaying the icon on the launcher, you can start Nintendo Wi-Fi Connection when your application starts up, without having to get the user's consent again. To start Wi-Fi Connection at boot time, you must also specify `AgreeEULA`.
>   If you specify this parameter and the wireless feature is then turned off under System Settings, it will become impossible to start the application from the launcher. Only specify this for applications that require wireless communication.
>   `TRUE` cannot be specified at the same time as `DSWirelessIcon`. If both specifications are required, prioritize the `WiFiConnectionIcon` specification.
>   The default is `FALSE`.
> `DSWirelessIcon` [TRUE|FALSE]
>   Whether to display the DS Wireless icon simultaneously when displaying the software's banner in the launcher. By displaying the icon on the launcher, you can start DS Wireless Play when your application starts up, without having to get the user's consent again.
>   If you specify this parameter and then turn off the wireless feature via System Settings, it is impossible to start the application from the launcher. Only specify this for applications that require wireless communication.
>   `TRUE` cannot be specified at the same time as `DSWirelessIcon`. If both specifications are required, prioritize the `WiFiConnectionIcon` specification.
>   The default is `FALSE`.
> `AgreeEULA` [TRUE|FALSE]
>   Whether to prevent software from being started from the launcher if the user has not agreed to the terms of use. Specify `TRUE` only if an Internet connection is required while using the software.
>   If you specify this parameter, you must also specify `WiFiConnectionIcon`.
>   Specify `FALSE` if an Internet connection is not required, but a service that uses the Internet, such as Nintendo Wi-Fi connection, is being supported as one of many features. In such cases, instead of specifying this parameter, implement a mechanism in the game software to confirm that the user has agreed to the terms of use before attempting to connect to the Internet. (Agreement with the terms of use is checked by the TWL-DWC library. For details, see the TWL-DWC function reference manual.)
>   The default is `FALSE`.
> `PhotoAccess` [Read|ReadWrite]
>   Specifies the access type for photo data in the `photo` region.
>   Specify this only when using the TCL library to access the `photo` region.
>   Specify `Read` for applications that only read photo data, and specify `ReadWrite` for applications that read and write photo data.

#### AppendProperty Section (Additional Incidental Information Definition Section)

Items in this section must be specified only when creating a NAND application.

The "◎" symbol indicates settings that must be specified when creating the master ROM for a NAND application.

> `Media` [GameCard|NAND] ◎
>   Whether the software is a card application or a NAND application. For card applications, the entire `AppendProperty` section can be omitted.
> `InitialCode` [Game Code]
>   Game code as a 4-character ASCII string. If this is not specified, it will be set based on the ROM header.
> `PublicSaveDataSize` [Size of public save data]
>   Size of the public save data. Use `K` (indicating "kilobytes") for the units. (For example: `2048K`.) If this parameter is not specified, it is interpreted as `0K`. For details on the values that can be specified, see the Save Data Size List.
> `PrivateSaveDataSize` [Size of private save data]
>   Size of the private save data. Use `K` (kilobytes) for the units. (For example: `2048K`.) If this parameter is not specified, it is interpreted as `0K`. For details on the values that can be specified, see the Save Data Size List.
> `SubBannerFile` [TRUE|FALSE]
>   Whether to use sub-banners.

#### Rating Section (Rating Information Definition Section)

This section is used to set ratings obtained from rating organizations.

Ratings from the following rating organizations can be set separately. However, you can only set ratings from the rating organizations included in the software region (specified in `CardRegion` in the `Property` section).

There is no rating organization in China, so if `CardRegion` is set to `China`, you cannot specify any ratings from any rating organization. For software for China, the ratings of all rating organizations are automatically set to `0` as a special workaround, regardless of the existence of the Rating section. (SDK version 5.3 and later.)

> Setting | Corresponding Rating Organization | Applicable Regions | Correspondence Between Settable Values and Ratings
> --- | --- | --- | ---

> `CERO`

> CERO

> Japan (`Japan`)

> `0`: A (all ages)
> `12`: B (12 years or older)
> `15`: C (15 years or older)
> `17`: D (17 years or older)
> `18`: Z (18 years or older)
> `PENDING`: Under review

> `ESRB`

> ESRB

> North America (`America`)

> `3`: EARLY CHILDHOOD (EC, all ages)
> `6`: EVERYONE (E, 6 years or older)
> `10`: EVERYONE10+ (E10+, 10 years or older)
> `13`: TEEN (T, 13 years or older)
> `17`: MATURE (M, 17 years or older)
> `PENDING`: Under review

> `USK`

> USK

> Europe (`Europe`)
> Europe and Australia (`EuropeAndAustralia`)

> `0`: No age limit
> `6`: 6 years or older
> `12`: 12 years or older
> `16`: 16 years or older
> `18`: Unsuitable for minors
> `PENDING`: Under review

> `PEGI_GEN`

> PEGI (general)

> Europe (`Europe`)
> Europe and Australia (`EuropeAndAustralia`)

> `3`: 3 years or older
> `7`: 7 years or older
> `12`: 12 years or older
> `16`: 16 years or older
> `18`: 18 years or older
> `PENDING`: Under review

> `PEGI_PRT`

> PEGI (Portugal)

> Europe (`Europe`)
> Europe and Australia (`EuropeAndAustralia`)

> `4`: 4 years or older
> `6`: 6 years or older
> `12`: 12 years or older
> `16`: 16 years or older
> `18`: 18 years or older
> `PENDING`: Under review

> `PEGI_BBFC`

> PEGI (General) and BBFC

> Europe (`Europe`)
> Europe and Australia (`EuropeAndAustralia`)

> `3`: 3 years or older
> `4` :U, Uc (recommended for 4 years or older)
> `7`: 7 years or older
> `8`: PG (recommended for 8 years or older)
> `12`: 12 years or older
> `15`: 16 years or older
> `16`: 16 years or older
> `18`: 18 years or older
> `PENDING`: Under review

> `AGCB`

> AGCB

> Australia (`Australia`)
> Europe and Australia (`EuropeAndAustralia`)

> `0`: G (General, no age specified)
> `7`: PG (Parental guidance recommended, no age specified)
> `14`:M (Recommended for adults, no age specified)
> `15`: MA15+ (Unsuitable for 15 years and younger, consent or a parent or guardian required for 15 years or younger)
> `PENDING`: Under review

> `GRB`

> GRB

> Korea (`Korea`)

> `0`: All ages
> `12`: 12 years or older
> `15`: 15 years or older
> `18`: Not for minors
> `PENDING`: Under review

> Specify the following item only in exceptional cases when it has been determined that no rating is required.

> `Unnecessary` [TRUE|FALSE]
>   Specifies that no rating is necessary for the application. If `TRUE` is specified, no ratings can be set from any rating organization.
>   The default is `FALSE`.

#### RomSpec Section (ROM Image Definitions Section)

This section must come after all other sections in the file.

RomSpec Section (Items Common to NITRO/TWL)

> `Offset` [Offset value]
>   Offset value for the location of files (or data) in the ROM image.
>   To prevent the overlap of ROM image regions, the offset value must be larger than the final position of all files (or data) at that time. If it is not, an error occurs.
> `OffsetMin` [Offset value]
>   The same as `Offset`, except that no error occurs if the offset value is not larger than the final position of files. (Instead, the setting is ignored.)
> `Segment All`
>   Establishes all data for file system management. This management data must precede other files and be placed at the start of ROM.
> `Padding` [Character code from 0 to 255]
>   Value to assign for padding when aligning the ROM image. A value from 0 through 255 can be specified. When the ROM format number is set to `1`, the default padding value is 0. When the format number is set to `2` or greater, the default padding value is 255.
> `Align` [Alignment value]
>   Aligns the starting position in the ROM image of the next stored file or data to the specified memory boundary. Empty space is padded with the value specified by `Padding`. The alignment value must be a power of 2.
>   The `Align` statement is for temporarily controlling the memory boundary of the file. Its effective range covers only the file located immediately after its use.To specify a permanent memory boundary, use the `AlignAll` statement.
> `AlignAll` [Alignment value]
>   Aligns the starting position in the ROM image of all subsequently stored files or data to the specified memory boundary. Empty space is padded with the value specified by `Padding`. If `Align` and `AlignAll` are both enabled, the value specified by `Align` is used. The default value of `AlignAll` is 512.
>   If the file alignment boundary is set to a value less than 512, you must note that access to a NITRO CARD (the media for NITRO software) is limited to 512-byte block units.
> `HostRoot` [PC-side root directory name]
>   Standard directory on the computer for the files stored in the ROM image. `HostRoot` can be omitted, in which case the current directory (`"."`) is used as the default value.
> `Root` [NITRO -side root directory name]
>   Standard directory on NITRO for the files stored in the ROM image. The directory indicated by `HostRoot` on the computer is mapped to the NITRO directory indicated by `Root`. `Root` can be omitted, in which case the root directory (`"/"`) is used as the default value.
> `File` [Filename ...]
>   Files to store in the ROM image. If the specified filename is a directory, all files in all subdirectories are stored in the ROM image. However, any files or subdirectories that match the pattern specified by `Reject` are excluded. `*` and `?` can be used as wildcards when specifying a filename. `*` can replace any number of consecutive characters, and `?` only replaces a single character (1 byte).
> `Reject` [Filename pattern ...]
>   Filenames of files to not store in the ROM image. When directories or filenames containing wildcards are specified in the `File` statement, the `makerom` tool internally expands these specifications and creates a list of the files to store in ROM. Use the `Reject` definition to specify the files that you do not want included on this list.
>   By separating `Reject` statements with a blank space, multiple filename patterns can be specified. Wildcards (`*` and `?`) can be used. Specifications with the `Reject` statement are valid for the subsequent `File` statement up to the next `Reject` statement, or to the point where the `RomSpec` section ends. By default, the `Reject` statement specifies to reject the filename patterns `CVS`, `vssver.scc`, and `.?*` (filenames that begin with periods).
> `Fixed` [Default | True | False ]
>   This statement is for correcting NLF file parameters. It controls the flag that determines whether subsequently placed data can be moved. There is normally no need for this. The default value is `Default` (auto-configuration according to the type of data being laid out).
> `TagType` [Default | Name | Id | None ]
>   This statement is for fixing NLF file parameters. It specifies the method for accessing data placed after this statement (automatically configured; by filename; by file ID; no access method). There is normally no need for this. The default value is `Default` (auto-configuration according to the type of data being laid out).

RomSpec Section (TWL-Exclusive Items)

> `DllFile` [Name of dynamic module used by the application] [Name of dynamic module that contains debug information] [ARM9/ARM7]
>   Specifies dynamic module files with debug information, used as the basis for the dynamic module files stored in the ROM image. You must designate whether the specified dynamic module is for the ARM9 or the ARM7.
> `Put` [TwlRom|NitroRom]
>   Toggles whether the files specified on subsequent lines will be placed into a TWL-exclusive or a NITRO-compatible region within the ROM. The default is `NitroRom`.
>   Files located in the `TwlRom` region are TWL-exclusive files and cannot be read from ROM when running in a NITRO mode environment.

### Variable References and Modifier Options

When you write the ROM Spec file, you can reference the value of a variable that is defined outside the ROM Spec file by coding the variable in the following format: `$([variable name])`. You can set variable values with the command-line options `-D`[variable name]`=`[value] or `-M`[variable list filename], or by using environment variables. If the same variable is defined with a command-line option and an environment variable, the command-line option takes priority. If the same variable is defined twice by command-line options, the first defined value takes priority.

The following is example code for referencing a variable.

>     RomSpec
>     {
>         Offset     0x00000000
>         Segment    All
>         File       $(FILENAME)
>     }

If the variable value is in the form of a file path, you can reference various parts of that path by attaching a modifier option immediately after the variable name. The following values can be referenced with the modifier options `:h`, `:t`, `:r`, and `:e`.

> For `$(FILE)=C:/home/Twl/readme.txt`:

> `:h` | The portion of the path up to the final path delimiter. | `$(FILE:h)=C:/home/Twl/`
> `:t` | The portion of the path after the final path delimiter. | `$(FILE:t)=readme.txt`
> `:r` | The path, excluding the file extension. | `$(FILE:r)=C:/home/Twl/readme`
> `:e` | The file extension. | `$(FILE:e)=txt`

### Other Formatting

Keywords such as `RomSpec` used in section definitions can also be written in uppercase (`ROMSPEC`) or lowercase (`romspec`). Anything that follows a pound sign (`#`) is treated as a comment.

To specify multiple items in `File` and `Reject` statements, separate them with blank spaces. Use double quotes (`" "`) to specify filenames that include blank spaces.

>     #
>     # Lines that begin with # are comments

>     #
>     Arm9
>     {
>        Static      "c:/Program Files/myApps/lib/main.sbin"
>        OverlayDefs "c:/Program Files/myApps/lib/overlaydefs.sbin"
>     }

>     Property
>     {
>        RomSpeedType    1TROM
>        BannerFile      ./etc/default.bnr
>     }

>     ROMSPEC  # Uppercase is also OK
>     {
>        Segment  ALL
>        File     boo.dat foo.dat woo.dat
>     }

### ROM Format Versions

Parts of the ROM format have been changed to support new specifications for ROM sizes of 1 gigabit or greater. For ROM images of this size, a fixed-size region at the top is now reserved by the system. In the `makerom` tool of SDK version 3.2 and later, this new ROM format is the default configuration. If you want to output a ROM image in the older format of SDK version 3.1 and earlier, you must specify the `-V1` option.

The changes between the new and old formats are shown below:

> | New ROM Format | Old ROM Format
> --- | --- | ---
> Version Number | `2` | `1`
> Default `Padding` value | `255` | `0`
> Usable size on a 1-gigabit ROM | `125.5 MB = 1004 megabits` | `128.0 MB = 1024 megabits`
> Usable size on a 2-gigabit ROM | `251.0 MB = 2008 megabits` | `256.0 MB = 2048 megabits`
> Usable size on a 4-gigabit ROM | `501.625 MB = 4013 megabits` | `512.0 MB = 4096 megabits`

The system-reserved region in the new ROM format is padded with a value of `255`. The default `Padding` value has also been changed from 0 to 255, regardless of the size of the ROM image.

### Creating ROMs That Run on Production Hardware

ROM images that are created using `makerom.TWL` will only run on TWL development hardware. To create ROMs that run on TWL production hardware, Nintendo must handle the mastering. Developers do not need to confirm that the ROMs run on production hardware. ROM images created using `makerom.TWL` should be submitted for master ROM submission unchanged. For more details, see the Master ROM Submission Guidelines.

Likewise, only NITRO ROMs that have been mastered will run on TWL production hardware. NITRO ROM images created using `makerom` will not run.

### Other Notes

#### Data in the Unused Region at the End of Master ROMs

The unused region at the end of master ROMs is automatically filled with `0xFF` by the `makerom` tool in TWL-SDK.

#### Data in Usage-Forbidden Regions of Master ROMs

For ROMs whose capacity is 1 gigabit or greater, there is a "usage-forbidden" region at the end of the ROM memory map where ROM code cannot be stored. This usage-forbidden region is automatically filled with `0xFF` by the `makerom` tool in TWL-SDK. For ROMs whose capacity is 1 gigabit or greater, the specification states that reading from the usage-forbidden region always outputs `0xFF`. For more about the sizes of usage-forbidden regions, see the Game Card Manual.

#### Use of Data Read from Access-Forbidden Regions

Data output by reading from access-forbidden regions of Game Cards is undefined. (As long as the FS functions of TWL-SDK are used to access files located on a Game Card, access-forbidden regions are never read from.) For more about access-forbidden regions of memory, see the Game Card Manual.

## Location

`$TwlSDK/tools/bin/makerom.exe`
`$TwlSDK/tools/bin/makerom.TWL.exe`
`$TwlSDK/tools/bin/rom_header.template.sbin` `$TwlSDK/tools/bin/rom_header.LTD.sbin`

## See Also

`makelcf`
`makebanner`

## Revision History

2009/11/11 Added conditions under which `OverlayTable` cannot be omitted.
2009/09/02 Added a description of the `-m` option.
2009/07/27 Added a description of supporting Chinese applications to the description of the `Rating` section.
2009/07/14 Added an explanation of `CardRegion` and explanation of the Korean rating organization.
2009/06/08 Added link to the explanation of TWL-exclusive files.
2009/04/13 Added a link to the FS Library Overview from the description of `DigestParam`.
2009/04/07 Added a description of the `PhotoAccess` property.
2009/03/24 Revised explanations related to the priority order of `Align` and `AlignAll`.
2009/03/10 Added a description of `CardRegion` and made revisions following a change to the name of the Australian rating organization.
2009/02/06 Added a description of `CardRegion` and a new description of `Rating`.
2009/02/03 Added a description of `WiFiConnectionIcon` and `AgreeEULA`.
2009/01/08 Added a description of TWL-specific files.
2008/12/16 Revised the description of the default value for `TARGET_PLATFORM`.
2008/12/08 Removed the description of `JpegSign`.
2008/10/31 Added a description of `RomSize`.
2008/10/29 Revised the description of `WramMapping` and `CodecMode`.
2008/10/22 Added to the description of `JpegSign`.
2008/10/22 Added a description of `Property`.
2008/09/16 Added descriptions related to running ROMs on development and production hardware.
2008/09/12 Added a significant number of items and a heading for `makerom.TWL.exe`.
2008/06/04 Changed the default value for `FixSound` and `FixSoundDMA` to `TRUE`.
2008/03/28 Changed descriptions related to SCFG for the ARM7.
2007/11/30 Added settings related to SCFG for the ARM7.
2007/09/27 Added `DllFile`.
2007/06/06 Added a description of the `-M` option.
2007/03/29 Revised text in response to the fact that temporary specifications for the new `2Gbit` ROM format have been adopted as the final specifications.
2006/10/06 Added a description of the scope of `Reject` statements.
2006/08/18 Added a description of `ForKorea`.
2005/05/09 Added support for ROM format versions.
2005/04/26 Changed the term "1-time PROM" to "one-time PROM."
2005/04/11 Added a description of `ForChina`.
2005/04/05 Added a description of `"UNDEFINED"` to `RomSpeedType`.
2005/03/28 Added a description of `RomSpeedType` and the `-W` option.
2004/09/22 Explained the order in which section headings appear.
2004/07/23 Added descriptions for `Align` and `AlignAll`.
2004/06/08 Initial version.

CONFIDENTIAL