mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-03 01:29:32 +00:00
method header lines
This commit is contained in:
parent
5b640cbb1c
commit
6b3c7011d3
|
@ -11,7 +11,9 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
|
|||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
abstract class CatalogEntry implements AppleFileSource
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
protected AbstractFile file;
|
||||
protected final PascalDisk parent;
|
||||
|
@ -23,7 +25,9 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
protected int bytesUsedInLastBlock;
|
||||
protected final List<DiskAddress> blocks = new ArrayList<> ();
|
||||
|
||||
public CatalogEntry (PascalDisk parent, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
CatalogEntry (PascalDisk parent, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.parent = parent;
|
||||
|
||||
|
@ -39,8 +43,10 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
blocks.add (disk.getDiskAddress (i));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public boolean contains (DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (DiskAddress sector : blocks)
|
||||
if (sector.matches (da))
|
||||
|
@ -48,27 +54,35 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public List<DiskAddress> getSectors ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
List<DiskAddress> sectors = new ArrayList<> (blocks);
|
||||
return sectors;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public FormattedDisk getFormattedDisk ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getUniqueName ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int size = lastBlock - firstBlock;
|
||||
String fileTypeText = fileType < 0 || fileType >= parent.fileTypes.length ? "????"
|
||||
|
|
|
@ -2,15 +2,26 @@ package com.bytezone.diskbrowser.pascal;
|
|||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.*;
|
||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||
import com.bytezone.diskbrowser.applefile.AssemblerProgram;
|
||||
import com.bytezone.diskbrowser.applefile.Charset;
|
||||
import com.bytezone.diskbrowser.applefile.DefaultAppleFile;
|
||||
import com.bytezone.diskbrowser.applefile.PascalCode;
|
||||
import com.bytezone.diskbrowser.applefile.PascalInfo;
|
||||
import com.bytezone.diskbrowser.applefile.PascalSegment;
|
||||
import com.bytezone.diskbrowser.applefile.PascalText;
|
||||
import com.bytezone.diskbrowser.utilities.FileFormatException;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class FileEntry extends CatalogEntry
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private DefaultMutableTreeNode node;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public FileEntry (PascalDisk parent, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (parent, buffer);
|
||||
|
||||
|
@ -30,18 +41,24 @@ public class FileEntry extends CatalogEntry
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
void setNode (DefaultMutableTreeNode node)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public void setFile (AbstractFile file)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public AbstractFile getDataSource ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (file != null)
|
||||
return file;
|
||||
|
@ -99,7 +116,9 @@ public class FileEntry extends CatalogEntry
|
|||
return file;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private byte[] getExactBuffer ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
byte[] buffer = parent.getDisk ().readSectors (blocks);
|
||||
byte[] exactBuffer;
|
||||
|
|
|
@ -9,19 +9,25 @@ import com.bytezone.diskbrowser.disk.Disk;
|
|||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class PascalCatalogSector extends AbstractSector
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private final DateFormat df = DateFormat.getDateInstance (DateFormat.SHORT);
|
||||
private static String[] fileTypes =
|
||||
{ "Volume", "Bad", "Code", "Text", "Info", "Data", "Graf", "Foto", "SecureDir" };
|
||||
|
||||
public PascalCatalogSector (Disk disk, byte[] buffer, List<DiskAddress> diskAddress)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
PascalCatalogSector (Disk disk, byte[] buffer, List<DiskAddress> diskAddress)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (disk, buffer);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String createText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = getHeader ("Pascal Catalog Sectors");
|
||||
|
||||
|
|
|
@ -11,13 +11,17 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
|
|||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
import com.bytezone.diskbrowser.gui.DataSource;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class PascalCodeObject implements AppleFileSource
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private final PascalDisk parent;
|
||||
private final AbstractFile segment;
|
||||
private final List<DiskAddress> blocks = new ArrayList<> ();
|
||||
|
||||
public PascalCodeObject (PascalDisk parent, PascalSegment segment, int firstBlock)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
PascalCodeObject (PascalDisk parent, PascalSegment segment, int firstBlock)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.parent = parent;
|
||||
this.segment = segment;
|
||||
|
@ -30,26 +34,34 @@ class PascalCodeObject implements AppleFileSource
|
|||
blocks.add (disk.getDiskAddress (i));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public DataSource getDataSource ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return segment;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public FormattedDisk getFormattedDisk ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public List<DiskAddress> getSectors ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return blocks;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public boolean contains (DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (DiskAddress sector : blocks)
|
||||
if (sector.matches (da))
|
||||
|
@ -57,14 +69,18 @@ class PascalCodeObject implements AppleFileSource
|
|||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getUniqueName ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return segment.getName (); // this should be fileName/segmentName
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return segment.getName ();
|
||||
}
|
||||
|
|
|
@ -10,12 +10,20 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
|||
|
||||
import com.bytezone.diskbrowser.applefile.AppleFileSource;
|
||||
import com.bytezone.diskbrowser.applefile.BootSector;
|
||||
import com.bytezone.diskbrowser.disk.*;
|
||||
import com.bytezone.diskbrowser.disk.AbstractFormattedDisk;
|
||||
import com.bytezone.diskbrowser.disk.AppleDisk;
|
||||
import com.bytezone.diskbrowser.disk.DefaultAppleFileSource;
|
||||
import com.bytezone.diskbrowser.disk.DefaultSector;
|
||||
import com.bytezone.diskbrowser.disk.Disk;
|
||||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.disk.SectorType;
|
||||
import com.bytezone.diskbrowser.gui.DataSource;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.wizardry.Relocator;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public class PascalDisk extends AbstractFormattedDisk
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
static final int CATALOG_ENTRY_SIZE = 26;
|
||||
private final DateFormat df = DateFormat.getDateInstance (DateFormat.SHORT);
|
||||
|
@ -40,7 +48,9 @@ public class PascalDisk extends AbstractFormattedDisk
|
|||
SectorType[] sectors = { catalogSector, badSector, codeSector, textSector, infoSector,
|
||||
dataSector, grafSector, fotoSector };
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public PascalDisk (Disk disk)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (disk);
|
||||
|
||||
|
@ -125,7 +135,9 @@ public class PascalDisk extends AbstractFormattedDisk
|
|||
makeNodeVisible (volumeNode.getFirstLeaf ());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static boolean isCorrectFormat (AppleDisk disk, boolean debug)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
disk.setInterleave (1); // should only ever be Prodos
|
||||
if (checkFormat (disk, debug))
|
||||
|
@ -136,7 +148,9 @@ public class PascalDisk extends AbstractFormattedDisk
|
|||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static boolean checkFormat (AppleDisk disk, boolean debug)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
byte[] buffer = disk.readSector (2);
|
||||
int nameLength = buffer[6] & 0xFF;
|
||||
|
@ -209,8 +223,10 @@ public class PascalDisk extends AbstractFormattedDisk
|
|||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public DataSource getFormattedSector (DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
SectorType st = sectorTypes[da.getBlock ()];
|
||||
if (st == diskBootSector)
|
||||
|
@ -223,8 +239,10 @@ public class PascalDisk extends AbstractFormattedDisk
|
|||
return super.getFormattedSector (da);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getSectorFilename (DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (AppleFileSource ce : fileEntries)
|
||||
if (((CatalogEntry) ce).contains (da))
|
||||
|
@ -232,23 +250,29 @@ public class PascalDisk extends AbstractFormattedDisk
|
|||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public List<DiskAddress> getFileSectors (int fileNo)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (fileNo < 0 || fileNo >= fileEntries.size ())
|
||||
return null;
|
||||
return fileEntries.get (fileNo).getSectors ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public DataSource getFile (int fileNo)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (fileNo < 0 || fileNo >= fileEntries.size ())
|
||||
return null;
|
||||
return fileEntries.get (fileNo).getDataSource ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public AppleFileSource getCatalog ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
String newLine = String.format ("%n");
|
||||
String newLine2 = newLine + newLine;
|
||||
|
|
|
@ -4,12 +4,16 @@ import com.bytezone.diskbrowser.applefile.AbstractFile;
|
|||
import com.bytezone.diskbrowser.applefile.DefaultAppleFile;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class VolumeEntry extends CatalogEntry
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
final int totalFiles;
|
||||
final int totalBlocks;
|
||||
|
||||
public VolumeEntry (PascalDisk parent, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
VolumeEntry (PascalDisk parent, byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (parent, buffer);
|
||||
|
||||
|
@ -18,8 +22,10 @@ class VolumeEntry extends CatalogEntry
|
|||
date = HexFormatter.getPascalDate (buffer, 20); // 2 bytes
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public AbstractFile getDataSource ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (file != null)
|
||||
return file;
|
||||
|
|
|
@ -10,7 +10,9 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
|
|||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
abstract class CatalogEntry implements AppleFileSource
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
ProdosDisk parentDisk;
|
||||
DirectoryHeader parentDirectory;
|
||||
|
@ -23,7 +25,9 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
List<DiskAddress> dataBlocks = new ArrayList<> ();
|
||||
Disk disk;
|
||||
|
||||
public CatalogEntry (ProdosDisk parentDisk, byte[] entryBuffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
CatalogEntry (ProdosDisk parentDisk, byte[] entryBuffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.parentDisk = parentDisk;
|
||||
this.disk = parentDisk.getDisk ();
|
||||
|
@ -35,22 +39,28 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
access = entryBuffer[30] & 0xFF;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String getUniqueName ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (parentDirectory == null)
|
||||
return name;
|
||||
return parentDirectory.getUniqueName () + "/" + name;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public FormattedDisk getFormattedDisk ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return parentDisk;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public boolean contains (DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (DiskAddress sector : dataBlocks)
|
||||
if (sector.matches (da))
|
||||
|
@ -58,8 +68,10 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
|
|
|
@ -2,13 +2,17 @@ package com.bytezone.diskbrowser.prodos;
|
|||
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
abstract class DirectoryHeader extends CatalogEntry
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
final int entryLength;
|
||||
final int entriesPerBlock;
|
||||
final int fileCount;
|
||||
|
||||
public DirectoryHeader (ProdosDisk parentDisk, byte[] entryBuffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
DirectoryHeader (ProdosDisk parentDisk, byte[] entryBuffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (parentDisk, entryBuffer);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||
private FileEntry link;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent,
|
||||
FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent,
|
||||
int parentBlock)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
|
|
|
@ -6,18 +6,24 @@ import com.bytezone.diskbrowser.disk.AbstractSector;
|
|||
import com.bytezone.diskbrowser.disk.Disk;
|
||||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class ProdosBitMapSector extends AbstractSector
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private final ProdosDisk parent;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
ProdosBitMapSector (ProdosDisk parent, Disk disk, byte[] buffer, DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (disk, buffer, da);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String createText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
Dimension grid = parent.getGridLayout ();
|
||||
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
package com.bytezone.diskbrowser.prodos;
|
||||
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.*;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.ENTRY_SIZE;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.FREE;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.GSOS_EXTENDED_FILE;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.PASCAL_ON_PROFILE;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.SAPLING;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.SEEDLING;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.SUBDIRECTORY;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.SUBDIRECTORY_HEADER;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.TREE;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.VOLUME_HEADER;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
|
@ -9,19 +18,25 @@ import com.bytezone.diskbrowser.disk.Disk;
|
|||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class ProdosCatalogSector extends AbstractSector
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private final ProdosDisk parent;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
ProdosCatalogSector (ProdosDisk parent, Disk disk, byte[] buffer,
|
||||
DiskAddress diskAddress)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (disk, buffer, diskAddress);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String createText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = getHeader ("Volume Directory Block");
|
||||
|
||||
|
@ -77,7 +92,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String doFileDescription (int offset)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
int fileType = buffer[offset + 16] & 0xFF;
|
||||
|
@ -102,7 +119,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String doVolumeDirectoryHeader (int offset)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
addText (text, buffer, offset + 16, 4, "Not used");
|
||||
|
@ -112,7 +131,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String doSubdirectoryHeader (int offset)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
addText (text, buffer, offset + 16, 1, "Hex $75");
|
||||
|
@ -124,7 +145,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getCommonHeader (int offset)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
addText (text, buffer, offset + 20, 4, "Not used");
|
||||
|
@ -141,7 +164,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getAuxilliaryText (int fileType, int auxType)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
switch (fileType)
|
||||
{
|
||||
|
@ -165,7 +190,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getType (byte flag)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
switch ((flag & 0xF0) >> 4)
|
||||
{
|
||||
|
@ -193,7 +220,9 @@ class ProdosCatalogSector extends AbstractSector
|
|||
}
|
||||
|
||||
// Deleted files leave the name intact, but set the name length to zero
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getDeletedName (int offset)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
for (int i = offset, max = offset + 15; i < max && buffer[i] != 0; i++)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.bytezone.diskbrowser.prodos;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public interface ProdosConstants
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
static int FILE_TYPE_NON = 0x00;
|
||||
static int FILE_TYPE_PCD = 0x02;
|
||||
|
|
|
@ -23,8 +23,8 @@ class ProdosDirectory extends AbstractFile implements ProdosConstants
|
|||
private final int usedBlocks;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public ProdosDirectory (FormattedDisk parent, String name, byte[] buffer,
|
||||
int totalBlocks, int freeBlocks, int usedBlocks)
|
||||
ProdosDirectory (FormattedDisk parent, String name, byte[] buffer, int totalBlocks,
|
||||
int freeBlocks, int usedBlocks)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (name, buffer);
|
||||
|
|
|
@ -5,15 +5,21 @@ import com.bytezone.diskbrowser.disk.Disk;
|
|||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
|
||||
// see Prodos 8 Tech note #25
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class ProdosExtendedKeySector extends AbstractSector
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
public ProdosExtendedKeySector (Disk disk, byte[] buffer, DiskAddress diskAddress)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
ProdosExtendedKeySector (Disk disk, byte[] buffer, DiskAddress diskAddress)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (disk, buffer, diskAddress);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String createText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = getHeader ("Prodos Extended Key Block");
|
||||
|
||||
|
@ -42,7 +48,9 @@ class ProdosExtendedKeySector extends AbstractSector
|
|||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private String getType (byte flag)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
switch ((flag & 0x0F))
|
||||
{
|
||||
|
|
|
@ -5,18 +5,24 @@ import com.bytezone.diskbrowser.disk.Disk;
|
|||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class ProdosIndexSector extends AbstractSector
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private final String name;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
ProdosIndexSector (String name, Disk disk, byte[] buffer, DiskAddress diskAddress)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (disk, buffer, diskAddress);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String createText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder text = getHeader ("Prodos Index Block : " + name);
|
||||
|
||||
|
|
|
@ -6,13 +6,17 @@ import com.bytezone.diskbrowser.disk.DiskAddress;
|
|||
import com.bytezone.diskbrowser.gui.DataSource;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class SubDirectoryHeader extends DirectoryHeader
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private final int parentPointer;
|
||||
private final int parentSequence;
|
||||
private final int parentSize;
|
||||
|
||||
public SubDirectoryHeader (ProdosDisk parentDisk, byte[] entryBuffer, FileEntry parent)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
SubDirectoryHeader (ProdosDisk parentDisk, byte[] entryBuffer, FileEntry parent)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (parentDisk, entryBuffer);
|
||||
this.parentDirectory = parent.parentDirectory;
|
||||
|
@ -25,21 +29,27 @@ class SubDirectoryHeader extends DirectoryHeader
|
|||
System.out.printf ("", parentPointer, parentSequence, parentSize);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public DataSource getDataSource ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
// should this return a directory listing?
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public List<DiskAddress> getSectors ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
String locked = (access == 0x01) ? "*" : " ";
|
||||
return String.format (" %s%-40s %15s", locked, "/" + name,
|
||||
|
|
|
@ -11,7 +11,9 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
|||
* There is only one of these - it is always the first entry in the first block.
|
||||
* Every other entry will be either a SubDirectoryHeader or a FileEntry.
|
||||
*/
|
||||
// -----------------------------------------------------------------------------------//
|
||||
class VolumeDirectoryHeader extends DirectoryHeader
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
protected final int bitMapBlock;
|
||||
protected int totalBlocks;
|
||||
|
@ -19,7 +21,9 @@ class VolumeDirectoryHeader extends DirectoryHeader
|
|||
protected int usedBlocks;
|
||||
protected int totalBitMapBlocks;
|
||||
|
||||
public VolumeDirectoryHeader (ProdosDisk parentDisk, byte[] entryBuffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
VolumeDirectoryHeader (ProdosDisk parentDisk, byte[] entryBuffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (parentDisk, entryBuffer);
|
||||
|
||||
|
@ -88,8 +92,10 @@ class VolumeDirectoryHeader extends DirectoryHeader
|
|||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public DataSource getDataSource ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
List<byte[]> blockList = new ArrayList<> ();
|
||||
int block = 2;
|
||||
|
@ -111,16 +117,20 @@ class VolumeDirectoryHeader extends DirectoryHeader
|
|||
usedBlocks);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public List<DiskAddress> getSectors ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
List<DiskAddress> sectors = new ArrayList<> ();
|
||||
sectors.addAll (dataBlocks);
|
||||
return sectors;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (false)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user