This commit is contained in:
Denis Molony 2022-02-07 15:28:22 +10:00
parent 761c43dc3d
commit 133352ba31
3 changed files with 46 additions and 20 deletions

View File

@ -15,7 +15,7 @@ public abstract class AbstractFile implements DataSource
{ {
static boolean showDebugText; static boolean showDebugText;
String name; protected String name;
public byte[] buffer; public byte[] buffer;
AssemblerProgram assembler; AssemblerProgram assembler;
protected BufferedImage image; protected BufferedImage image;

View File

@ -1,16 +1,40 @@
package com.bytezone.diskbrowser.applefile; package com.bytezone.diskbrowser.applefile;
import com.bytezone.diskbrowser.utilities.Utility;
// -----------------------------------------------------------------------------------// // -----------------------------------------------------------------------------------//
public class SegmentDictionary public class SegmentDictionary
// -----------------------------------------------------------------------------------// // -----------------------------------------------------------------------------------//
{ {
private final boolean isValid; private final boolean isValid;
private int[] codeAddress = new int[16];
private int[] codeLength = new int[16];
private String[] segName = new String[16];
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public SegmentDictionary (String name, byte[] buffer) public SegmentDictionary (String name, byte[] buffer)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
isValid = !name.equals ("SYSTEM.INTERP"); // temporary isValid = !name.equals ("SYSTEM.INTERP"); // temporary
int ptr = 0;
for (int seg = 0; seg < 16; seg++)
{
codeAddress[seg] = Utility.getShort (buffer, ptr);
ptr += 2;
codeLength[seg] = Utility.getShort (buffer, ptr);
ptr += 2;
}
ptr = 64;
for (int seg = 0; seg < 16; seg++)
{
segName[seg] = new String (buffer, ptr, 8);
ptr += 8;
}
for (int seg = 0; seg < 16; seg++)
System.out.printf ("%04X %04X %s%n", codeAddress[seg], codeLength[seg], segName[seg]);
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//

View File

@ -29,6 +29,7 @@ import com.bytezone.diskbrowser.applefile.MerlinSource;
import com.bytezone.diskbrowser.applefile.ObjectModule; import com.bytezone.diskbrowser.applefile.ObjectModule;
import com.bytezone.diskbrowser.applefile.OriginalHiResImage; import com.bytezone.diskbrowser.applefile.OriginalHiResImage;
import com.bytezone.diskbrowser.applefile.PascalArea; import com.bytezone.diskbrowser.applefile.PascalArea;
import com.bytezone.diskbrowser.applefile.PascalCode;
import com.bytezone.diskbrowser.applefile.ProdosDirectory; import com.bytezone.diskbrowser.applefile.ProdosDirectory;
import com.bytezone.diskbrowser.applefile.QuickDrawFont; import com.bytezone.diskbrowser.applefile.QuickDrawFont;
import com.bytezone.diskbrowser.applefile.SHRPictureFile1; import com.bytezone.diskbrowser.applefile.SHRPictureFile1;
@ -71,8 +72,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
private FileEntry link; private FileEntry link;
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent, FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent, int parentBlock,
int parentBlock, int entryNo) int entryNo)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
super (fDisk, entryBuffer, parentBlock, entryNo); super (fDisk, entryBuffer, parentBlock, entryNo);
@ -348,8 +349,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
file = new DoubleHiResImage (name, outBuffer); file = new DoubleHiResImage (name, outBuffer);
break; break;
case 0x8000: case 0x8000:
file = file = new SHRPictureFile2 (name, outBuffer, FILE_TYPE_PIC, 0x2000, 0x8000);
new SHRPictureFile2 (name, outBuffer, FILE_TYPE_PIC, 0x2000, 0x8000);
break; break;
default: default:
file = new AssemblerProgram (name, exactBuffer, auxType); file = new AssemblerProgram (name, exactBuffer, auxType);
@ -369,8 +369,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
} }
// else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC // else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile); // file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
else if ((name.equals ("DOS.3.3") || name.equals ("DDOS.3.3")) else if ((name.equals ("DOS.3.3") || name.equals ("DDOS.3.3")) && endOfFile == 0x2800
&& endOfFile == 0x2800 && DosMasterFile.isDos33 (parentDisk, exactBuffer)) && DosMasterFile.isDos33 (parentDisk, exactBuffer))
{ {
file = new DosMasterFile (name, exactBuffer); file = new DosMasterFile (name, exactBuffer);
} }
@ -413,8 +413,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
case FILE_TYPE_DIRECTORY: case FILE_TYPE_DIRECTORY:
VolumeDirectoryHeader vdh = parentDisk.getVolumeDirectoryHeader (); VolumeDirectoryHeader vdh = parentDisk.getVolumeDirectoryHeader ();
file = new ProdosDirectory (parentDisk, name, buffer, vdh.totalBlocks, file = new ProdosDirectory (parentDisk, name, buffer, vdh.totalBlocks, vdh.freeBlocks,
vdh.freeBlocks, vdh.usedBlocks); vdh.usedBlocks);
break; break;
case FILE_TYPE_APPLESOFT_BASIC_VARS: case FILE_TYPE_APPLESOFT_BASIC_VARS:
@ -539,6 +539,11 @@ class FileEntry extends CatalogEntry implements ProdosConstants
file = new DefaultAppleFile (name, exactBuffer); file = new DefaultAppleFile (name, exactBuffer);
break; break;
case FILE_TYPE_PCD:
// case FILE_TYPE_PDA:
file = new PascalCode (name, exactBuffer, 0);
break;
case FILE_TYPE_NON: case FILE_TYPE_NON:
if (name.endsWith (".TIFF") && HiResImage.isTiff (exactBuffer)) if (name.endsWith (".TIFF") && HiResImage.isTiff (exactBuffer))
file = new OriginalHiResImage (name, exactBuffer, auxType); file = new OriginalHiResImage (name, exactBuffer, auxType);
@ -618,8 +623,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
if (addresses.size () > 0) if (addresses.size () > 0)
{ {
byte[] tempBuffer = disk.readBlocks (addresses); byte[] tempBuffer = disk.readBlocks (addresses);
buffers.add ( buffers.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
addresses.clear (); addresses.clear ();
} }
logicalBlock += 256; logicalBlock += 256;
@ -719,8 +723,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
private int readIndexBlock (int indexBlock, List<DiskAddress> addresses, private int readIndexBlock (int indexBlock, List<DiskAddress> addresses, List<TextBuffer> buffers,
List<TextBuffer> buffers, int logicalBlock) int logicalBlock)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
byte[] indexBuffer = disk.readBlock (indexBlock); byte[] indexBuffer = disk.readBlock (indexBlock);
@ -732,8 +736,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
else if (addresses.size () > 0) else if (addresses.size () > 0)
{ {
byte[] tempBuffer = disk.readBlocks (addresses); byte[] tempBuffer = disk.readBlocks (addresses);
buffers buffers.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
addresses.clear (); addresses.clear ();
} }
logicalBlock++; logicalBlock++;
@ -804,14 +807,13 @@ class FileEntry extends CatalogEntry implements ProdosConstants
String locked = (access == 0x00) ? "*" : " "; String locked = (access == 0x00) ? "*" : " ";
if (true) if (true)
return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType], return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType], blocksUsed, locked)
blocksUsed, locked) + name; + name;
String timeC = created == null ? "" : created.format (ProdosDisk.df); String timeC = created == null ? "" : created.format (ProdosDisk.df);
String timeF = modified == null ? "" : modified.format (ProdosDisk.df); String timeF = modified == null ? "" : modified.format (ProdosDisk.df);
return String.format ("%s %s%-30s %3d %,10d %15s %15s", return String.format ("%s %s%-30s %3d %,10d %15s %15s", ProdosConstants.fileTypes[fileType],
ProdosConstants.fileTypes[fileType], locked, parentDirectory.name + "/" + name, locked, parentDirectory.name + "/" + name, blocksUsed, endOfFile, timeC, timeF);
blocksUsed, endOfFile, timeC, timeF);
} }
} }