From 899a8f268eccd02040ddc0cc571cb3f8fef9f0d2 Mon Sep 17 00:00:00 2001 From: Leeland Heins Date: Tue, 5 Mar 2019 07:59:29 -0600 Subject: [PATCH] Work on writing files. --- ProDOS.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ProDOS.pm b/ProDOS.pm index 888a99c..1f4ac4d 100644 --- a/ProDOS.pm +++ b/ProDOS.pm @@ -1532,11 +1532,14 @@ sub write_file { } # Find an empty file descriptive entry in the proper subdirectory. +##FIXME # May need to add a subdirectory block if the directory is full. +##FIXME # Read in the file. my $ifh; my $file_buffer; + my @used_blocks = (); if (open($ifh, "<$filename")) { my $file_buffer = <$ifh>; @@ -1546,21 +1549,39 @@ sub write_file { # Seedling file. # Write the single block +##FIXME } elsif ($numblocks <= 256) { # Sapling file. # Write out the index block. +##FIXME + # Add index block to used blocks +##FIXME # Write out the data blocks. +##FIXME + # Add each block to used blocks list. +##FIXME } else { # Tree file. # Create the master index block. +##FIXME + # Add master index block to used blocks +##FIXME # Create the subindex blocks. +##FIXME + # Add each subindex block to used blocks +##FIXME # Write out the data blocks. +##FIXME + # Add each block to used blocks list. +##FIXME } + # Mark blocks as used. + reserve_blocks($pofile, \@used_blocks, $debug); } else { return 0; }