The 32MB compact flash has a FAT-16 file system when formatted in Windows. A FAT file system volume is composed of four basic regions, which are laid out in this order on the volume: Boot Sector, FAT Region, Root Directory Region (doesn’t exist on FAT32 volumes), and Data region.

Boot sector has useful information about the drive. So, I recommend reading it first to have an idea about drive parameters. The FAT contains the pointers to clusters in the drive. As the drive is defragmented, I don't need to follow the pointers to read a file. Instead, at reset, I read the root directory, which is located after the FAT. It contains file names, sizes etc. and the starting cluster numbers. I parse the data to find the starting cluster numbers which is somewhat complicated because of sector boundaries. I store the 2-byte cluster numbers starting at SRAM location 0x62 and the number of files at 0x61. I also read the file sizes to find the last cluster of the last file and store this value at the end of table for the starting cluster numbers. All this is done in the read_root_dir function. The SRAM memory can hold up to around 200 file addresses this way. 

So, when I need to skip to a given track, I just read the table that contains the starting cluster number for the entry corresponding to that track. Then, I translate the 2-byte cluster number to sector - head - cylinder format using the compute_addr function. After that, a read command can be sent to the compact flash card using this address.

The Tag information is read by going to the cluster before the next track's first cluster and searching for the sequence 'TAG'. After finding 'TAG', the artist and title name are read and sent to the LCD and then the track number.

The function check_overflow checks whether the current cluster no which is incremented continually has exceeded the next track's first cluster number. If this happen there are two cases. If this is the last track, the Track number is reset to 1 and it waits for Play button. Otherwise the track number is incremented and the tag information of the track is read.

Please refer to the Microsoft white paper for details.