This commit is contained in:
Denis Molony 2019-09-05 22:43:09 +10:00
parent 466633bb4f
commit 5402449439
3 changed files with 14 additions and 14 deletions

View File

@ -54,11 +54,19 @@ abstract class DiskReader
return decodeSector (buffer, 0);
}
// reverse 2 bits - 0 <= bits <= 3
// ---------------------------------------------------------------------------------//
// abstract functions
static int reverse (int bits)
// ---------------------------------------------------------------------------------//
{
return bits == 1 ? 2 : bits == 2 ? 1 : bits;
}
// ---------------------------------------------------------------------------------//
abstract byte[] decodeSector (byte[] buffer, int offset) throws DiskNibbleException;
// ---------------------------------------------------------------------------------//
// ---------------------------------------------------------------------------------//
abstract byte[] encodeSector (byte[] buffer);
// ---------------------------------------------------------------------------------//
}

View File

@ -103,12 +103,4 @@ class DiskReader16Sector extends DiskReader
return encodedBuffer;
}
// reverse 2 bits - 0 <= bits <= 3
// ---------------------------------------------------------------------------------//
private static int reverse (int bits)
// ---------------------------------------------------------------------------------//
{
return bits == 1 ? 2 : bits == 2 ? 1 : bits;
}
}

View File

@ -113,13 +113,13 @@ public class WozFile
sectors.addAll (track.sectors);
Collections.sort (sectors);
diskBuffer = new byte[800 * info.sides * SECTOR_SIZE * 2];
diskBuffer = new byte[800 * info.sides * BLOCK_SIZE];
ptr = 0;
for (Sector sector : sectors)
{
sector.pack (diskBuffer, ptr);
ptr += 512;
sector.pack35 (diskBuffer, ptr);
ptr += BLOCK_SIZE;
}
}
}
@ -646,7 +646,7 @@ public class WozFile
}
// ---------------------------------------------------------------------------------//
void pack (byte[] diskBuffer, int ptr) throws DiskNibbleException
void pack35 (byte[] diskBuffer, int ptr) throws DiskNibbleException
// ---------------------------------------------------------------------------------//
{
DiskReader diskReader = DiskReader.getInstance (0);
@ -656,7 +656,7 @@ public class WozFile
byte[] decodedBuffer = diskReader.decodeSector (track.newBuffer, dataOffset + 4);
// return 512 bytes (ignore the 12 tag bytes)
System.arraycopy (decodedBuffer, 12, diskBuffer, ptr, 512);
System.arraycopy (decodedBuffer, DiskReaderGCR.TAG_SIZE, diskBuffer, ptr, 512);
}
// ---------------------------------------------------------------------------------//