PROGRAMMER'S GUIDEFile system library
BackForward
File system library

Four. File access


4.1 Access model

A model diagram of file access is shown in Figure 4.1.

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, the application can transfer data from the CD-ROM without being aware of the reading process.
Use GFS_NwCdRead if you also want the application to control the read process.

4.2 Access pointer

The access pointer is updated by reading, so it moves on a sector-by-sector basis.
Figure 4.2 shows the movement of the access pointer when the process of reading 5000 bytes into the host area buf is executed by executing the following formula. 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 sizes 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 Form 1 only
 2048
 CD-ROM Mode2 Form2 only
 2324
 CD-ROM Mode 2 mixed
 Indefinite
 DOS file
 2048
 Memory file
 2048

Reading is done in sector units, while fetching is done in 4-byte units.

4.3 Parameters managed for each file

Of the parameters managed by the library for each opened file, the application can change five parameters. These parameters are shown in Table 4.2.

Table 4.2 Parameters of each file
 Parameters
 explanation
 Function to change
 initial value
 Access pointer
 Offset on the file to start reading (unit is sector)
 GFS_Seek
 0
 Eject mode
 After removing the CD
Specifies whether to delete or keep the sector data in the buffer
 GFS_SetGmode
 GFS_GMODE_ERASE
 Transfer mode
 Specify the device to perform the retrieval process
 GFS_SetTmode
 GFS_TMODE_CPU
 Read parameters
 Maximum number of sectors to be transferred in one read process
 GFS_SetReadPara
 GFS_RPARA_DFL
 Extraction parameters
 Number of sectors to be transferred in one retrieval process
 GFS_SetTransPara
 1

The open file occupies one aperture and one buffer partition, which are the resources of the CD block.


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