# loadrun

## Description

`loadrun` is a tool for downloading and executing specified binary data on devices, such as IS-NITRO-EMULATOR. This tool can execute quickly from command line because there is no need to run the debugger.

## How to Use

### Start Command

`% loadrun [OPTION]... [NITROSRLFILE]`

`NITROSRLFILE` is the ROM file to execute. srl files can be specified.

Specifying the option `-L or --list` will display a list of identifiable devices that are currently connected. An example of a list that may display is given below.

> `---- Connected devices:
> 0: [NITROUSB] IS-NITRO-EMULATOR serial:04070680
> 1: [NITROUSB] IS-NITRO-EMULATOR serial:04070682
> 2: [NITROUSB] IS-NITRO-EMULATOR serial:04070683
> 3 device(s) found.`

`serial` is the serial number specified by using the `-s` option. `[NITROUSB]` is a device type. If NITRO-DEBUGGER and other applications are using the device, `[NITROUSB]` is set to `[UNKNOWN]`.

If `-l or --lap` is specified, the time from the start of the execution is added to the top of each line as {xx:xx} (minutes: seconds) format when the debug output is output from the ROM file to the display using `OS_Printf()`. An example of this display is given below.

> `{0:01}Program started
> {0:01}--- heap init
> {0:02}x=14 y=50
> {0:04}`

The `-s` and `--serial` options take numeric values as arguments. This option specifies the serial number of the device that will download the srl file. Data is downloaded to the device with that specified serial number. Although an unlikely case, if more than one device has the same serial number, data will be downloaded to the first device found. Note that if a serial number such as 04070680 is displayed in the device list when using the `-L` option, you can omit the initial zero and specify the device using 4070680.

The `-t` and `--timeout` options take numeric values as arguments. This option is used to specify the display timeout in units of seconds. After executing the srl file and receiving the latest `OS_Printf()` data, execution is forced to terminate if more data does not arrive transimitted within the specified amount of time. If zero is specified, no timeout occurs. The same holds if this option is not specified.

The `-T` and `--exec-timeout` options take numeric values as arguments. This option is used to specify the execution timeout in units of seconds. Execution is forced to terminate if the number of specified seconds has elapsed since execution of the srl file began. If zero is specified, there is no execution timeout. The same holds if this option is not specified.

The `-a` and `--abort-string` options specify the character string that ends execution. If the text string specified here appears at the head of the line, execution is forced to terminate. Termination is not determined until a carriage return is found. Gaps of time between displays is fine.

For example, if the termination character string is "ABORT," any of the following

> `OS_Printf("ABORT\n")
> OS_Printf("ABORTING\n")
> OS_Printf("ABORT\nQUIT\n")
> OS_Printf("ABOR");OS_Sleep(1000);OS_Printf("T\n");`

will result in termination, but the following

> `OS_Printf(" 　ABORT\n") // Spaces in front
> OS_Printf("ABO\nRT\n") // Line break in the middle
> OS_Printf("A B O R T\n") // With spaces included so that it the character string is not "ABORT"`

will not cause termination. In addition,

> `OS_Printf("ABORT")`

will not immediately terminate because a line break has not been added. Termination will occur after `OS_Printf("\n")`, `OS_Printf(" SOON\n")`, or other line feed code is encountered later.

The `-c` and `--card-slot` options take arguments. ON or OFF may be specified as arguments. This option is used to lock the card slot during execution. OFF is used if unspecified.

The `-c` and `--cartridge-slot` options take arguments. ON or OFF may be specified as arguments. This option locks the cartridge slot during execution. OFF is used if unspecified.

The `--stdin` option specifies the binary file input that is read from the standard input. In this case, the `NITROSRLFILE` is not a required argument in the command.

If the `-q` or `--quiet` option is specified, quiet mode is used and only error messages will be output.

If the `-v` or `--verbose` option is specified, detailed descriptions of operations are displayed.

The `-h` or `--help` options display simple instructions.

The `--version` option displays the command version.

###
Termination Conditions

- Calling `OS_Exit()` on the DS will cause the specified text string to be displayed and result in program HALT status. If `loadrun` accepts this display text string data, the termination status will be set to the value specified by `OS_Exit()` and `loadrun` will terminate.

- Using an option ends it with the display of a character string specified by the user.

-Using an option ends it as if the execution time exceeds the execution timeout specified by the user.

- Using an option ends it as if there is no display for a longer period of time than the display timeout specified by the user.

- It also terminates if ctrl-C is used to stop the program.

## Location

`$NitroSDK/tools/bin/loadrun.exe`

## See Also

`buryarg, nitrorun, OS_Exit`

## Revision History

09/05/2005 Deleted device type options.
08/31/2005 Initial version.