mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-29 11:49:29 +00:00
better empty file handling
This commit is contained in:
parent
1b57001315
commit
080cafcd22
@ -60,8 +60,7 @@ abstract class CatalogEntry implements AppleFileSource
|
|||||||
public List<DiskAddress> getSectors ()
|
public List<DiskAddress> getSectors ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
List<DiskAddress> sectors = new ArrayList<> (blocks);
|
return new ArrayList<> (blocks); // make a copy
|
||||||
return sectors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -61,16 +61,19 @@ public class FileEntry extends CatalogEntry
|
|||||||
public AbstractFile getDataSource ()
|
public AbstractFile getDataSource ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (file != null)
|
if (file != null) // previously built
|
||||||
return file;
|
return file;
|
||||||
|
|
||||||
byte[] buffer = getExactBuffer ();
|
// check for empty file (e.g. see DC16.dsk)
|
||||||
if (buffer.length == 0)
|
if (firstBlock == lastBlock)
|
||||||
{
|
{
|
||||||
file = new AssemblerProgram (name, buffer, 0); // see DC16.dsk
|
file = new DefaultAppleFile (name, new byte[0]);
|
||||||
|
node.setAllowsChildren (false);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] buffer = getExactBuffer ();
|
||||||
|
|
||||||
switch (fileType)
|
switch (fileType)
|
||||||
{
|
{
|
||||||
case 2: // code (6502 or Pascal)
|
case 2: // code (6502 or Pascal)
|
||||||
|
@ -22,6 +22,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
|
|||||||
import com.bytezone.diskbrowser.utilities.Utility;
|
import com.bytezone.diskbrowser.utilities.Utility;
|
||||||
import com.bytezone.diskbrowser.wizardry.Relocator;
|
import com.bytezone.diskbrowser.wizardry.Relocator;
|
||||||
|
|
||||||
|
// useful : http://pascal.hansotten.com/ucsd-p-system/apple-pascal/apple-ii/
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
public class PascalDisk extends AbstractFormattedDisk
|
public class PascalDisk extends AbstractFormattedDisk
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
|
Loading…
Reference in New Issue
Block a user