#!/usr/bin/perl # # This creates four empty UFD-DOS volumes of ~15 MB each, # specifically 238x256x256 = 15,597,568 (0xee0000) bytes, # which is the largest volume that UFD-DOS can safely address. # # The total capacity is 62,390,272 bytes, which should fit on # a "64 MB" CF card even with the "modern" definitions of 64 MB... # use bytes; binmode STDOUT; $at = "\xc0" x 256; # Fill for uninitialized sectors $ff = "\xff" x 256; for ( $v = 0 ; $v < 4 ; $v++ ) { # Track 0: Sector 14 -> bitmap, 15 -> init bitmap, 16+ -> dirmap? for ( $i = 0 ; $i < 14 ; $i++ ) { print $at; } for ( $i = 14 ; $i < 16 ; $i++ ) { # First cluster (32 sectors) occupied by system info # There seems to be a bug in UFD-DOS that it will continue # an extent out from the end of the disk if there is not # a "busy" cluster at the end of the bitmap. Thus we limit # ourselves to 238 tracks. # 239 bytes occupied by cluster information (0 for empty; the first # should be 80 to protect the system sectors) # (the last must be FF # for the reason described above) # 16 bytes occupied by root directory information (01 for empty) # 1 spare byte (always zero?) # THIS IS THE REAL ONE... print "\x80", "\x00" x 237, "\xff", "\1" x 16, "\0"; # HACK TO TEST UNDER NEAR FULL CONDITIONS # print "\xff" x 237, "\x00", "\xff", "\1" x 16, "\0"; } for ( $i = 16 ; $i < 32 ; $i++ ) { # Root directory sector print "\0" x 16, "\xff" x 240; } for ( $i = 32 ; $i < 256 ; $i++ ) { print $at; } # Track 1-237 for ( $i = 1 ; $i < 238 ; $i++ ) { # Sector for ( $j = 0 ; $j < 256 ; $j++ ) { print $at; } } }