FS Demos

# ROM File System (FS) Sample Demos

## Location

`$TwlSDK/build/demos/fs`

## Compilation

Move to the `$TwlSDK/build/demos/fs` directory and enter the following:

> `% make`

The SRL executable file and the NEF or TEF files containing binary information are created in `$TwlSDK/build/demos/fs/(sample name)/bin/(platform)/(target)/`.

> ``

For example:

> `$TwlSDK/build/demos/fs/overlay/bin/ARM9-TS/Release/main.srl`

will be the executable file for the `overlay` demo.

Notice that FS differs from many other demos in that the `makerom` option is required, so it is not possible to build with `elftobin` (`make TWL_ELFTOBIN=TRUE`).

## Execution

### For NITRO ROMs:

If using the Ensata emulator:

- Execute NEF and SRL files with ensata.

If using IS-NITRO-DEBUGGER:

- Load and execute an NLF file with IS-NITRO-DEBUGGER.
- Execute an SRL file with IS-NITRO-DEBUGGER
- Execute an SRL file with IS-NITRO-DEBUGGER using the `loadrun.exe` tool from a command line.

If using IS-TWL-DEBUGGER:

- Load and execute an NLF file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER using the `loadrun.TWL.exe` tool from a command line.

### For TWL/NITRO HYBRID ROMs:

If using IS-NITRO-DEBUGGER:

- Execute an SRL file with IS-NITRO-DEBUGGER
- Execute an SRL file with IS-NITRO-DEBUGGER using the `loadrun.exe` tool from a command line

If using IS-TWL-DEBUGGER:

- Load and execute a TLF file with IS-TWL-DEBUGGER.
- Execute an SRL file with IS-TWL-DEBUGGER
- Execute an SRL file with IS-TWL-DEBUGGER using the `loadrun.TWL.exe` tool from a command line.

### For TWL LIMITED ROMs:

If using IS-TWL-DEBUGGER:

- Load and execute a TLF file with IS-TWL-DEBUGGER
- Execute an SRL file with IS-TWL-DEBUGGER
- Execute an SRL file with IS-TWL-DEBUGGER using the `loadrun.TWL.exe` tool from a command line.

## Description

Name | Directories | Operation
--- | --- | ---
`file-1` | `demos` | This is a very simple model of the program configuration that is required to use FS.
`file-2` | `demos` | This embeds directories and files and reads them inside the program.
`file-3` | `demos` | This tests the operation of the functions `FS_CreateFileFromMemory` and `FS_CreateFileFromRom`.
`async` | `demos` | This sample repeats synchronous read inside each thread. If the run environment supports asynchronous operation, the thread will be put to sleep and switched only when it is blocked. Otherwise, it will continue to repeat reading a single thread. For details, refer to the description of the `FS_ReadFileAsync` function.
`overlay` | `demos` | This is a simple overlay sample.
`overlay-compressed` | `demos` | Tests the operation of compressed overlay using the `TWL_COMPRESS` build switch. The program itself is the same as that in the "overlay" demo.
`Overlay-staticinit` | `demos` | This sample defines the sinit.h header and the NitroStaticInit function, and uses a static initializer from an overlay written in C.
`arc-1` | `demos` | This is a sample that loads these two archives independently. -Archive that operates the same way as the default ROM archive. -Archive that accesses the internal file system in the program binary file.
`arc-2` | `demos` | This is a sample that loads a customized directory structure that is not compliant with the `TwlROM` format as an archive. Unlike the `arc-1` sample, this sample contains examples that replace basic access commands with user procedures.
`explorer` | `demos` | This is a sample that displays a directory structure within the file system.

## Operation

`Operates normally in all operating environments.`

## See Also

`FS Function List`

## Revision History

2008/07/11 Changed the description corresponding to TWL.
2008/05/22 Added a description of the explorer demo.
2005/06/28 Added a description of a file-3 demo.
2005/05/10 Added a description of the overlay-compressed demo.
2005/03/02 Made revisions to code listed so it meets the conditions of the currently supported environment.
2005/01/19 Added a description of the overlay-staticinit demo.
2004/10/06 Added missing descriptions for some demo.
2004/08/17 Standardized the written style for IS-NITRO-EMULATOR.
2004/07/10 Changed from BIN to SRL.
2004/06/18 Revised the description of the execution method.
2004/05/20 Initial version.

CONFIDENTIAL