FS Demos

# Sample Demo of the ROM File System (FS)

## Location

`$NitroSDK/build/demos/fs`

## Compilation

Move to the `$NitroSDK/build/demos/fs` and enter

> `% make`

Executable (.`.nef`, `.srl`) files will be generated in

> `$NitroSDK/build/demos/fs/sample_name/bin/platform/target/`

For example:

> `$NitroSDK/build/demos/fs/overlay/bin/ARM9-TS/Release/`

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

## Execution

Move to the `$NitroSDK/build/demos/fs/sample_name/bin/platform/target/` directory and do one of the following.

- Execute `*.nef`, `*.srl` with ensata.
- Load and execute a `*.nlf` file with IS-NITRO-DEBUGGER.
- Execute a `*.srl` file with IS-NITRO-DEBUGGER

## Description

`file-1` | This is a very simple model of the program configuration that is required to use FS.
`file-2` | This embeds directories and files and reads them inside the program.
`file-3` | This tests the operation of the functions `FS_CreateFileFromMemory` and `FS_CreateFileFromRom`.
`async` | This sample repeats synchronous read inside each thread. In the case that 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` | This is a simple overlay sample.
`overlay-compressed` | Tests the operation of compressed overlay using the `NITRO_COMPRESS` build switch. The program itself is the same as that in the "overlay" demo.
`Overlay-staticinit` | This sample defines the `sinit.h` header and the `NitroStaticInit` function, and uses a static initializer from an overlay written in C.
`arc-1` | 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 stored as a file.
`arc-2` | This is a sample that loads an unique directory that does not comply with the NitroROM format as an archive. Unlike the `arc-1` sample, this sample shows some examples that replace some of the basic access commands from the default processes by user procedure.

## Emulator

`Works in all execution environments.`

## See Also

`FS Function List`

## Revision History

06/28/2005 Added description of file-3 demo.
05/10/2005 Added description of the overlay-compressed demo.
03/02/2005 Revised descriptions to reflect current support environment conditions.
01/19/2005 Added description of overlay-staticinit demo.
10/06/2004 Revised and added a part of the description regarding samples.
08/17/2004 Standardized the notation of the IS-NITRO-EMULATOR.
07/10/2004 Changed from `.bin` to `.srl`. 06/18/2004 Revised the description of the execution method
05/20/2004 Initial Version