pascal bug

This commit is contained in:
Denis Molony 2017-03-20 13:50:41 +11:00
parent adeab79258
commit 0084f93d4a
3 changed files with 9 additions and 5 deletions

View File

@ -29,7 +29,8 @@ abstract class CatalogEntry implements AppleFileSource
firstBlock = HexFormatter.intValue (buffer[0], buffer[1]);
lastBlock = HexFormatter.intValue (buffer[2], buffer[3]);
fileType = HexFormatter.intValue (buffer[4], buffer[5]);
// fileType = HexFormatter.intValue (buffer[4], buffer[5]);
fileType = buffer[4] & 0xFF;
name = HexFormatter.getPascalString (buffer, 6);
bytesUsedInLastBlock = HexFormatter.intValue (buffer[16], buffer[17]);
@ -71,6 +72,8 @@ abstract class CatalogEntry implements AppleFileSource
public String toString ()
{
int size = lastBlock - firstBlock;
return String.format ("%03d %s %-15s", size, parent.fileTypes[fileType], name);
String fileTypeText = fileType < 0 || fileType >= parent.fileTypes.length ? "????"
: parent.fileTypes[fileType];
return String.format ("%03d %s %-15s", size, fileTypeText, name);
}
}

View File

@ -264,9 +264,10 @@ public class PascalDisk extends AbstractFormattedDisk
usedBlocks += size;
date = ce.date == null ? "--" : df.format (ce.date.getTime ());
int bytes = (size - 1) * 512 + ce.bytesUsedInLastBlock;
String fileType = ce.fileType < 0 || ce.fileType >= fileTypes.length ? "????"
: fileTypes[ce.fileType];
text.append (String.format ("%4d %-15s %s %8s %,8d $%03X $%03X $%03X%n",
size, ce.name, fileTypes[ce.fileType], date, bytes, ce.firstBlock, ce.lastBlock,
size));
size, ce.name, fileType, date, bytes, ce.firstBlock, ce.lastBlock, size));
}
text.append (line);
text.append (

View File

@ -9,7 +9,7 @@ import java.util.List;
public class Utility
{
public static final List<String> suffixes =
Arrays.asList ("po", "dsk", "do", "hdv", "2mg", "v2d", "nib", "d13", "sdk");
Arrays.asList ("po", "dsk", "do", "hdv", "2mg", "v2d", "d13", "sdk");
// not used - it doesn't work with Oracle's JDK
private static boolean hasRetinaDisplay ()