MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) SYNOPSYS Mount MSH: MSH:, or just if your current directory is somewhere on MSH:. USAGE MSH: is a real Amiga-style File System handler that handles messydos formatted diskettes. You can use files on such messydos disks in almost exactly the same way as you use files on normal Amiga disks. Supported are 40 or 80 tracks, double-sided 8, 9 or 10 sector floppy disks, and harddisks with a 12 or 16-bit FAT of any dimension the FAT allows. (Due to lack of availability, I have not been able to test MSH: on hard disks; proceed with extreme caution). INSTALLATION Below is given a Mountlist entry. You can append this to your system's default Mountlist (DEVS:Mountlist), or to any other Mountlist you mention with the Mount command: Mount FROM SomeMountlist, as supported by Commodore 1.3 and Arp 1.3 Mount commands. You must put the messydisk.device in DEVS:, and the file MessyFileSystem in L:. You can put these files in other locations, provided you adapt the file names in the Mountlist accordingly. MOUNTLIST A sample Mountlist entry, that works with the Arp 1.3 Mount command: (It will also work with other versions of the Mount command, but may need minor changes. For 1.2, change FileSystem to Handler.) /* * Messy file system on messy blocks: */ MSH: FileSystem = L:MessyFileSystem Device = messydisk.device Unit = 1 Flags = 0 /* * HighCyl is ignored, LowCyl, Surfaces, BlocksPerTrack * and Reserved are used once to find the bootblock. * Further parameters are found there. */ LowCyl = 0 ; HighCyl = 79 Reserved = 0 Surfaces = 2 BlocksPerTrack = 9 /* * Initially the disk cache will be 5 sectors. */ Buffers = 5 Rhialto, KosmoSoft -1- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) /* * If DosType is set to 1, MSH: will wait for DFx: (where * x depends on the Unit parameter above) to recognize * inserted disks (or not). */ DosType = 1 /* * Use BufMemType = 3 [for MEMF_CHIP | MEMF_PUBLIC] if you * use MSH: on the trackdisk.device. */ BufMemType = 1 BootPri = 0 Stacksize = 3072 Priority = 9 GlobVec = -1 /* * Immediately load and start the MessyFileSystem * when started. */ Mount = 1 # This Mountlist entry instructs MSH: to use floppy unit 1, i.e. DF1: and the messydisk.device. You may choose any name instead of MSH: that you like. For this case, MS1: would also be a sensible choice. You can read the separate manual page about messydisk.device. It is supposed to be possible to use MSH: on a harddisk by supplying the proper device name and unit number. If you wish to use floppies truly compatible with those messy machines, you should use the messydisk.device. You cannot change this name into something else. It is also supposed to work on 40-track drives, but this has not been tested by me. The Mountlist entries LowCyl, Surfaces, BlocksPerTrack and Reserved are used once to determine the location of the messydos bootblock. Disk blocks of 512 bytes are assumed in this calculation. The block number of the bootblock is calculated as ›3m(LowCyl * Surfaces * BlocksPerTrack) + Reserved. ›0mFurther information is then obtained from the bootblock (see below). The DosType parameter indicates whether MSH: should be nice to another file system which happens to use the same floppy drive. More about this below. Using floppies, you'll want to set DosType to 1, for use with harddisks 0 is needed. COMPATIBILITY ›0m- Even though MSH: uses one of your floppy drives, you may still use that drive for normal Amiga disks. You will notice that when you insert a disk in the drive used by MSH:, both MSH: and the regular Amiga file system handler may attempt to identify the disk. The result will be that one of the two will be unable to read it, and then leave it alone so that the other may use it. The DosType parameter indicates whether MSH: should be nice to another file system which happens to use the same floppy Rhialto, KosmoSoft -2- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) drive. Because this can only be DF0:, DF1:, DF2: or DF3:, MSH: can derive the name from the Unit parameter. If DosType is set to 1, MSH: will wait for DFx: (where x depends on the Unit parameter) to recognize inserted disks. If it recognizes an inserted disk as an AmigaDOS disk, MSH: will conclude that it should not even attempt to access the disk. If DFx: only notices that some disk has been inserted but does not think it is an AmigaDOS disk, MSH: goes ahead and tries to identify it. If DFx: has not reached some conclusion after approximately 7.5 seconds, MSH: does not wait any longer, and attempts identification anyway. If DosType is not set, both MSH: and DFx: will try to access the disk at the same time. Only one of the two can succeed, but in the mean time they may have a violent fight about the control of the disk drive. For harddisk(partition)s, there is probably no other file system that MSH: must wait for, so DosType should be set to 0. - It is recommended that you don't attempt to refer to MSH: while other filesystems are trying to read the disk. - In some situations where there are multiple errors at the same time (such as trying to delete a non-existent file from a write-protected disk), the error reported may be different than the regular file system. EXTENSIONS ACTION DIE The packet ›3mACTION_DIE ›0mis supported, and even has the result of stopping MSH: and unloading the file system code. This is convenient when you don't need to use MSH: for a while and helps you to conserve memory. A program called ›3mdie ›0mis supplied that sends the ACTION_DIE packet to any handler you wish. ›3m(usage: die MSH:) ›0mIf there is any program running that expects MSH: to remain present even while there are no open or locked files on MSH:, it may be dangerous to remove MSH:. Unfortunately, one such program is the Workbench, so you should not kill MSH: if you also have the Workbench running. ACTION_MORECACHE MSH: handles the packet ACTION_MORECACHE (used by the AddBuffers command) and cache buffers more intelligently. When you add buffers, the required memory is not allocated immediately, but gradually as there becomes a use for it. When you remove a disk its buffers are no longer of use and therefore are all freed and returned to the free memory pool. And, what is more important, you can decrease the maximum number of buffers. By specifying a negative number you reduce the number of buffers. If your AddBuffers does not like negative buffer counts, simply add 65536 to the (negative) number you actually intend. So, instead of -1 you can also specify 65535, -2 is 65534. You wouldn't want Rhialto, KosmoSoft -3- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) to add more than 32767 buffers at once anyway. LIMITATIONS Due to the difference between messydos and AmigaDOS file systems, not all operations that are available for Amiga files can be applied to messydos files. File names The most eye-catching difference are the file names: messydos file names can be at most "8 + 3" characters long. This means that the "base" part of the file name may be eight characters long, maybe followed by a three-character "extension", which is separated from the base name with a period ('.'). Also, you cannot use all characters in the file names you wish, but the charater choice is basically limited to the uppercase letters A-Z, digits 0-9, and most "punctuation" characters except space * ? . < > / = | , : and \. MSH: will try to map file names that you or a program attempts to use to names that are actually allowed. But for utmost flexibility, only the most basic limitations are enforced: the length of the name (8+3), uppercase alphabetics, and the presence of only one period in the name. This means that you might create file names that a messydos computer does not correctly know how to handle. But care has been taken that in no case it would be possible to create a file name that, once created, cannot be handled anymore by MSH:. You can always refer to that file with the same name you used before, even if MSH: changed it for you. Special directories. and. On messydos floppies, every subdirectory has two special entries called "." and "..". They refer to the directory itself and its "parent" directory, respectively. Programs that traverse directory trees on messydos systems take care to skip these "subdirectories", since they really are not "sub" direcories and recursively entering them would lead to nothing but trouble. (Their presence prevents the file system from have a tree structure.) But with AmigaDOS 1.3 and before, no such "hard links" exist, and directory traversing programs would not hesitate to enter them. Therefore, they are ›3mcompletely ›0mhidden from sight. You cannot see them in directory listings nor refer to them by any name. But even while it is hidden, the ".." entry is of course still updated to reflect the new parent directory when a directory is renamed and moved. Note, by the way, that moving directories is an operation that is not supported by messydos itself. Of course, the usual methods of accessing the current directory (the empty name "") and the parent directory ("/") do work. Rhialto, KosmoSoft -4- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) It may be that in the future, when softlinks will be included in AmigaDOS, these "." and ".." directories will be made visible again, but in the disguise of a soft link. In that case, programs which don't know how to handle them should either not exist anymore or ignore the links themselves. Filenotes Messydos has no provision for file notes and therefore they cannot be supported. File protection bits vs. file attributes Currently, the following interpretation of messydos file attributes is performed. The Directory and Volumelabel attributes are honored to make these directory entries different from plain files. The HIDDEN and SYSTEM attributes are mapped to the H(idden) bit. The H bit is mapped to the HIDDEN attribute; the SYSTEM attribute cannot be changed. The READ-ONLY attribute is mapped to the W(rite) and D(elete) bits. Inversely, if a file is set to either Write or Delete protected, the READ-ONLY attribute is set. The ARCHIVE bit, when clear, sets the A(rchived) bit. On messydos the ARCHIVE attribute means (when set) that the file MUST be backed up (by a backup program). A write to a file sets the ARCHIVE attribute. On AmigaDOS the Archived bit means (when set) that the file has been archived already. A write to a file clears the Archived protection bit. Boot block format MSH: relies on the information in the boot block regarding the number of bytes per block, blocks per track, tracks per cylinder, blocks per cluster, etc. The physical information is not actually used to access the disk, except for the number of tracks which is derived from other information. It is used to decide if a 40 track disk is inserted in a 80 track drive. Single sided disks are not supported. The number of sectors may be whatever the underlying device driver supports. (With messydisk.device this is 8, 9 or 10; with trackdisk.device it is 11). Only the logical layout information is used: Size of a block, number of reserved blocks, number of FATs, number of blocks per FAT, number of root directory entries, number of blocks per cluster. The total number of blocks is used to determine the usable part of the disk. (If the FAT says "use a block beyond the limit", this error is not detected). If you format a disk on a messydos computer and wish to use it with MSH:, be sure to use a messydos version new enough to write this information in the boot block. (Version 3.2 works nicely for me.) If you wish to format such a disk on your Amiga, you can use PCF720 by Werner Gόnther with pcFormat on the Extras disk, or use the supplied messyfmt program. Rhialto, KosmoSoft -5- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) Atari diskettes may have a different boot block, which does not contain the information that MSH: requires. On such a disk, you can rewrite the bootblock using the program Messyfmt (see below). Some messydos computers have 80-track floppy drives, but the FORMAT command does not know that. If you format an 80-track floppy on such a system, it is possible that only 40 tracks get formatted, and even the 'wrong' 40 tracks: the outer 40 tracks instead of every other track. If you insert such a disk in an MSH: drive, then MSH: knows that the disk uses only 40 tracks, but wrongly thinks it must use or simulate a 40 track drive. The result is that the files on that disk seem to contain garbage, or parts of other files. To correct this situation, you can access the special file name "MSH::F-" (the F must be in uppercase) each time after you insert that particular disk. On the other hand, the name "MSH::F+" forces MSH: to use 40 track drive emulation mode. FAT The FAT is currently not checked for integrity and consistency. The FAT is assumed to have 12-bit entries if the disk has at most 4086 ($FF6) clusters. If the disk has more clusters than that, 16 bit FAT entries are assumed. This is the method that seems to be used by messy dos 3.0. Workbench The Workbench wants to use filenames that are impossible on messydos floppies. (.info extension) It is therefore not very effective to try to use Workbench on MSH:. Volume label Normal AmigaDOS floppies have a part of the disk reserved for their name. With messydos floppies a name is optional, and should be in the directory in an entry with the special flag (attribute) Volumelabel. MSH: looks in the first directory block only to locate such a volume label. If found, it decides the name of the disk; if not found, the name will become "Unnamed" and the creation date will become 1-Jan-80. Note that AmigaDOS (and MSH:) keep disks apart by their name and creation date. As a result, all unlabeled disks, (and all disks with the same name) will look equivalent and cannot be distinguished. It is therefore strongly recommended that you provide every disk with a unique volume label; the standard AmigaDOS command Relabel can be used for this. If you label a disk that had no label (in the first directory sector) before, MSH: will try to move a file from the first directory block to somewhere else in the root directory. If this is not possible, for instance because the root directory is full, then the labeling will fail as well. Rhialto, KosmoSoft -6- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) Multiple file systems The MessyFileSystem is unfortunately not ``pure''. This means that if you wish to mount multiple messy file systems, you must make a copy of MessyFileSystem for each of these, and mount each one from one of the separate copies. Running two file systems from the same disk file will cause great troubles. (Oh well, maybe AmigaDOS is not so smart to see that two file systems share the same FileSystem name in the Mountlist, so maybe you don't need to have multiple copies of MessyFileSystem on your disk. Try at your own risk. AmigaDOS behaviour might change in the future, of course.) UTILITIES A program called ›3mmessyfmt ›0mallows you to format disks in messydos format. Usage: Messyfmt The name is optional and defaults to "messydisk.device". The program asks for all parameters to put in the bootblock, like Bytes per sector? [512] If you just hit return you accept the default value, otherwise you can enter a new value in the usual notation: 0x = hexadecimal, 0 = octal, and everything else is decimal. A few suffixes are allowed as multiplication factor: m = mega (1048576), k = kilo (1024), s = sectors (512) and b = byte (1). (Not all terms make sense with all questions.) You may create 8, 9 or 10 sector disks by answering the question "Sectors per track" appropriately. You are also asked if you wish to format the whole disk, and if not, if you want to write only the bootblock, or the bootblock, FAT and directory. Finally, to see if you are still awake, you must enter 42 if you are sure to do it. After formatting has completed, you must remove the disk from the drive, in order to let all involved filesystems know that the disk just died and reincarnated. Hint: If you want to format a 40 track floppy in an 80 track drive, it is probably easiest to first format it with 80 tracks, and then re-format just the bootblock. Only then you need to give the correct values for 40 tracks. DiskCopy can be used to copy messydos disks, provided you have one or more file systems mounted. Note, however, that DiskCopy looks at the disk size information as it is present in the Mountlist. Therefore DiskCopy will not copy the entire disk if it is 10-sector while the Mountlist claims it is 9-sector. In the opposite situation, it will try to copy too much which will result in read errors, which may cause the last track not to be copied. You can construct special Mountlist entries for 8 or 10 sector disks if you plan to DiskCopy them; there is no need to really mount these for normal use. Rhialto, KosmoSoft -7- Version 34.8/1.30 MSH:(FileSystems) Amiga Programmer's Manual MSH:(FileSystems) SUGGESTIONS The things I mention here are merely interesting suggestions. They have not all been tried. If they work for you, or if you think of some more, please let me know. Since you can use any disk-type device under MSH:, you need not necessarily use messydisk.device, but you could use trackdisk.device (the normal Amiga disk driver), some kind of harddisk.device or jdisk.device (for use with messydos partitions on bridgeboards), or Matt Dillons fmsdisk.device (a file disguised as a disk device, if you have a messydos disk in an AmigaDOS file for JLink). I have heard of a case where an Amiga drive with MSH: was accessed from the BridgeBoard though JLink. TRADEMARKS Amiga, AmigaDOS, Workbench are trademarks of Commodore-Amiga, Inc. Messydos is presumably a trademark of MessySoft, Inc. AUTHOR The messy file system handler is written by Sourcerer Olaf Rhialto Seibert.