mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-25 16:34:00 +00:00
Wiz 5 is now recognisable
This commit is contained in:
parent
f47ae78cfb
commit
8d562ddf12
@ -4,16 +4,16 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.utilities.FileFormatException;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
|
||||
public class PascalCode extends AbstractFile
|
||||
implements PascalConstants, Iterable<PascalSegment>
|
||||
{
|
||||
private final List<PascalSegment> segments = new ArrayList<PascalSegment> (16);
|
||||
private final String comment;
|
||||
private final int blockOffset;
|
||||
private final Relocator relocator;
|
||||
// private final int blockOffset;
|
||||
// private final Relocator relocator;
|
||||
|
||||
public static void print ()
|
||||
{
|
||||
@ -26,17 +26,15 @@ public class PascalCode extends AbstractFile
|
||||
{
|
||||
super (name, buffer);
|
||||
|
||||
this.blockOffset = blockOffset;
|
||||
this.relocator = relocator;
|
||||
SegmentDictionary segmentDictionary = new SegmentDictionary (name, buffer);
|
||||
if (!segmentDictionary.isValid ())
|
||||
throw new FileFormatException ("Error in PascalSegment");
|
||||
// this.blockOffset = blockOffset;
|
||||
// this.relocator = relocator;
|
||||
if (relocator != null)
|
||||
relocator.getMultiDiskAddress ("SEG-DIC", blockOffset, 1);
|
||||
|
||||
int nonameCounter = 0;
|
||||
if (false)
|
||||
{
|
||||
// System.out.println (name);
|
||||
// byte[] key = new byte[] { 0x38, 0x00, 0x0C, 0x1C };
|
||||
byte[] key = new byte[] { 0x0F };
|
||||
Utility.find (buffer, key);
|
||||
}
|
||||
|
||||
// Create segment list (up to 16 segments)
|
||||
for (int i = 0; i < 16; i++)
|
||||
@ -47,6 +45,7 @@ public class PascalCode extends AbstractFile
|
||||
codeName = "<NULL" + ++nonameCounter + ">";
|
||||
if (size > 0)
|
||||
{
|
||||
// this could throw an exception
|
||||
PascalSegment pascalSegment =
|
||||
new PascalSegment (codeName, buffer, i, blockOffset, relocator);
|
||||
segments.add (pascalSegment);
|
||||
@ -63,8 +62,8 @@ public class PascalCode extends AbstractFile
|
||||
|
||||
text.append ("Segment Dictionary\n==================\n\n");
|
||||
|
||||
text.append ("Slot Addr Blks Len Name Kind"
|
||||
+ " Txt Seg Mch Ver I/S I/S D:Blk\n");
|
||||
text.append ("Slot Addr Blks Byte Name Kind"
|
||||
+ " Txt Seg Mch Ver I/S I/S Disk:Block\n");
|
||||
text.append ("---- ---- ---- ---- -------- ---------------"
|
||||
+ " --- --- --- --- --- --- ---------------------\n");
|
||||
|
||||
|
@ -70,8 +70,8 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
|
||||
if (relocator != null)
|
||||
{
|
||||
if (segmentNoHeader > 1)
|
||||
{
|
||||
// if (segmentNoHeader > 1)
|
||||
// {
|
||||
int sizeInBlocks = (size - 1) / BLOCK_SIZE + 1;
|
||||
int targetBlock = blockNo + blockOffset;
|
||||
addresses = relocator.getMultiDiskAddress (name, targetBlock, sizeInBlocks);
|
||||
@ -83,7 +83,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
else
|
||||
offset = -1;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
if (offset < 0)
|
||||
@ -144,14 +144,14 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
text.append (title + "\n"
|
||||
+ "===============================".substring (0, title.length ()) + "\n\n");
|
||||
String warning = segmentNoBody == segmentNoHeader ? ""
|
||||
: String.format (" (%02X in header)", segmentNoHeader);
|
||||
: String.format (" (%02X in routine)", segmentNoBody);
|
||||
text.append (String.format ("Address........ %02X%n", blockNo));
|
||||
if (addresses != null)
|
||||
// if (addresses != null)
|
||||
text.append (String.format ("Multi disk .... %s%n", getMultiDiskAddresses ()));
|
||||
text.append (String.format ("Length......... %04X%n", buffer.length));
|
||||
text.append (String.format ("Machine type... %d%n", machineType));
|
||||
text.append (String.format ("Version........ %d%n", version));
|
||||
text.append (String.format ("Segment........ %02X%s%n", segmentNoBody, warning));
|
||||
text.append (String.format ("Segment........ %02X%s%n", segmentNoHeader, warning));
|
||||
text.append (String.format ("Total procs.... %d%n", procedures.size ()));
|
||||
|
||||
text.append ("\nProcedure Dictionary\n====================\n\n");
|
||||
@ -199,11 +199,12 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
String multiDiskAddressText = "";
|
||||
int sizeInBlocks = (size - 1) / BLOCK_SIZE + 1;
|
||||
|
||||
if (segmentNoHeader == 1) // main segment
|
||||
{
|
||||
multiDiskAddressText = String.format ("1:%03X", (blockNo + blockOffset));
|
||||
}
|
||||
else if (relocator != null)
|
||||
// if (segmentNoHeader == 1) // main segment
|
||||
// {
|
||||
// multiDiskAddressText = String.format ("1:%03X", (blockNo + blockOffset));
|
||||
// }
|
||||
// else
|
||||
if (relocator != null)
|
||||
{
|
||||
int targetBlock = blockNo + blockOffset;
|
||||
List<MultiDiskAddress> addresses =
|
||||
|
@ -35,6 +35,9 @@ public class Relocator extends AbstractFile
|
||||
addresses
|
||||
.add (new MultiDiskAddress (diskRecord.diskNumber, diskSegment.logicalBlock,
|
||||
diskSegment.physicalBlock, diskSegment.segmentLength));
|
||||
|
||||
getMultiDiskAddress ("BOOT", 0, 2);
|
||||
getMultiDiskAddress ("CATALOG", 2, 4);
|
||||
}
|
||||
|
||||
public void list ()
|
||||
@ -51,6 +54,7 @@ public class Relocator extends AbstractFile
|
||||
List<MultiDiskAddress> foundAddresses = new ArrayList<MultiDiskAddress> ();
|
||||
newAddresses.clear ();
|
||||
oldAddresses.clear ();
|
||||
// System.out.printf ("%04X %04X %s%n", blockNumber, length, name);
|
||||
|
||||
for (MultiDiskAddress multiDiskAddress : addresses)
|
||||
{
|
||||
@ -103,6 +107,22 @@ public class Relocator extends AbstractFile
|
||||
text.append ("\n");
|
||||
}
|
||||
|
||||
int previousDiskNumber = 0;
|
||||
for (MultiDiskAddress multiDiskAddress : addresses)
|
||||
{
|
||||
if (multiDiskAddress.diskNumber != previousDiskNumber)
|
||||
{
|
||||
previousDiskNumber = multiDiskAddress.diskNumber;
|
||||
text.append ("\n");
|
||||
text.append ("Disk Logical Physical Size Name\n");
|
||||
text.append ("---- ------- -------- ---- -----------\n");
|
||||
}
|
||||
text.append (String.format (" %d %03X %03X %03X %s%n",
|
||||
multiDiskAddress.diskNumber, multiDiskAddress.logicalBlockNumber,
|
||||
multiDiskAddress.physicalBlockNumber, multiDiskAddress.totalBlocks,
|
||||
multiDiskAddress.name));
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
@ -135,16 +155,13 @@ public class Relocator extends AbstractFile
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
int offset = 0xe2;
|
||||
|
||||
text.append (String.format ("Disk number.... %04X%n", diskNumber));
|
||||
text.append (String.format ("Segments....... %04X%n%n", totDiskSegments));
|
||||
text.append (String.format (
|
||||
"Segment Logical Physical Length -%04X -%04X%n", offset, offset));
|
||||
text.append (String.format ("Segment Logical Physical Length%n"));
|
||||
|
||||
int count = 1;
|
||||
for (DiskSegment segment : diskSegments)
|
||||
text.append (String.format (" %02X %s %n", count++, segment.toString (offset)));
|
||||
text.append (String.format (" %02X %s %n", count++, segment.toString ()));
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
public class SegmentDictionary
|
||||
{
|
||||
private final boolean isValid;
|
||||
|
||||
public SegmentDictionary (String name, byte[] buffer)
|
||||
{
|
||||
isValid = !name.equals ("SYSTEM.INTERP"); // temporary
|
||||
}
|
||||
|
||||
public boolean isValid ()
|
||||
{
|
||||
return isValid;
|
||||
}
|
||||
}
|
@ -34,16 +34,10 @@ abstract class CatalogEntry implements AppleFileSource
|
||||
bytesUsedInLastBlock = HexFormatter.intValue (buffer[16], buffer[17]);
|
||||
|
||||
Disk disk = parent.getDisk ();
|
||||
for (int i = firstBlock; i < lastBlock; i++)
|
||||
{
|
||||
if (i >= 0x118)
|
||||
{
|
||||
System.out.printf ("CatalogEntry: block 0x%04X >= 0x0118%n", i);
|
||||
break;
|
||||
}
|
||||
int max = Math.min (lastBlock, 0x118);
|
||||
for (int i = firstBlock; i < max; i++)
|
||||
blocks.add (disk.getDiskAddress (i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains (DiskAddress da)
|
||||
|
@ -17,6 +17,13 @@ class FileEntry extends CatalogEntry
|
||||
bytesUsedInLastBlock = HexFormatter.intValue (buffer[22], buffer[23]);
|
||||
date = HexFormatter.getPascalDate (buffer, 24);
|
||||
|
||||
if (relocator != null)
|
||||
{
|
||||
int size = lastBlock - firstBlock;
|
||||
// System.out.printf ("%04X %04X %s%n", firstBlock, size, name);
|
||||
relocator.getMultiDiskAddress (name, firstBlock, size);
|
||||
}
|
||||
|
||||
for (int i = firstBlock; i < lastBlock; i++)
|
||||
{
|
||||
if (i >= 280)
|
||||
@ -114,7 +121,7 @@ class FileEntry extends CatalogEntry
|
||||
byte[] buffer = parent.getDisk ().readSectors (blocks);
|
||||
byte[] exactBuffer;
|
||||
|
||||
if (bytesUsedInLastBlock < 512)
|
||||
if (buffer.length > 0 && bytesUsedInLastBlock < 512)
|
||||
{
|
||||
int exactLength = buffer.length - 512 + bytesUsedInLastBlock;
|
||||
exactBuffer = new byte[exactLength];
|
||||
|
@ -105,13 +105,19 @@ public class PascalDisk extends AbstractFormattedDisk
|
||||
fileEntries.add (fileEntry);
|
||||
DefaultMutableTreeNode node = new DefaultMutableTreeNode (fileEntry);
|
||||
|
||||
if (fileEntry.fileType == 5 && fileEntry.getDataSource () instanceof Relocator)
|
||||
this.relocator = (Relocator) fileEntry.getDataSource ();
|
||||
DataSource dataSource = fileEntry.getDataSource ();
|
||||
|
||||
if (fileEntry.fileType == 2 && fileEntry.getDataSource () instanceof PascalCode)
|
||||
if (fileEntry.fileType == 5 && dataSource instanceof Relocator)
|
||||
{
|
||||
this.relocator = (Relocator) dataSource;
|
||||
int size = fileEntry.lastBlock - fileEntry.firstBlock;
|
||||
relocator.getMultiDiskAddress (fileEntry.name, fileEntry.firstBlock, size);
|
||||
}
|
||||
|
||||
if (fileEntry.fileType == 2 && dataSource instanceof PascalCode)
|
||||
{
|
||||
node.setAllowsChildren (true);
|
||||
PascalCode pascalCode = (PascalCode) fileEntry.getDataSource ();
|
||||
PascalCode pascalCode = (PascalCode) dataSource;
|
||||
for (PascalSegment pascalSegment : pascalCode)
|
||||
{
|
||||
DefaultMutableTreeNode segmentNode = new DefaultMutableTreeNode (
|
||||
|
@ -28,6 +28,17 @@ class VolumeEntry extends CatalogEntry
|
||||
firstBlock = HexFormatter.intValue (buffer[18], buffer[19]); // 0
|
||||
date = HexFormatter.getPascalDate (buffer, 20); // 2 bytes
|
||||
// bytes 0x16 - 0x19 are unused
|
||||
|
||||
if (false)
|
||||
{
|
||||
System.out.printf ("Total files ..... %d%n", totalFiles);
|
||||
System.out.printf ("Total blocks .... %d%n", totalBlocks);
|
||||
System.out.printf ("Block1 .......... %d%n", block1);
|
||||
System.out.printf ("Last block ...... %d%n", lastDirectoryBlock);
|
||||
System.out.printf ("Record type ..... %d%n", recordType);
|
||||
System.out.printf ("Name length ..... %d%n", nameLength);
|
||||
System.out.printf ("Name ............ %s%n", name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user