******************************************************************
* Document type: Library reference
* Readme file name: manfld.txt
* Library prefix: FLD
* Library name: File Loader
* Version: 1.20
* Creator: T.K.
* Created: 1/31/96
* Comments: None
******************************************************************


1. Using FLD

   a) Link fld_load.lib in the DDS menu.
   b) Place fld_knl.bin in the CD's root directory.
   c) Link sega_sys.lib in the Demo-Demo System (DDS) game.
      (SYS_Exit function)

2. Warning

Do not link sys_init.obj to the menu IP. The following problems 
occur since sys_init.obj is also executed during game startup:

   a) Cannot return control back to the Audio CD Control Panel
      (Multiplayer) and the game hangs.

   b) The reset button is disabled during the game. The game does
      not restart when the reset button is pressed; the game will
      hang instead.

3. Function Specifications

Those who are making user-interface menus based on the Demo-Demo 
system can call only the interface module of the File Loader. The 
kernel of the File Loader is read by the interface module and 
called from the IP.

3.1 File Loader (Interface Module)

+----------------+----------------+-------------------+-----+
| Title          | Function       | Function Name     | No. |
|                |                |                   |     |
| Function Specs | Execute game   | FLD_ExecGame      | 1.1 |
+----------------+----------------+-------------------+-----+


Format:         Sint32 FLD_ExecGame(Sint8 *ip_name, Sint8
                *dir_name, Sint32 tno)
Input: ip_name: IP filename of the selected game
      dir_name: The directory name in which the selected game is
                located.
           tno: The starting track number for the CD-DA track used
                by the game.
Output:         None
Function Value: Error code
Function:       Starts the game selected from the DOS menu.
Execution
Requirements:   Since GFS is used internally, execute the
                FLD_INIT_DOS function macro and the GFS_Init()
                function before using FLD_ExecGame.

3.2 File Loader (Kernel Module)

+----------------+----------------+-------------------+-----+
| Title          | Function       | Function Name     | No. |
|                |                |                   |     |
| Function Specs | Read 1st read  | FLD_1stRead       | 2.1 |
|                | file           |                   |     |
+----------------+----------------+-------------------+-----+

Format:         void FLD_1stRead(void)
Input:          None
Output:         None
Function Value: None
Function:       Reads the 1st read file of the game and transfers
                it to the 1st read address. If the read is
                unsuccessful, activates the Multiplayer.

3.3 Exit Function

+----------------+----------------+-------------------+-----+
| Title          | Function       | Function Name     | No. |
|                |                |                   |     |
| Function Specs | Exit program   | SYS_Exit          | 3.1 |
+----------------+----------------+-------------------+-----+

Format:         void SYS_Exit(Sint32 code)
Input:    code: Function code
Output:         None
Function Value: None
Function:       Exits according to the function code. 

1) Function Codes

+---------------+--------------------------------------------+
| Function Code | Description                                |
+---------------+--------------------------------------------+
|               | Executes IP check and run during Demo-Demo |
|       0       | use. (Starts up the Demo-Demo based menu)  |
|               | For all other cases, activates the         |
|               | Multiplayer.                               |
+---------------+--------------------------------------------+
|       1       | Activates the Multiplayer unconditionally. |
+---------------+--------------------------------------------+
|       2       | Executes IP check and run unconditionally. |
|               | (Starts up the demo-demo menu)             |
+---------------+--------------------------------------------+
|    Negative   | Infinite loop                              |
|    Value      |                                            |
+---------------+--------------------------------------------+
|     Other     | Same as Function code 0.                   |
+---------------+--------------------------------------------+

[Notes]

The following initialization process takes place in this function 
when an IP check and run is executed:

  a) Disable interrupts (CPU status register and SCU interrupt
     mask register).
  b) Change the system clock to 26 MHz (stops the slave CPU).
  c) Soft reset of the CD block.
  d) Set the stack pointer to the default value (6002000H).

4. Revision History

4.1 Changes from Ver.1.12 to Ver.1.20

1) Changes to the Demo-Demo SYSTEM ID Data Access Area

   The address of the SYSTEM ID area used to store and access data
   for Demo-Demo data has been changed.

   Old address: 60020CCH --> New address: 6000CCCH

   Due to this change addresses after 6002000H can now be used by
   the user application.  The area before 6000E00H cannot be used
   by the user application since it is a system work area.

   Use the following versions of the library:

   - FLD library: Ver.1.20
   - SYS library: Ver.2.10 or later
   - GFS library: Ver.2.10 or later.

2) Changes to the Header File (fld_load.h)

   The following function macro has been added.  Execute GFS_Init
   from the menu program after executing this function macro.

   /* Demo-Demo software initialization */
   #define FLD_INIT_DDS() { \
       (*(Uint32*)GFS_DDS_ADDR=0x20202020);\
   }

3) Changes to the File Loader Interface Module

   a) Memory copy processing to the data area of SYSTEM ID was
      added.
   b) Changed the SEGA_D section variable to the SEGA_C section by
      declaring const.

4) Changes to the kernel module of the file loader

   a) There is no longer a limit on the number of files permitted
      in a root directory.
   b) Checks for CD Door Open and other CD states were improved.

5) Elimination of the exit function

   The exit function is no longer used. The SYS_Exit function
   of the SYS library is now used.

****************************end of file***************************
