From 4ebfb65f240612b0a2f83d94e6a1f82f740cd4b7 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Thu, 5 Sep 2019 08:58:06 +1000 Subject: [PATCH] tidying --- src/com/bytezone/diskbrowser/nib/WozFile.java | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/com/bytezone/diskbrowser/nib/WozFile.java b/src/com/bytezone/diskbrowser/nib/WozFile.java index a36de9b..117dd11 100644 --- a/src/com/bytezone/diskbrowser/nib/WozFile.java +++ b/src/com/bytezone/diskbrowser/nib/WozFile.java @@ -104,7 +104,7 @@ public class WozFile diskBuffer = new byte[tracks.size () * diskSectors * SECTOR_SIZE]; for (Track track : tracks) - track.packType1 (diskBuffer); + track.pack (diskBuffer); } else if (info.diskType == 2) // 3.5" { @@ -535,7 +535,7 @@ public class WozFile } // ---------------------------------------------------------------------------------// - void packType1 (byte[] diskBuffer) throws DiskNibbleException + void pack (byte[] diskBuffer) throws DiskNibbleException // ---------------------------------------------------------------------------------// { int ndx = diskSectors == 13 ? 0 : 1; @@ -552,22 +552,6 @@ public class WozFile } } - // ---------------------------------------------------------------------------------// - int packType2 (byte[] diskBuffer, int ptr) throws DiskNibbleException - // ---------------------------------------------------------------------------------// - { - DiskReader diskReader = DiskReader.getInstance (0); - for (Sector sector : sectors) - if (sector.dataOffset > 0) - { - byte[] decodedBuffer = - diskReader.decodeSector (newBuffer, sector.dataOffset + 4); - System.arraycopy (decodedBuffer, 12, diskBuffer, ptr, 512); - ptr += 512; - } - return ptr; - } - // ---------------------------------------------------------------------------------// @Override public String toString () @@ -660,7 +644,11 @@ public class WozFile { DiskReader diskReader = DiskReader.getInstance (0); + // start decoding from 4 bytes past the data prologue (3 bytes for prologue + // itself, and another byte for the sector number) byte[] decodedBuffer = diskReader.decodeSector (track.newBuffer, dataOffset + 4); + + // return 512 bytes (ignore the 12 tag bytes) System.arraycopy (decodedBuffer, 12, diskBuffer, ptr, 512); } @@ -684,7 +672,7 @@ public class WozFile { if (this.trackNo != o.trackNo) return this.trackNo - o.trackNo; - if (this.volume != o.volume) + if (this.volume != o.volume) // side return this.volume - o.volume; return this.sectorNo - o.sectorNo; }