aboutsummaryrefslogtreecommitdiffstats
path: root/tools/makedisk.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-10-14 16:33:01 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-10-14 16:33:01 +0000
commita1c600e015b2a9908ce0f4195dd4ad5e65662833 (patch)
tree0e0dfdf20665f5cd8f68068de7e13969f2b25d09 /tools/makedisk.pl
parent526a76ef20eca467d566fb78ec243e3a4389fc92 (diff)
downloadabc80-a1c600e015b2a9908ce0f4195dd4ad5e65662833.tar.gz
abc80-a1c600e015b2a9908ce0f4195dd4ad5e65662833.tar.xz
abc80-a1c600e015b2a9908ce0f4195dd4ad5e65662833.zip
mkfs/DOSGEN script for 64 MB "hard drive"
Diffstat (limited to 'tools/makedisk.pl')
-rwxr-xr-xtools/makedisk.pl54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/makedisk.pl b/tools/makedisk.pl
new file mode 100755
index 0000000..8d8a5e9
--- /dev/null
+++ b/tools/makedisk.pl
@@ -0,0 +1,54 @@
+#!/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;
+ }
+ }
+}