From 0c133140b651cd8ef5a5bb02e1f361fd4974b0f9 Mon Sep 17 00:00:00 2001 From: Leeland Heins Date: Thu, 7 Mar 2019 08:59:16 -0600 Subject: [PATCH] Work on writing tree files --- ProDOS.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ProDOS.pm b/ProDOS.pm index 25bc174..cdb4b5d 100644 --- a/ProDOS.pm +++ b/ProDOS.pm @@ -1708,9 +1708,11 @@ sub write_file { $file_storage_type = 0x30; # Create the master index block. -##FIXME + my @master_index = (); + my $masterblknum = pop @free_blocks; + # Add master index block to used blocks -##FIXME + push @used_blocks, $masterblknum; # Create the subindex blocks. ##FIXME @@ -1721,6 +1723,19 @@ sub write_file { ##FIXME # Add each block to used blocks list. ##FIXME + + # Write out the index blocks. +##FIXME + # Add each index block to the master block. +##FIXME + + # Write out the master index block. + my $masterbuf = pack "C*", @master_index; + + if (!write_blk($pofile, $masterblknum, \$masterbuf)) { + print "I/O Error writing block $masterblknum\n"; + return 0; + } } # Read & rewrite the file descriptive entry out.