diff --git a/DOS33.pm b/DOS33.pm index 6ffd18b..ea45d29 100644 --- a/DOS33.pm +++ b/DOS33.pm @@ -1157,5 +1157,31 @@ $debug = 1; } } +# +# Undelete a file +# +sub undelete_file { + my ($dskfile, $filename, $dbg) = @_; + + $debug = 1 if (defined $dbg && $dbg); + + print "dskfile=$dskfile filename=$filename\n"; + + return 1; +} + +# +# Initialize a disk image. +# +sub init { + my ($dskfile, $volume, $dbg) = @_; + + $debug = 1 if (defined $dbg && $dbg); + + print "dskfile=$dskfile volume=$volume\n"; + + return 1; +} + 1; diff --git a/README b/README index 711712b..fe48c46 100644 --- a/README +++ b/README @@ -4,10 +4,12 @@ catalog.pl -- mostly working freemap.pl -- mostly working dos33read.pl -- mostly working for simple text files dos33write.pl -- in progress -dos33umlock.pl -- mostly working +dos33unlock.pl -- mostly working dos33lock.pl -- mostly working dos33rename.pl -- mostly working dos33delete.pl -- in progress dos33copy.pl -- started zap.pl -- partially working +dos33undelete.pl -- started +dos33init.pl -- started diff --git a/dos33init.pl b/dos33init.pl new file mode 100644 index 0000000..012dfcc --- /dev/null +++ b/dos33init.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w + +# +# dos33init.pl: +# +# Utility to initialize an Apple II DOS 3.3 disk image. +# +# 20190310 LSH +# + +use strict; + +use DOS33; + +my $debug = 0; +my $volume = 254; + +while (defined $ARGV[0] && $ARGV[0] =~ /^-/) { + # Volume + if ($ARGV[0] eq '-v' && defined $ARGV[1] && $ARGV[1] =~ /^\d+$/) { + $volume = $ARGV[1]; + shift; + shift; + # Debug + } elsif ($ARGV[0] eq '-d') { + $debug = 1; + shift; + } else { + die "Unknown command line argument $ARGV[0]\n"; + } +} + +my $dskfile = shift or die "Must supply .dsk filename\n"; +die "Volume must be 1-254\n" if $volume < 1 || $volume > 254; + +init($dskfile, $volume, $debug); + +1; + diff --git a/dos33undelete.pl b/dos33undelete.pl new file mode 100644 index 0000000..09ca59a --- /dev/null +++ b/dos33undelete.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl -w + +# +# dos33undelete.pl: +# +# Utility to undelete a file on an Apple II DOS 3.3 disk image. +# +# 20190310 LSH +# + +use strict; + +use DOS33; + +my $debug = 0; + +while (defined $ARGV[0] && $ARGV[0] =~ /^-/) { + # Debug + if ($ARGV[0] eq '-d') { + $debug = 1; + shift; + } else { + die "Unknown command line argument $ARGV[0]\n"; + } +} + +my $dskfile = shift or die "Must supply .dsk filename\n"; +my $filename = shift or die "Must supply filename (on disk image)\n"; + +undelete_file($dskfile, $filename, $debug); + +1; +