Gp32 Smc Questions


QuasaR

Member
Joined
Jul 22, 2003
Messages
222
Location
Cologne
Website
www.echtzeitroolen.de
Hi there!
I've got just some questions regarding the SMC:

1. Which FAT system does the GP23 use? FAT16 or FAT12?
2. Does anybody has recognized bugs when using long filenames? (I mean when you copy a file with a cardreader onto the SMC with Win XP. I know, the GP32 will only display the first 8 characters but maybe it'll destroy the filesystem or produces bugs when you're using long filenames.)
3. Does anybody know a tool to mark bad blocks as used? I've a bad SMC and it would be handy to mark them so no program can write onto them.
4. Does anybody uses a cardreader with Linux and can tell me the mount command he/she is using (I'm using "mount -t msdos /dev/sdd1 /mnt/smc" but I'm not quite sure about the "-t msdos" option...)

Thanx in advance!
 
There seems to be a lot of confusion about FAT12, FAT16 and long filenames in releation to SMC and the GP32. I decided to pick my brain (and the internet) to come up with some answers.

FAT12/16
The GP32 supports FAT12 and FAT16. The 12 and 16 refer to the number of bits used for adressing a cluster on the disk (SMC). So FAT12 can adress 4096 clusters and FAT16 ~65000. For this reason FAT12 is normally only used for smaller (<16MB) volumes giving a cluster size of 4 KB.

When you format your SMC with GPLink however it will use a cluster size of 16KB. For this reason a 32MB card still gets formatted with FAT12. A 128MB card gets formatted with FAT16. (I don't have a 64MB card)

This can waste a lot of space if you have a great number of files on your SMC because a 16KB cluster size means that the file size is always a multitude(?) of 16KB. So a 12 byte highscore file takes up 16KB disk space, a 50Kb file takes up 64KB (4*16) diskspace.

When you format you SMC from Windows with a cardreader Windows will put FAT16 on it with a 2KB cluster size. So if you have a lot of small files on your SMC you can put more files on the same SMC when formatted with windows using a cardreader.


Long filenames
FAT12/16 only support filenames with the 8.3 format. Long filenames are supported by MicroSoft through VFAT. VFAT (Virtual FAT) is not a file system but a driver that sits between Windows and FAT12/16. VFAT allocates additional directory blocks to hold the long filename. So where a 8.3 filename takes up 1 FAT entry a long filename takes up several.

It first creates the file with the 8.3 filename and then creates additional 0-byte dummy 'files' which have the attributes DHSV (Directory, Hidden, System, Volume) set. These files are ignored by non VFAT systems because the volume attribute can never be set together with one ot the three other attributes.

So this make it possible to format your SMC with GPLink and then with your cardreader have Windows put long filenames on it. Your GP32 won't see the long filenames (unless the program your running has VFAT support) but when you copy files back to your PC with a cardreader the long filenames are still intact.

Warnings
I don't know exactly when Windows makes a VFAT entry. Obviously it does this when the filename is longer than the 8.3 format. I think it also makes a VFAT entry when the filename is within the 8.3 limit but you use 'strange' characters in you filename (spaces) or even use lowercase letters in you filename.

Another thing I noticed is that FAT12/16 only support one datetime field (date last changed). When you copy a file to your SMC with a cardreader this file automatically has a creation, modification and last accessed date. I think this information can only be stored in a VFAT entry. This would mean that Windows *always* makes a VFAT entry for every file. Even if your file fits perfectly in the 8.3 filename specification.

Problems
As explained before a long filename consists of the real file and several 0-byte dummy files containing the long filename. VFAT makes sure that when a file(name) gets changed, moved or deleted that the short and the longfilename get changed.

On a system that doesn't support VFAT however only the short filename will be changed, moved or deleted. So while the (V)FAT still contains the longfilename the (short filename) file itself may already be deleted. This can lead to a damaged FAT and an unreadable SMC on your GP32. I still don't know when this happens.

My estimated guess is that this does not happen imediatley (because the file is still there, only the FAT entry is removed) but happens when the GP32 starts to write files over the sectors containing the deleted file.

More info
For checking most of the things mentioned above I used the excellent WinHex.

For more information about VFAT,FAT16,FAT12,SMC and long filenames check the following links:

http://www.yale.edu/pclt/BOOT/VFAT.htm
http://www.pcguide.com/ref/hdd/file/partSizes-c.html

http://www.tldp.org/HOWTO/Filesystems-HOWTO-3.html
http://averstak.tripod.com/fatdox/names.htm
http://www.interclasse.com/scripts/longfn2short.php
http://www.ntfs.com/fat-filenames.htm

http://www.win.tue.nl/~aeb/linux/smartmedi...edia_Format.pdf
 
Last edited by a moderator:
The GP32 can read long file names and some programs support them, so no damage can be done.

-Craig

www.gbax.com
 
When a GP32 app that you program creates a basic file, are all of these dummy files taken care of automatically, or will it create a non VFAT file?

I've only used PC-Link to transfer files to and from the GP32, so does that mean I don't have a VFAT setup?
 
Only filenames > 8 character + 3 extension will have VFAT entries, and only when created on a vfat capable os. So creating on the GP32 (which includes things like GPManager, PCLink, etc) will only create 8.3 names - the rest of the name will be truncated.

When files are created under Windows or Linux, suitable filenames will have VFAT entries, compatible OS's will use these. Incompatible ones will ignore them.

4. Does anybody uses a cardreader with Linux and can tell me the mount command he/she is using (I'm using "mount -t msdos /dev/sdd1 /mnt/smc" but I'm not quite sure about the "-t msdos" option...)

mount -t msdos /dev/sdd1 /mnt/smc (gives 8.3 filenames with truncation)

mount -t vfat /dev/sdd1 /mnt/smc (gives long file name support)
 
Last edited by a moderator:
Back
Top