diff --git a/ProDOS.pm b/ProDOS.pm index 682013a..d808be7 100644 --- a/ProDOS.pm +++ b/ProDOS.pm @@ -1081,7 +1081,26 @@ sub write_key_vol_dir_blk { return 1; } +# +# Write Volume Directory Block +# +sub write_vol_dir_blk { + my ($pofile, $vol_dir_blk, $prv_vol_dir_blk, $nxt_vol_dir_blk, $dir_ents) = @_; + + my $buf = pack $vol_dir_blk_tmpl, ($prv_vol_dir_blk, $nxt_vol_dir_blk, $dir_ents); + + + if (!write_blk($pofile, $vol_dir_blk, \$buf)) { + print "I/O Error writing block $vol_dir_blk\n"; + return 0; + } + + return 1; +} + +# # Parse Volume Directory Block +# sub parse_vol_dir_blk { my ($buf, $mode, $dbg) = @_; @@ -3054,10 +3073,18 @@ sub format_volume { write_key_vol_dir_blk($pofile, 0x00, 0x03, 0xf0 | length($volume_name), $volume_name, $creation_ymd, $creation_hm, 0x00, 0x00, 0xc3, 0x27, 0x0d, 0, 0x06, $total_blocks, $dir_ents); # Write the rest of the Volume Directory blocks. + my $prv_vol_dir_blk = $key_vol_dir_blk; + my $nxt_vol_dir_blk; for (my $i = $key_vol_dir_blk + 1; $i < 0x06; $i++) { - #write_vol_dir_blk($i); -##FIXME + if ($i == 0x05) { + $nxt_vol_dir_blk = 0x00; + } else { + $nxt_vol_dir_blk = $i + 1; + } + write_vol_dir_blk($pofile, $i, $prv_vol_dir_blk, $nxt_vol_dir_blk, $dir_ents); + $prv_vol_dir_blk++; } + # Write Volume Bit Map blocks. my @bitmaps = (); $bitmaps[0] = 0x01; ##FIXME -- this assumes a 5.25 floppy. diff --git a/README b/README index d49a784..f9fb682 100644 --- a/README +++ b/README @@ -1,16 +1,16 @@ TODO: -prozap.pl -- partially working -procat.pl -- partially working +prozap.pl -- mostly working +procat.pl -- mostly working profree.pl -- mostly working proread.pl -- partially working prowrite.pl -- partially working -prorename.pl -- partially working -prodelete.pl -- partially working -prolock.pl -- partially working -prounlock.pl -- partially working +prorename.pl -- mostly working +prodelete.pl -- mostly working +prolock.pl -- mostly working +prounlock.pl -- mostly working procopy.pl -- started procreate.pl -- partially working proundelete.pl -- started -proformat.pl -- started +proformat.pl -- mostly working