mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-20 04:29:02 +00:00
tidying
This commit is contained in:
parent
23b95675cf
commit
668ed719fa
@ -10,7 +10,7 @@ public class ApplesoftBasicProgram extends BasicProgram implements ApplesoftCons
|
|||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
private final List<SourceLine> sourceLines = new ArrayList<> ();
|
private final List<SourceLine> sourceLines = new ArrayList<> ();
|
||||||
private int ptr; // end-of-program marker
|
private int ptr = 0; // end-of-program marker
|
||||||
|
|
||||||
private final UserBasicFormatter userBasicFormatter;
|
private final UserBasicFormatter userBasicFormatter;
|
||||||
private final AppleBasicFormatter appleBasicFormatter;
|
private final AppleBasicFormatter appleBasicFormatter;
|
||||||
|
@ -89,8 +89,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
lastModified = Utility.getDateTime (entryBuffer, 0x1B);
|
lastModified = Utility.getDateTime (entryBuffer, 0x1B);
|
||||||
|
|
||||||
// CATALOG command only formats the LO byte - see Beneath Apple DOS pp4-6
|
// CATALOG command only formats the LO byte - see Beneath Apple DOS pp4-6
|
||||||
String base = String.format ("%s%s %03d ", locked ? "*" : " ", getFileType (),
|
String base =
|
||||||
reportedSize & 0xFF);
|
String.format ("%s%s %03d ", locked ? "*" : " ", getFileType (), reportedSize & 0xFF);
|
||||||
catalogName = getName (base, entryBuffer);
|
catalogName = getName (base, entryBuffer);
|
||||||
displayName = getDisplayName (entryBuffer);
|
displayName = getDisplayName (entryBuffer);
|
||||||
}
|
}
|
||||||
@ -235,18 +235,28 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
|
|
||||||
case IntegerBasic:
|
case IntegerBasic:
|
||||||
reportedLength = Utility.getShort (buffer, 0);
|
reportedLength = Utility.getShort (buffer, 0);
|
||||||
exactBuffer = new byte[reportedLength];
|
if (reportedLength > 0)
|
||||||
System.arraycopy (buffer, 2, exactBuffer, 0, reportedLength);
|
{
|
||||||
appleFile = new IntegerBasicProgram (name, exactBuffer);
|
exactBuffer = new byte[reportedLength];
|
||||||
|
System.arraycopy (buffer, 2, exactBuffer, 0, reportedLength);
|
||||||
|
appleFile = new IntegerBasicProgram (name, exactBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
appleFile = new DefaultAppleFile (name, buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ApplesoftBasic:
|
case ApplesoftBasic:
|
||||||
reportedLength = Utility.getShort (buffer, 0);
|
reportedLength = Utility.getShort (buffer, 0);
|
||||||
exactBuffer = new byte[reportedLength];
|
if (reportedLength > 0)
|
||||||
if (reportedLength > buffer.length)
|
{
|
||||||
reportedLength = buffer.length - 2;
|
exactBuffer = new byte[reportedLength];
|
||||||
System.arraycopy (buffer, 2, exactBuffer, 0, reportedLength);
|
if (reportedLength > buffer.length)
|
||||||
appleFile = new ApplesoftBasicProgram (name, exactBuffer);
|
reportedLength = buffer.length - 2;
|
||||||
|
System.arraycopy (buffer, 2, exactBuffer, 0, reportedLength);
|
||||||
|
appleFile = new ApplesoftBasicProgram (name, exactBuffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
appleFile = new DefaultAppleFile (name, buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Binary: // binary file
|
case Binary: // binary file
|
||||||
@ -256,8 +266,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
reportedLength = Utility.getShort (buffer, 2);
|
reportedLength = Utility.getShort (buffer, 2);
|
||||||
if (reportedLength == 0)
|
if (reportedLength == 0)
|
||||||
{
|
{
|
||||||
System.out.println (name.trim () + " reported length : 0 - reverting to "
|
System.out.println (
|
||||||
+ (buffer.length - 4));
|
name.trim () + " reported length : 0 - reverting to " + (buffer.length - 4));
|
||||||
reportedLength = buffer.length - 4;
|
reportedLength = buffer.length - 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,9 +278,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
exactBuffer = new byte[buffer.length - 4]; // reported length is too long
|
exactBuffer = new byte[buffer.length - 4]; // reported length is too long
|
||||||
System.arraycopy (buffer, 4, exactBuffer, 0, exactBuffer.length);
|
System.arraycopy (buffer, 4, exactBuffer, 0, exactBuffer.length);
|
||||||
|
|
||||||
if ((name.endsWith (".FONT") || name.endsWith (" FONT")
|
if ((name.endsWith (".FONT") || name.endsWith (" FONT") || name.endsWith (".SET")
|
||||||
|| name.endsWith (".SET") || name.startsWith ("ASCII."))
|
|| name.startsWith ("ASCII.")) && FontFile.isFont (exactBuffer))
|
||||||
&& FontFile.isFont (exactBuffer))
|
|
||||||
appleFile = new FontFile (name, exactBuffer, loadAddress);
|
appleFile = new FontFile (name, exactBuffer, loadAddress);
|
||||||
else if (name.endsWith (".MW"))
|
else if (name.endsWith (".MW"))
|
||||||
appleFile = new MagicWindowText (name, exactBuffer);
|
appleFile = new MagicWindowText (name, exactBuffer);
|
||||||
@ -305,8 +314,7 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
appleFile = new AssemblerProgram (name, exactBuffer, loadAddress);
|
appleFile = new AssemblerProgram (name, exactBuffer, loadAddress);
|
||||||
}
|
}
|
||||||
else if (reportedLength == 0x240 //
|
else if (reportedLength == 0x240 //
|
||||||
&& (loadAddress == 0x5800 || loadAddress == 0x6000
|
&& (loadAddress == 0x5800 || loadAddress == 0x6000 || loadAddress == 0x7800))
|
||||||
|| loadAddress == 0x7800))
|
|
||||||
appleFile = new PrintShopGraphic (name, exactBuffer);
|
appleFile = new PrintShopGraphic (name, exactBuffer);
|
||||||
else if (isRunCommand (exactBuffer))
|
else if (isRunCommand (exactBuffer))
|
||||||
{
|
{
|
||||||
@ -319,8 +327,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
{
|
{
|
||||||
appleFile = new AssemblerProgram (name, exactBuffer, loadAddress);
|
appleFile = new AssemblerProgram (name, exactBuffer, loadAddress);
|
||||||
if ((exactBuffer.length + 4) < buffer.length)
|
if ((exactBuffer.length + 4) < buffer.length)
|
||||||
((AssemblerProgram) appleFile).setExtraBuffer (buffer,
|
((AssemblerProgram) appleFile).setExtraBuffer (buffer, exactBuffer.length + 4,
|
||||||
exactBuffer.length + 4, buffer.length - (exactBuffer.length + 4));
|
buffer.length - (exactBuffer.length + 4));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -362,8 +370,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
|
|||||||
int reportedLength = Utility.getShort (buffer, 2);
|
int reportedLength = Utility.getShort (buffer, 2);
|
||||||
if (reportedLength == 0)
|
if (reportedLength == 0)
|
||||||
{
|
{
|
||||||
System.out.println (
|
System.out
|
||||||
name.trim () + " reported length : 0 - reverting to " + (buffer.length - 4));
|
.println (name.trim () + " reported length : 0 - reverting to " + (buffer.length - 4));
|
||||||
reportedLength = buffer.length - 4;
|
reportedLength = buffer.length - 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user