This commit is contained in:
Denis Molony 2018-07-23 14:44:16 +10:00
parent aa1e661056
commit 4c42a5c26d
7 changed files with 33 additions and 21 deletions

View File

@ -25,7 +25,7 @@ public class DoubleHiResImage extends HiResImage
{
super (name, buffer);
assert name.endsWith (".PAC") || name.endsWith ("A2FC");
// assert name.endsWith (".PAC") || name.endsWith ("A2FC");
if (name.endsWith (".PAC"))
{
@ -35,17 +35,17 @@ public class DoubleHiResImage extends HiResImage
auxBuffer = doubleScrunch.memory[0];
this.buffer = doubleScrunch.memory[1];
}
else if (name.endsWith (".A2FC"))
else //if (name.endsWith (".A2FC") || auxType == 0x2000)
{
auxBuffer = new byte[0x2000];
this.buffer = new byte[0x2000];
System.arraycopy (buffer, 0, auxBuffer, 0, 0x2000);
System.arraycopy (buffer, 0x2000, this.buffer, 0, 0x2000);
}
else
{
auxBuffer = null;
}
// else
// {
// auxBuffer = null;
// }
createImage ();
}

View File

@ -107,7 +107,6 @@ public class OriginalHiResImage extends HiResImage
int val = (value >> px) & 0x01; // get the next pixel to draw
int column = (ptr + px) % 2; // is it in an odd or even column?
line[linePtr++] = val == 0 ? 0 : // black pixel
// palette[colourBit][column]; // coloured pixel - use lookup table
colours[paletteTable[colourBit][column]]; // coloured pixel - use lookup table
}
}

View File

@ -503,7 +503,7 @@ public class AppleDisk implements Disk
@Override
public boolean isValidAddress (DiskAddress da)
{
return isValidAddress (da.getTrack (), da.getSector ());
return da != null && isValidAddress (da.getTrack (), da.getSector ());
}
/*

View File

@ -229,14 +229,22 @@ public class DiskFactory
if (suffix.equals ("woz"))
{
WozDisk wozDisk = new WozDisk (file);
AppleDisk appleDisk256 = new AppleDisk (wozDisk, 35, 16);
disk = checkDos (appleDisk256);
if (disk == null)
disk = checkProdos (new AppleDisk (wozDisk, 35, 8));
if (disk == null)
disk = new DataDisk (appleDisk256);
return disk;
try
{
WozDisk wozDisk = new WozDisk (file);
AppleDisk appleDisk256 = new AppleDisk (wozDisk, 35, 16);
disk = checkDos (appleDisk256);
if (disk == null)
disk = checkProdos (new AppleDisk (wozDisk, 35, 8));
if (disk == null)
disk = new DataDisk (appleDisk256);
return disk;
}
catch (Exception e)
{
System.out.println (e);
return null;
}
}
if (suffix.equals ("v2d"))

View File

@ -22,6 +22,8 @@ public class SectorList extends AbstractFile
for (DiskAddress da : sectors)
{
if (!disk.isValidAddress (da))
break;
byte[] tempBuffer = disk.readSector (da);
System.arraycopy (tempBuffer, 0, buffer, ptr, disk.getBlockSize ());
ptr += disk.getBlockSize ();

View File

@ -24,20 +24,22 @@ class WozDisk
// constructor
// ---------------------------------------------------------------------------------//
public WozDisk (File file)
public WozDisk (File file) throws Exception
{
this.file = file;
Nibblizer nibbler = new Nibblizer ();
byte[] buffer = readFile ();
assert matches (header, buffer);
if (!matches (header, buffer))
throw new Exception ("Header error");
int cs1 = readInt (buffer, 8, 4);
int cs2 = Utility.crc32 (buffer, 12, 256 - 12 + 35 * TRK_SIZE);
if (cs1 != cs2)
{
System.out.printf ("Checksum: %08X%n", cs1);
System.out.printf ("Calculat: %08X%n", cs2);
System.out.printf ("Checksum : %08X%n", cs1);
System.out.printf ("Calculated: %08X%n", cs2);
throw new Exception ("Checksum error");
}
int ptr = 12;

View File

@ -293,7 +293,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
else
file = new DoubleHiResImage (name, exactBuffer, link.getBuffer ());
}
else if (name.endsWith (".PAC") || name.endsWith (".A2FC"))
else if (name.endsWith (".PAC") || name.endsWith (".A2FC")
|| (endOfFile == 0x4000 && auxType == 0x2000))
file = new DoubleHiResImage (name, exactBuffer);
else if ((endOfFile == 0x1FF8 || endOfFile == 0x1FFF || endOfFile == 0x2000
|| endOfFile == 0x4000)