Japanese
PROGRAMMER'S GUIDEFile system library
BackForward
file system library

Four. file access


4.1 Access model

Figure 4.1 shows a model diagram of file access.

Figure 4.1 Access function model

Transferring data from the CD-ROM to the CD buffer is called "reading," and transferring data from the CD buffer to the host area is called "extracting."
By using GFS_Fread and GFS_NwFread, applications can transfer data from CD-ROM without being aware of the read process.
Use GFS_NwCdRead if you want to control the reading process as well in your application.

4.2 Access pointer

The access pointer is updated by reading, so it moves sector by sector.
Figure 4.2 shows the movement of the access pointer when the following formula is executed to read 5000 bytes into the host area buf. After execution, the access pointer has moved from AP1 to AP2.

GFS_Fread(gfs, 3, buf, 5000);

Figure 4.2 Moving the access pointer

Table 4.1 shows the sector size for each file type.

Table 4.1 Sector length for each file type
 file category
 Sector length (byte)
 CD-ROM Mode1
 2048
 CD-ROM Mode2 Form1 only
 2048
 CD-ROM Mode2 Form2 only
 2324
 CD-ROM Mode2 mixed
 Indeterminate
 DOS file
 2048
 memory file
 2048

Reading is performed in sectors, while retrieval is performed in 4-byte units.

4.3 Parameters managed per file

The application can change five of the parameters managed by the library for each file opened. Those parameters are shown in Table 4.2.

Table 4.2 Parameters for each file
 parameters
 explanation
 function to change
 initial value
 access pointer
 start loading
Off on the file to
Set (unit: sector)
 GFS_Seek
 0
 Eject mode
 After removing the CD
Buffer sector data
Delete or leave
Specify where to store
 GFS_SetGmode
 GFS_GMODE_ERASE
 Transfer mode
 Execute the retrieval process.
Specify the device to use
 GFS_SetTmode
 GFS_TMODE_CPU
 Load parameters
 1 load
Transfer by processing
Maximum number of sectors
 GFS_SetReadPara
 GFS_RPARA_DFL
 Retrieval parameters
 1 time retrieval
Transferred by processing
number of sectors
 GFS_SetTransPara
 1

An open file occupies one CD block resource, one aperture and one buffer partition.


BackForward
PROGRAMMER'S GUIDEFile system library
Copyright SEGA ENTERPRISES, LTD., 1997