method header lines

This commit is contained in:
Denis Molony 2020-02-08 18:13:28 +10:00
parent 4788f4bca4
commit 04557bab39
19 changed files with 3041 additions and 2650 deletions

View File

@ -4,17 +4,23 @@ import com.bytezone.diskbrowser.disk.AbstractSector;
import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
public class CPMCatalogSector extends AbstractSector
// -----------------------------------------------------------------------------------//
class CPMCatalogSector extends AbstractSector
// -----------------------------------------------------------------------------------//
{
private static int CATALOG_ENTRY_SIZE = 32;
public CPMCatalogSector (Disk disk, byte[] buffer, DiskAddress diskAddress)
// ---------------------------------------------------------------------------------//
CPMCatalogSector (Disk disk, byte[] buffer, DiskAddress diskAddress)
// ---------------------------------------------------------------------------------//
{
super (disk, buffer, diskAddress);
}
// ---------------------------------------------------------------------------------//
@Override
public String createText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = getHeader ("Catalog Sector");

View File

@ -6,10 +6,17 @@ import java.util.List;
import javax.swing.tree.DefaultMutableTreeNode;
import com.bytezone.diskbrowser.applefile.AppleFileSource;
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.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.disk.SectorType;
import com.bytezone.diskbrowser.gui.DataSource;
// -----------------------------------------------------------------------------------//
public class CPMDisk extends AbstractFormattedDisk
// -----------------------------------------------------------------------------------//
{
private final Color green = new Color (0, 200, 0);
@ -27,7 +34,9 @@ public class CPMDisk extends AbstractFormattedDisk
// // http://www.seasip.info/Cpm/format31.html
private final DefaultMutableTreeNode volumeNode;
// ---------------------------------------------------------------------------------//
public CPMDisk (Disk disk)
// ---------------------------------------------------------------------------------//
{
super (disk);
@ -109,7 +118,9 @@ public class CPMDisk extends AbstractFormattedDisk
makeNodeVisible (volumeNode.getFirstLeaf ());
}
// ---------------------------------------------------------------------------------//
private SectorType getSectorType (String type)
// ---------------------------------------------------------------------------------//
{
if ("COM".equals (type))
return comSector;
@ -129,15 +140,19 @@ public class CPMDisk extends AbstractFormattedDisk
return otherSector;
}
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getFileSectors (int fileNo)
// ---------------------------------------------------------------------------------//
{
if (fileEntries.size () > 0 && fileEntries.size () > fileNo)
return fileEntries.get (fileNo).getSectors ();
return null;
}
// ---------------------------------------------------------------------------------//
private DirectoryEntry findParent (DirectoryEntry child)
// ---------------------------------------------------------------------------------//
{
for (AppleFileSource entry : fileEntries)
if (((DirectoryEntry) entry).matches (child))
@ -146,8 +161,10 @@ public class CPMDisk extends AbstractFormattedDisk
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public DataSource getFormattedSector (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
SectorType type = sectorTypes[da.getBlock ()];
byte[] buffer = disk.readSector (da);
@ -158,8 +175,10 @@ public class CPMDisk extends AbstractFormattedDisk
return super.getFormattedSector (da);
}
// ---------------------------------------------------------------------------------//
@Override
public AppleFileSource getCatalog ()
// ---------------------------------------------------------------------------------//
{
String newLine = String.format ("%n");
String line =
@ -182,7 +201,9 @@ public class CPMDisk extends AbstractFormattedDisk
return new DefaultAppleFileSource ("CPM Disk ", text.toString (), this);
}
// ---------------------------------------------------------------------------------//
public static boolean isCorrectFormat (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
disk.setInterleave (3);
@ -227,7 +248,9 @@ public class CPMDisk extends AbstractFormattedDisk
return true;
}
// ---------------------------------------------------------------------------------//
private static boolean bufferContainsAll (byte[] buffer, byte value)
// ---------------------------------------------------------------------------------//
{
for (byte b : buffer)
if (b != value)
@ -235,8 +258,10 @@ public class CPMDisk extends AbstractFormattedDisk
return true;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuffer text = new StringBuffer ("CPM disk");
return text.toString ();

View File

@ -14,7 +14,9 @@ import com.bytezone.diskbrowser.gui.DataSource;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// File Control Block (FCB)
public class DirectoryEntry implements AppleFileSource
// -----------------------------------------------------------------------------------//
class DirectoryEntry implements AppleFileSource
// -----------------------------------------------------------------------------------//
{
private final Disk disk;
private final CPMDisk parent;
@ -34,7 +36,9 @@ public class DirectoryEntry implements AppleFileSource
private final boolean readOnly;
private final boolean systemFile;
public DirectoryEntry (CPMDisk parent, byte[] buffer, int offset)
// ---------------------------------------------------------------------------------//
DirectoryEntry (CPMDisk parent, byte[] buffer, int offset)
// ---------------------------------------------------------------------------------//
{
this.parent = parent;
disk = parent.getDisk ();
@ -75,18 +79,24 @@ public class DirectoryEntry implements AppleFileSource
}
}
public String getType ()
// ---------------------------------------------------------------------------------//
String getType ()
// ---------------------------------------------------------------------------------//
{
return type;
}
public boolean matches (DirectoryEntry directoryEntry)
// ---------------------------------------------------------------------------------//
boolean matches (DirectoryEntry directoryEntry)
// ---------------------------------------------------------------------------------//
{
return userNumber == directoryEntry.userNumber && name.equals (directoryEntry.name)
&& type.equals (directoryEntry.type);
}
public void add (DirectoryEntry entry)
// ---------------------------------------------------------------------------------//
void add (DirectoryEntry entry)
// ---------------------------------------------------------------------------------//
{
entries.add (entry);
@ -102,8 +112,10 @@ public class DirectoryEntry implements AppleFileSource
}
}
// ---------------------------------------------------------------------------------//
@Override
public boolean contains (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
for (DiskAddress sector : blocks)
if (sector.matches (da))
@ -111,7 +123,9 @@ public class DirectoryEntry implements AppleFileSource
return false;
}
public String line ()
// ---------------------------------------------------------------------------------//
String line ()
// ---------------------------------------------------------------------------------//
{
String bytes = HexFormatter.getHexString (blockList, 0, 16);
bytes = bytes.replaceAll ("00", " ");
@ -131,7 +145,9 @@ public class DirectoryEntry implements AppleFileSource
return text;
}
public String toDetailedString ()
// ---------------------------------------------------------------------------------//
String toDetailedString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -156,14 +172,18 @@ public class DirectoryEntry implements AppleFileSource
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getUniqueName ()
// ---------------------------------------------------------------------------------//
{
return name + "." + type;
}
// ---------------------------------------------------------------------------------//
@Override
public DataSource getDataSource ()
// ---------------------------------------------------------------------------------//
{
if (appleFile != null)
return appleFile;
@ -208,20 +228,26 @@ public class DirectoryEntry implements AppleFileSource
return appleFile;
}
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getSectors ()
// ---------------------------------------------------------------------------------//
{
return blocks;
}
// ---------------------------------------------------------------------------------//
@Override
public FormattedDisk getFormattedDisk ()
// ---------------------------------------------------------------------------------//
{
return parent;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return name + "." + type;
}

View File

@ -22,7 +22,9 @@ import com.bytezone.diskbrowser.applefile.AppleFileSource;
import com.bytezone.diskbrowser.applefile.BootSector;
import com.bytezone.diskbrowser.gui.DataSource;
// -----------------------------------------------------------------------------------//
public abstract class AbstractFormattedDisk implements FormattedDisk
// -----------------------------------------------------------------------------------//
{
protected Disk disk;
protected FormattedDisk parent; // used by Dual-dos disks
@ -49,7 +51,9 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
protected BitSet freeBlocks;
protected BitSet usedBlocks; // still to be populated - currently using stillAvailable ()
// ---------------------------------------------------------------------------------//
public AbstractFormattedDisk (Disk disk)
// ---------------------------------------------------------------------------------//
{
this.disk = disk;
freeBlocks = new BitSet (disk.getTotalBlocks ());
@ -94,13 +98,17 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
});
}
// ---------------------------------------------------------------------------------//
protected void setEmptyByte (byte value)
// ---------------------------------------------------------------------------------//
{
getDisk ().setEmptyByte (value);
setSectorTypes ();
}
// ---------------------------------------------------------------------------------//
private void setSectorTypes ()
// ---------------------------------------------------------------------------------//
{
sectorTypes = new SectorType[disk.getTotalBlocks ()];
@ -110,7 +118,9 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
setGridLayout ();
}
// ---------------------------------------------------------------------------------//
private void setGridLayout ()
// ---------------------------------------------------------------------------------//
{
int totalBlocks = disk.getTotalBlocks ();
@ -156,32 +166,42 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
}
}
// ---------------------------------------------------------------------------------//
@Override
public Dimension getGridLayout ()
// ---------------------------------------------------------------------------------//
{
return gridLayout;
}
// ---------------------------------------------------------------------------------//
@Override
public Disk getDisk ()
// ---------------------------------------------------------------------------------//
{
return disk;
}
// ---------------------------------------------------------------------------------//
@Override
public FormattedDisk getParent ()
// ---------------------------------------------------------------------------------//
{
return parent;
}
// ---------------------------------------------------------------------------------//
@Override
public void setParent (FormattedDisk disk)
// ---------------------------------------------------------------------------------//
{
parent = disk;
}
// ---------------------------------------------------------------------------------//
@Override
public void setOriginalPath (Path path)
// ---------------------------------------------------------------------------------//
{
this.originalPath = path;
@ -191,14 +211,18 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
new DefaultAppleFileSource (getName (), disk.toString (), this));
}
// ---------------------------------------------------------------------------------//
@Override
public Path getOriginalPath ()
// ---------------------------------------------------------------------------------//
{
return originalPath;
}
// ---------------------------------------------------------------------------------//
@Override
public String getAbsolutePath ()
// ---------------------------------------------------------------------------------//
{
if (originalPath != null)
return originalPath.toString ();
@ -206,8 +230,10 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return disk.getFile ().getAbsolutePath ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getDisplayPath ()
// ---------------------------------------------------------------------------------//
{
if (originalPath != null)
return originalPath.toString ();
@ -220,14 +246,18 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return disk.getFile ().getAbsolutePath ();
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isTempDisk ()
// ---------------------------------------------------------------------------------//
{
return originalPath != null;
}
// ---------------------------------------------------------------------------------//
@Override
public String getName ()
// ---------------------------------------------------------------------------------//
{
if (originalPath != null)
{
@ -238,20 +268,26 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return disk.getFile ().getName ();
}
// ---------------------------------------------------------------------------------//
@Override
public void writeFile (AbstractFile file)
// ---------------------------------------------------------------------------------//
{
System.out.println ("not implemented yet");
}
// ---------------------------------------------------------------------------------//
@Override
public List<AppleFileSource> getCatalogList ()
// ---------------------------------------------------------------------------------//
{
return fileEntries;
}
// ---------------------------------------------------------------------------------//
@Override
public AppleFileSource getFile (String uniqueName)
// ---------------------------------------------------------------------------------//
{
for (AppleFileSource afs : fileEntries)
if (afs.getUniqueName ().equals (uniqueName))
@ -259,24 +295,32 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public JTree getCatalogTree ()
// ---------------------------------------------------------------------------------//
{
return catalogTree;
}
// ---------------------------------------------------------------------------------//
public DefaultMutableTreeNode getCatalogTreeRoot ()
// ---------------------------------------------------------------------------------//
{
return (DefaultMutableTreeNode) catalogTree.getModel ().getRoot ();
}
// ---------------------------------------------------------------------------------//
public void makeNodeVisible (DefaultMutableTreeNode node)
// ---------------------------------------------------------------------------------//
{
catalogTree.makeVisible (
new TreePath (((DefaultTreeModel) catalogTree.getModel ()).getPathToRoot (node)));
}
// ---------------------------------------------------------------------------------//
protected DefaultMutableTreeNode findNode (DefaultMutableTreeNode node, String name)
// ---------------------------------------------------------------------------------//
{
Enumeration<TreeNode> children = node.breadthFirstEnumeration ();
if (children != null)
@ -292,36 +336,47 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return null;
}
// ---------------------------------------------------------------------------------//
/*
* These routines just hand back the information that was created above, and
* added to by the subclass.
*/
@Override
public SectorType getSectorType (int block)
// ---------------------------------------------------------------------------------//
{
return getSectorType (disk.getDiskAddress (block));
}
// ---------------------------------------------------------------------------------//
@Override
public SectorType getSectorType (int track, int sector)
// ---------------------------------------------------------------------------------//
{
return getSectorType (disk.getDiskAddress (track, sector));
}
// ---------------------------------------------------------------------------------//
@Override
public SectorType getSectorType (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
return sectorTypes[da.getBlock ()];
}
// ---------------------------------------------------------------------------------//
@Override
public List<SectorType> getSectorTypeList ()
// ---------------------------------------------------------------------------------//
{
return sectorTypesList;
}
// ---------------------------------------------------------------------------------//
@Override
public void setSectorType (int block, SectorType type)
// ---------------------------------------------------------------------------------//
{
if (block < sectorTypes.length)
sectorTypes[block] = type;
@ -330,8 +385,10 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
}
// Override this so that the correct sector type can be displayed
// ---------------------------------------------------------------------------------//
@Override
public DataSource getFormattedSector (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
if (da.getBlock () == 0 && bootSector != null)
return bootSector;
@ -354,14 +411,18 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
/*
* Override this with something useful
*/
// ---------------------------------------------------------------------------------//
@Override
public AppleFileSource getCatalog ()
// ---------------------------------------------------------------------------------//
{
return new DefaultAppleFileSource (disk.toString (), this);
}
// ---------------------------------------------------------------------------------//
@Override
public String getSectorFilename (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
for (AppleFileSource entry : fileEntries)
if (entry.contains (da))
@ -370,28 +431,36 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
return "";
}
// ---------------------------------------------------------------------------------//
@Override
public int clearOrphans ()
// ---------------------------------------------------------------------------------//
{
System.out.println ("Not implemented yet");
return 0;
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isSectorFree (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
return freeBlocks.get (da.getBlock ());
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isSectorFree (int blockNo)
// ---------------------------------------------------------------------------------//
{
return freeBlocks.get (blockNo);
}
// representation of the Free Sector Table
// ---------------------------------------------------------------------------------//
@Override
public void setSectorFree (int block, boolean free)
// ---------------------------------------------------------------------------------//
{
if (block < 0 || block >= freeBlocks.size ())
{
@ -404,20 +473,26 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
}
// Check that the sector hasn't already been flagged as part of the disk structure
// ---------------------------------------------------------------------------------//
@Override
public boolean stillAvailable (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
return stillAvailable (da.getBlock ());
}
// ---------------------------------------------------------------------------------//
@Override
public boolean stillAvailable (int blockNo)
// ---------------------------------------------------------------------------------//
{
return sectorTypes[blockNo] == usedSector || sectorTypes[blockNo] == emptySector;
}
// ---------------------------------------------------------------------------------//
@Override
public void verify ()
// ---------------------------------------------------------------------------------//
{
System.out.println ("Sectors to clean :");
for (int i = 0, max = disk.getTotalBlocks (); i < max; i++)
@ -436,30 +511,40 @@ public abstract class AbstractFormattedDisk implements FormattedDisk
}
// VTOC flags sector as free, but it is in use by a file
// ---------------------------------------------------------------------------------//
@Override
public int falsePositiveBlocks ()
// ---------------------------------------------------------------------------------//
{
return falsePositives;
}
// VTOC flags sector as in use, but no file is using it (and not in the DOS tracks)
// ---------------------------------------------------------------------------------//
@Override
public int falseNegativeBlocks ()
// ---------------------------------------------------------------------------------//
{
return falseNegatives;
}
// ---------------------------------------------------------------------------------//
public void addActionListener (ActionListener actionListener)
// ---------------------------------------------------------------------------------//
{
actionListenerList = AWTEventMulticaster.add (actionListenerList, actionListener);
}
// ---------------------------------------------------------------------------------//
public void removeActionListener (ActionListener actionListener)
// ---------------------------------------------------------------------------------//
{
actionListenerList = AWTEventMulticaster.remove (actionListenerList, actionListener);
}
// ---------------------------------------------------------------------------------//
public void notifyListeners (String text)
// ---------------------------------------------------------------------------------//
{
if (actionListenerList != null)
actionListenerList

View File

@ -9,7 +9,9 @@ import com.bytezone.diskbrowser.applefile.AssemblerProgram;
import com.bytezone.diskbrowser.gui.DataSource;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public abstract class AbstractSector implements DataSource
// -----------------------------------------------------------------------------------//
{
private static String newLine = String.format ("%n");
private static String newLine2 = newLine + newLine;
@ -17,55 +19,69 @@ public abstract class AbstractSector implements DataSource
final public byte[] buffer;
protected Disk disk;
protected DiskAddress diskAddress;
// private List<DiskAddress> diskAddressList;
AssemblerProgram assembler;
String description;
// ---------------------------------------------------------------------------------//
public AbstractSector (Disk disk, byte[] buffer, DiskAddress diskAddress)
// ---------------------------------------------------------------------------------//
{
this.buffer = buffer;
this.disk = disk;
this.diskAddress = diskAddress;
}
public AbstractSector (Disk disk, byte[] buffer)//, List<DiskAddress> diskAddressList)
// ---------------------------------------------------------------------------------//
public AbstractSector (Disk disk, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
this.buffer = buffer;
this.disk = disk;
// this.diskAddressList = diskAddressList;
}
// ---------------------------------------------------------------------------------//
@Override
public String getAssembler ()
// ---------------------------------------------------------------------------------//
{
if (assembler == null)
assembler = new AssemblerProgram ("noname", buffer, 0);
return assembler.getText ();
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
return HexFormatter.format (buffer, 0, buffer.length);
}
// ---------------------------------------------------------------------------------//
@Override
public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
if (description == null)
description = createText ();
return description;
}
// ---------------------------------------------------------------------------------//
public abstract String createText ();
// ---------------------------------------------------------------------------------//
// ---------------------------------------------------------------------------------//
protected StringBuilder getHeader (String title)
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -76,15 +92,19 @@ public abstract class AbstractSector implements DataSource
return text;
}
// ---------------------------------------------------------------------------------//
@Override
public JComponent getComponent ()
// ---------------------------------------------------------------------------------//
{
JPanel panel = new JPanel ();
return panel;
}
// ---------------------------------------------------------------------------------//
protected void addText (StringBuilder text, byte[] buffer, int offset, int size,
String desc)
// ---------------------------------------------------------------------------------//
{
if ((offset + size - 1) > buffer.length)
return;
@ -113,8 +133,10 @@ public abstract class AbstractSector implements DataSource
}
}
// ---------------------------------------------------------------------------------//
protected void addTextAndDecimal (StringBuilder text, byte[] b, int offset, int size,
String desc)
// ---------------------------------------------------------------------------------//
{
if (size == 1)
desc += " (" + (b[offset] & 0xFF) + ")";
@ -124,6 +146,7 @@ public abstract class AbstractSector implements DataSource
else if (size == 3)
desc += String.format (" (%,d)", ((b[offset + 2] & 0xFF) * 65536)
+ ((b[offset + 1] & 0xFF) * 256) + (b[offset] & 0xFF));
addText (text, b, offset, size, desc);
}
}

View File

@ -21,7 +21,9 @@ import com.bytezone.diskbrowser.nib.WozFile;
import com.bytezone.diskbrowser.utilities.FileFormatException;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class AppleDisk implements Disk
// -----------------------------------------------------------------------------------//
{
private static final int MAX_INTERLEAVE = 3;
private static final int SECTOR_SIZE = 256;
@ -86,13 +88,17 @@ public class AppleDisk implements Disk
private final boolean debug = false;
// ---------------------------------------------------------------------------------//
public AppleDisk (File file, int tracks, int sectors) throws FileFormatException
// ---------------------------------------------------------------------------------//
{
this (file, tracks, sectors, 0);
}
// ---------------------------------------------------------------------------------//
public AppleDisk (File file, int tracks, int sectors, int skip)
throws FileFormatException
// ---------------------------------------------------------------------------------//
{
assert (file.exists ()) : "No such path :" + file.getAbsolutePath ();
assert (!file.isDirectory ()) : "File is directory :" + file.getAbsolutePath ();
@ -233,7 +239,9 @@ public class AppleDisk implements Disk
checkSectorsForData ();
}
// ---------------------------------------------------------------------------------//
public AppleDisk (V2dFile disk, int tracks, int sectors)
// ---------------------------------------------------------------------------------//
{
this.tracks = tracks;
this.sectors = sectors;
@ -248,7 +256,9 @@ public class AppleDisk implements Disk
checkSectorsForData ();
}
// ---------------------------------------------------------------------------------//
public AppleDisk (NibFile disk) // not used yet
// ---------------------------------------------------------------------------------//
{
tracks = 35;
trackSize = 4096;
@ -256,7 +266,9 @@ public class AppleDisk implements Disk
diskBuffer = disk.getDiskBuffer ();
}
// ---------------------------------------------------------------------------------//
public AppleDisk (WozFile wozFile, int tracks, int sectors)
// ---------------------------------------------------------------------------------//
{
this.wozFile = wozFile;
this.tracks = tracks;
@ -281,7 +293,9 @@ public class AppleDisk implements Disk
checkSectorsForData ();
}
// ---------------------------------------------------------------------------------//
private byte[] getPrefix (File path)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = new byte[64];
try
@ -299,7 +313,9 @@ public class AppleDisk implements Disk
return buffer;
}
// ---------------------------------------------------------------------------------//
private void checkSectorsForData ()
// ---------------------------------------------------------------------------------//
{
if (true)
{
@ -322,7 +338,9 @@ public class AppleDisk implements Disk
}
}
// ---------------------------------------------------------------------------------//
private void checkSectorsFaster ()
// ---------------------------------------------------------------------------------//
{
// force blockList to be rebuilt with the correct number/size of blocks
blockList = null;
@ -343,7 +361,9 @@ public class AppleDisk implements Disk
}
}
// ---------------------------------------------------------------------------------//
private boolean check (int diskOffset)
// ---------------------------------------------------------------------------------//
{
for (int i = diskOffset, max = diskOffset + SECTOR_SIZE; i < max; i++)
if (diskBuffer[i] != emptyByte)
@ -355,50 +375,66 @@ public class AppleDisk implements Disk
* Routines that implement the Disk interface
*/
// ---------------------------------------------------------------------------------//
@Override
public int getSectorsPerTrack ()
// ---------------------------------------------------------------------------------//
{
return trackSize / sectorSize;
}
// ---------------------------------------------------------------------------------//
@Override
public int getTrackSize ()
// ---------------------------------------------------------------------------------//
{
return trackSize;
}
// ---------------------------------------------------------------------------------//
@Override
public int getBlockSize ()
// ---------------------------------------------------------------------------------//
{
return sectorSize;
}
// ---------------------------------------------------------------------------------//
@Override
public int getTotalBlocks ()
// ---------------------------------------------------------------------------------//
{
return blocks;
}
// ---------------------------------------------------------------------------------//
@Override
public int getTotalTracks ()
// ---------------------------------------------------------------------------------//
{
return tracks;
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isSectorEmpty (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
return !hasData[da.getBlock ()];
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isSectorEmpty (int block)
// ---------------------------------------------------------------------------------//
{
return !hasData[block];
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isSectorEmpty (int track, int sector)
// ---------------------------------------------------------------------------------//
{
return !hasData[getDiskAddress (track, sector).getBlock ()];
}
@ -421,14 +457,18 @@ public class AppleDisk implements Disk
// return isMissing[getDiskAddress (track, sector).getBlock ()];
// }
// ---------------------------------------------------------------------------------//
@Override
public File getFile ()
// ---------------------------------------------------------------------------------//
{
return file;
}
// ---------------------------------------------------------------------------------//
@Override
public byte[] readSector (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = new byte[sectorSize];
if (da == null)
@ -438,8 +478,10 @@ public class AppleDisk implements Disk
return buffer;
}
// ---------------------------------------------------------------------------------//
@Override
public byte[] readSectors (List<DiskAddress> daList)
// ---------------------------------------------------------------------------------//
{
byte[] buffer = new byte[daList.size () * sectorSize];
int ptr = 0;
@ -453,26 +495,34 @@ public class AppleDisk implements Disk
return buffer;
}
// ---------------------------------------------------------------------------------//
@Override
public byte[] readSector (int track, int sector)
// ---------------------------------------------------------------------------------//
{
return readSector (getDiskAddress (track, sector));
}
// ---------------------------------------------------------------------------------//
@Override
public byte[] readSector (int block)
// ---------------------------------------------------------------------------------//
{
return readSector (getDiskAddress (block));
}
// ---------------------------------------------------------------------------------//
@Override
public void writeSector (DiskAddress da, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
writeBuffer (da, buffer);
}
// ---------------------------------------------------------------------------------//
@Override
public void setInterleave (int interleave)
// ---------------------------------------------------------------------------------//
{
assert (interleave >= 0 && interleave <= MAX_INTERLEAVE) : "Invalid interleave";
this.interleave = interleave;
@ -481,14 +531,18 @@ public class AppleDisk implements Disk
notifyListeners ("Interleave changed");
}
// ---------------------------------------------------------------------------------//
@Override
public int getInterleave ()
// ---------------------------------------------------------------------------------//
{
return interleave;
}
// ---------------------------------------------------------------------------------//
@Override
public void setBlockSize (int size)
// ---------------------------------------------------------------------------------//
{
assert (size == SECTOR_SIZE || size == BLOCK_SIZE) : "Invalid sector size : " + size;
if (sectorSize == size)
@ -505,8 +559,10 @@ public class AppleDisk implements Disk
notifyListeners ("Sector size changed");
}
// ---------------------------------------------------------------------------------//
@Override
public DiskAddress getDiskAddress (int track, int sector)
// ---------------------------------------------------------------------------------//
{
if (!isValidAddress (track, sector))
{
@ -517,8 +573,10 @@ public class AppleDisk implements Disk
return new AppleDiskAddress (this, track, sector);
}
// ---------------------------------------------------------------------------------//
@Override
public DiskAddress getDiskAddress (int block)
// ---------------------------------------------------------------------------------//
{
if (!isValidAddress (block))
{
@ -530,8 +588,10 @@ public class AppleDisk implements Disk
return new AppleDiskAddress (this, block);
}
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getDiskAddressList (int... blocks)
// ---------------------------------------------------------------------------------//
{
List<DiskAddress> addressList = new ArrayList<> ();
@ -543,14 +603,18 @@ public class AppleDisk implements Disk
return addressList;
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isValidAddress (int block)
// ---------------------------------------------------------------------------------//
{
return block >= 0 && block < this.blocks;
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isValidAddress (int track, int sector)
// ---------------------------------------------------------------------------------//
{
track &= 0x3F;
sector &= 0x1F;
@ -563,8 +627,10 @@ public class AppleDisk implements Disk
return true;
}
// ---------------------------------------------------------------------------------//
@Override
public boolean isValidAddress (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
return da != null && isValidAddress (da.getTrack (), da.getSector ());
}
@ -573,7 +639,9 @@ public class AppleDisk implements Disk
* This is the only method that transfers data from the disk buffer to an output buffer.
* It handles sectors of 256 or 512 bytes, and both linear and interleaved sectors.
*/
// ---------------------------------------------------------------------------------//
private void readBuffer (DiskAddress da, byte[] buffer, int bufferOffset)
// ---------------------------------------------------------------------------------//
{
assert da.getDisk () == this : "Disk address not applicable to this disk";
assert sectorSize == SECTOR_SIZE
@ -597,7 +665,9 @@ public class AppleDisk implements Disk
}
}
// ---------------------------------------------------------------------------------//
private void writeBuffer (DiskAddress da, byte[] buffer)
// ---------------------------------------------------------------------------------//
{
assert da.getDisk () == this : "Disk address not applicable to this disk";
assert sectorSize == SECTOR_SIZE
@ -620,7 +690,9 @@ public class AppleDisk implements Disk
}
}
// ---------------------------------------------------------------------------------//
private int getBufferOffset (DiskAddress da)
// ---------------------------------------------------------------------------------//
{
assert sectorSize == SECTOR_SIZE;
@ -628,7 +700,9 @@ public class AppleDisk implements Disk
+ interleaveSector[interleave][da.getSector ()] * SECTOR_SIZE;
}
// ---------------------------------------------------------------------------------//
private int getBufferOffset (DiskAddress da, int seq)
// ---------------------------------------------------------------------------------//
{
assert sectorSize == BLOCK_SIZE;
@ -638,32 +712,42 @@ public class AppleDisk implements Disk
+ interleaveSector[interleave][da.getSector () * 2 + seq] * SECTOR_SIZE;
}
// ---------------------------------------------------------------------------------//
@Override
public void addActionListener (ActionListener actionListener)
// ---------------------------------------------------------------------------------//
{
actionListenerList = AWTEventMulticaster.add (actionListenerList, actionListener);
}
// ---------------------------------------------------------------------------------//
@Override
public void removeActionListener (ActionListener actionListener)
// ---------------------------------------------------------------------------------//
{
actionListenerList = AWTEventMulticaster.remove (actionListenerList, actionListener);
}
// ---------------------------------------------------------------------------------//
public void notifyListeners (String text)
// ---------------------------------------------------------------------------------//
{
if (actionListenerList != null)
actionListenerList
.actionPerformed (new ActionEvent (this, ActionEvent.ACTION_PERFORMED, text));
}
// ---------------------------------------------------------------------------------//
public AppleFileSource getDetails ()
// ---------------------------------------------------------------------------------//
{
return new DefaultAppleFileSource (toString (), file.getName (), null);
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
@ -691,8 +775,10 @@ public class AppleDisk implements Disk
return text.toString ();
}
// ---------------------------------------------------------------------------------//
@Override
public Iterator<DiskAddress> iterator ()
// ---------------------------------------------------------------------------------//
{
if (blockList == null)
{
@ -704,8 +790,10 @@ public class AppleDisk implements Disk
return blockList.iterator ();
}
// ---------------------------------------------------------------------------------//
@Override
public long getBootChecksum ()
// ---------------------------------------------------------------------------------//
{
byte[] buffer = readSector (0, 0);
Checksum checksum = new CRC32 ();
@ -713,8 +801,10 @@ public class AppleDisk implements Disk
return checksum.getValue ();
}
// ---------------------------------------------------------------------------------//
@Override
public void setEmptyByte (byte value)
// ---------------------------------------------------------------------------------//
{
emptyByte = value;
checkSectorsForData ();

View File

@ -1,6 +1,8 @@
package com.bytezone.diskbrowser.disk;
// -----------------------------------------------------------------------------------//
public class AppleDiskAddress implements DiskAddress
// -----------------------------------------------------------------------------------//
{
private final int block;
private final int track;
@ -9,7 +11,9 @@ public class AppleDiskAddress implements DiskAddress
private boolean zeroFlag;
// ---------------------------------------------------------------------------------//
public AppleDiskAddress (Disk owner, int block)
// ---------------------------------------------------------------------------------//
{
this.owner = owner;
this.block = block;
@ -26,7 +30,9 @@ public class AppleDiskAddress implements DiskAddress
}
}
// ---------------------------------------------------------------------------------//
public AppleDiskAddress (Disk owner, int track, int sector)
// ---------------------------------------------------------------------------------//
{
this.owner = owner;
zeroFlag = (track & 0x40) != 0;
@ -35,51 +41,67 @@ public class AppleDiskAddress implements DiskAddress
this.block = this.track * owner.getSectorsPerTrack () + this.sector;
}
// ---------------------------------------------------------------------------------//
public boolean zeroFlag ()
// ---------------------------------------------------------------------------------//
{
return zeroFlag;
}
// ---------------------------------------------------------------------------------//
@Override
public int compareTo (DiskAddress that)
// ---------------------------------------------------------------------------------//
{
return this.block - that.getBlock ();
}
// ---------------------------------------------------------------------------------//
@Override
public boolean matches (DiskAddress that)
// ---------------------------------------------------------------------------------//
{
if (that == null)
return false;
return this.block == that.getBlock ();
}
// ---------------------------------------------------------------------------------//
@Override
public int getBlock ()
// ---------------------------------------------------------------------------------//
{
return block;
}
// ---------------------------------------------------------------------------------//
@Override
public int getSector ()
// ---------------------------------------------------------------------------------//
{
return sector;
}
// ---------------------------------------------------------------------------------//
@Override
public int getTrack ()
// ---------------------------------------------------------------------------------//
{
return track;
}
// ---------------------------------------------------------------------------------//
@Override
public Disk getDisk ()
// ---------------------------------------------------------------------------------//
{
return owner;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return String.format ("[Block=%3d, Track=%2d, Sector=%2d, Zero=%s]", block, track,
sector, zeroFlag);

View File

@ -5,14 +5,18 @@ import java.util.List;
import com.bytezone.diskbrowser.gui.DataSource;
// -----------------------------------------------------------------------------------//
public class DataDisk extends AbstractFormattedDisk
// -----------------------------------------------------------------------------------//
{
// static final byte[] dos = { 0x01, (byte) 0xA5, 0x27, (byte) 0xC9, 0x09 };
// this should somehow tie in with the checksum from DiskFactory to determine
// whether it has a bootloader
// ---------------------------------------------------------------------------------//
public DataDisk (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
super (disk);
@ -33,20 +37,26 @@ public class DataDisk extends AbstractFormattedDisk
}
// no files on data disks
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getFileSectors (int fileNo)
// ---------------------------------------------------------------------------------//
{
return new ArrayList<> ();
}
// no files on data disks
// ---------------------------------------------------------------------------------//
public DataSource getFile (int fileNo)
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return disk.toString ();
}

View File

@ -10,32 +10,42 @@ import com.bytezone.diskbrowser.gui.DataSource;
* and Volume nodes in the tree to show some text in the centre panel, use a
* DefaultAppleFileSource which returns a DefaultDataSource (just some text).
*/
// -----------------------------------------------------------------------------------//
public class DefaultAppleFileSource implements AppleFileSource
// -----------------------------------------------------------------------------------//
{
final String title;
final DataSource file;
final FormattedDisk owner;
List<DiskAddress> blocks;
// ---------------------------------------------------------------------------------//
public DefaultAppleFileSource (String text, FormattedDisk owner)
// ---------------------------------------------------------------------------------//
{
this ("", text, owner);
}
// ---------------------------------------------------------------------------------//
public DefaultAppleFileSource (String title, String text, FormattedDisk owner)
// ---------------------------------------------------------------------------------//
{
this (title, new DefaultDataSource (text), owner);
}
// ---------------------------------------------------------------------------------//
public DefaultAppleFileSource (String title, DataSource file, FormattedDisk owner)
// ---------------------------------------------------------------------------------//
{
this.title = title;
this.file = file;
this.owner = owner;
}
// ---------------------------------------------------------------------------------//
public DefaultAppleFileSource (String title, DataSource file, FormattedDisk owner,
List<DiskAddress> blocks)
// ---------------------------------------------------------------------------------//
{
this (title, file, owner);
this.blocks = blocks;
@ -43,27 +53,35 @@ public class DefaultAppleFileSource implements AppleFileSource
((DefaultDataSource) file).buffer = owner.getDisk ().readSectors (blocks);
}
// ---------------------------------------------------------------------------------//
public void setSectors (List<DiskAddress> blocks)
// ---------------------------------------------------------------------------------//
{
this.blocks = blocks;
if (file instanceof DefaultDataSource)
((DefaultDataSource) file).buffer = owner.getDisk ().readSectors (blocks);
}
// ---------------------------------------------------------------------------------//
@Override
public DataSource getDataSource ()
// ---------------------------------------------------------------------------------//
{
return file;
}
// ---------------------------------------------------------------------------------//
@Override
public FormattedDisk getFormattedDisk ()
// ---------------------------------------------------------------------------------//
{
return owner;
}
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getSectors ()
// ---------------------------------------------------------------------------------//
{
return blocks;
}
@ -71,8 +89,10 @@ public class DefaultAppleFileSource implements AppleFileSource
/*
* See similar routine in CatalogPanel.DiskNode
*/
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
final int MAX_NAME_LENGTH = 40;
final int SUFFIX_LENGTH = 12;
@ -84,14 +104,18 @@ public class DefaultAppleFileSource implements AppleFileSource
return title;
}
// ---------------------------------------------------------------------------------//
@Override
public String getUniqueName ()
// ---------------------------------------------------------------------------------//
{
return title;
}
// ---------------------------------------------------------------------------------//
@Override
public boolean contains (DiskAddress diskAddress)
// ---------------------------------------------------------------------------------//
{
for (DiskAddress da : blocks)
if (da.matches (diskAddress))

View File

@ -8,39 +8,58 @@ import javax.swing.JPanel;
import com.bytezone.diskbrowser.gui.DataSource;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class DefaultDataSource implements DataSource
// -----------------------------------------------------------------------------------//
{
public String text;
byte[] buffer;
// ---------------------------------------------------------------------------------//
public DefaultDataSource (String text)
// ---------------------------------------------------------------------------------//
{
this.text = text;
}
// ---------------------------------------------------------------------------------//
@Override
public String getAssembler ()
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public String getHexDump ()
// ---------------------------------------------------------------------------------//
{
if (buffer != null)
return HexFormatter.format (buffer, 0, buffer.length);
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public BufferedImage getImage ()
// ---------------------------------------------------------------------------------//
{
return null;
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
return text;
}
// ---------------------------------------------------------------------------------//
@Override
public JComponent getComponent ()
// ---------------------------------------------------------------------------------//
{
System.out.println ("In DefaultDataSource.getComponent()");
JPanel panel = new JPanel ();

View File

@ -2,24 +2,32 @@ package com.bytezone.diskbrowser.disk;
import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class DefaultSector extends AbstractSector
// -----------------------------------------------------------------------------------//
{
String name;
// ---------------------------------------------------------------------------------//
public DefaultSector (String name, Disk disk, byte[] buffer, DiskAddress diskAddress)
// ---------------------------------------------------------------------------------//
{
super (disk, buffer, diskAddress);
this.name = name;
}
// ---------------------------------------------------------------------------------//
@Override
public String createText ()
// ---------------------------------------------------------------------------------//
{
return name + "\n\n" + HexFormatter.format (buffer, 0, buffer.length);
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return name;
}

View File

@ -4,7 +4,9 @@ import java.awt.event.ActionListener;
import java.io.File;
import java.util.List;
// -----------------------------------------------------------------------------------//
public interface Disk extends Iterable<DiskAddress>
// -----------------------------------------------------------------------------------//
{
public long getBootChecksum ();

View File

@ -1,6 +1,8 @@
package com.bytezone.diskbrowser.disk;
// -----------------------------------------------------------------------------------//
public interface DiskAddress extends Comparable<DiskAddress>
// -----------------------------------------------------------------------------------//
{
public int getBlock ();

View File

@ -26,20 +26,28 @@ import com.bytezone.diskbrowser.utilities.Utility;
import com.bytezone.diskbrowser.wizardry.Wizardry4BootDisk;
import com.bytezone.diskbrowser.wizardry.WizardryScenarioDisk;
// -----------------------------------------------------------------------------------//
public class DiskFactory
// -----------------------------------------------------------------------------------//
{
private static boolean debug = false;
// ---------------------------------------------------------------------------------//
private DiskFactory ()
// ---------------------------------------------------------------------------------//
{
}
// ---------------------------------------------------------------------------------//
public static FormattedDisk createDisk (File file)
// ---------------------------------------------------------------------------------//
{
return createDisk (file.getAbsolutePath ());
}
// ---------------------------------------------------------------------------------//
public static FormattedDisk createDisk (String path)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("\nFactory : " + path);
@ -488,7 +496,9 @@ public class DiskFactory
return disk;
}
// ---------------------------------------------------------------------------------//
private static DosDisk checkDos (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking DOS disk");
@ -511,7 +521,9 @@ public class DiskFactory
return null;
}
// ---------------------------------------------------------------------------------//
private static ProdosDisk checkProdos (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking Prodos disk");
@ -533,7 +545,9 @@ public class DiskFactory
return null;
}
// ---------------------------------------------------------------------------------//
private static DosDisk checkUnidos (AppleDisk disk, int side)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking UniDOS disk");
@ -556,7 +570,9 @@ public class DiskFactory
return null;
}
// ---------------------------------------------------------------------------------//
private static FormattedDisk checkHardDisk (File file)
// ---------------------------------------------------------------------------------//
{
if (debug)
{
@ -643,7 +659,9 @@ public class DiskFactory
must all be zero.
*/
// ---------------------------------------------------------------------------------//
private static FormattedDisk check2mgDisk (File file)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking 2mg disk");
@ -666,7 +684,9 @@ public class DiskFactory
return null;
}
// ---------------------------------------------------------------------------------//
private static FormattedDisk checkPascalDisk (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking Pascal disk");
@ -722,7 +742,9 @@ public class DiskFactory
return pascalDisk;
}
// ---------------------------------------------------------------------------------//
private static boolean collectDataDisks (String fileName, int dotPos, AppleDisk[] disks)
// ---------------------------------------------------------------------------------//
{
char c = fileName.charAt (dotPos - 1);
String suffix = fileName.substring (dotPos + 1);
@ -744,7 +766,9 @@ public class DiskFactory
return true;
}
// ---------------------------------------------------------------------------------//
private static InfocomDisk checkInfocomDisk (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking Infocom disk");
@ -762,7 +786,9 @@ public class DiskFactory
return null;
}
// ---------------------------------------------------------------------------------//
private static CPMDisk checkCPMDisk (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
if (debug)
System.out.println ("Checking CPM disk");
@ -775,9 +801,4 @@ public class DiskFactory
return null;
}
private static void checkMissingSectors (AppleDisk disk, WozFile wozFile)
{
}
}

View File

@ -10,7 +10,9 @@ import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.applefile.AppleFileSource;
import com.bytezone.diskbrowser.gui.DataSource;
// -----------------------------------------------------------------------------------//
public interface FormattedDisk
// -----------------------------------------------------------------------------------//
{
// Methods to be implemented by the implementer
public DataSource getFormattedSector (DiskAddress da);

View File

@ -4,12 +4,16 @@ import java.util.List;
import com.bytezone.diskbrowser.applefile.AbstractFile;
// -----------------------------------------------------------------------------------//
public class SectorList extends AbstractFile
// -----------------------------------------------------------------------------------//
{
List<DiskAddress> sectors;
FormattedDisk formattedDisk;
// ---------------------------------------------------------------------------------//
public SectorList (FormattedDisk formattedDisk, List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
super ("noname", null);
@ -30,8 +34,10 @@ public class SectorList extends AbstractFile
}
}
// ---------------------------------------------------------------------------------//
@Override
public String getText ()
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ("Block Sector Type Owner\n");
text.append (

View File

@ -3,12 +3,16 @@ package com.bytezone.diskbrowser.disk;
import java.util.ArrayList;
import java.util.List;
// -----------------------------------------------------------------------------------//
public class SectorListConverter
// -----------------------------------------------------------------------------------//
{
public final List<DiskAddress> sectors;
public final String sectorText;
// ---------------------------------------------------------------------------------//
public SectorListConverter (String text, Disk disk)
// ---------------------------------------------------------------------------------//
{
sectors = new ArrayList<> ();
sectorText = text;
@ -29,7 +33,9 @@ public class SectorListConverter
}
}
// ---------------------------------------------------------------------------------//
public SectorListConverter (List<DiskAddress> sectors)
// ---------------------------------------------------------------------------------//
{
this.sectors = sectors;
StringBuilder text = new StringBuilder ();
@ -55,7 +61,9 @@ public class SectorListConverter
sectorText = text.deleteCharAt (text.length () - 1).toString ();
}
// ---------------------------------------------------------------------------------//
private void addToText (StringBuilder text, int firstBlock, int runLength)
// ---------------------------------------------------------------------------------//
{
if (runLength == 0)
text.append (firstBlock + ";");

View File

@ -2,19 +2,25 @@ package com.bytezone.diskbrowser.disk;
import java.awt.Color;
// -----------------------------------------------------------------------------------//
public class SectorType
// -----------------------------------------------------------------------------------//
{
public final String name;
public final Color colour;
// ---------------------------------------------------------------------------------//
public SectorType (String name, Color colour)
// ---------------------------------------------------------------------------------//
{
this.name = name;
this.colour = colour;
}
// ---------------------------------------------------------------------------------//
@Override
public String toString ()
// ---------------------------------------------------------------------------------//
{
return String.format ("[SectorType : %s, %s]", name, colour);
}

View File

@ -3,17 +3,23 @@ package com.bytezone.diskbrowser.disk;
import java.util.ArrayList;
import java.util.List;
// -----------------------------------------------------------------------------------//
public class UnknownDisk extends AbstractFormattedDisk
// -----------------------------------------------------------------------------------//
{
// could arrange for the blocks to appear as a question mark
// ---------------------------------------------------------------------------------//
public UnknownDisk (AppleDisk disk)
// ---------------------------------------------------------------------------------//
{
super (disk);
}
// ---------------------------------------------------------------------------------//
@Override
public List<DiskAddress> getFileSectors (int fileNo)
// ---------------------------------------------------------------------------------//
{
return new ArrayList<> ();
}