fixed extra boot sectors

This commit is contained in:
Denis Molony 2016-08-06 20:00:01 +10:00
parent 8d562ddf12
commit 1642954f8b
5 changed files with 23 additions and 28 deletions

View File

@ -1,7 +1,5 @@
package com.bytezone.diskbrowser.applefile;
import java.util.List;
import com.bytezone.diskbrowser.disk.AbstractSector;
import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
@ -22,10 +20,10 @@ public class BootSector extends AbstractSector
this.name = name;
}
public BootSector (Disk disk, byte[] buffer, String name,
List<DiskAddress> diskAddressList)
public BootSector (Disk disk, byte[] buffer, String name)//,
// List<DiskAddress> diskAddressList)
{
super (disk, buffer, diskAddressList);
super (disk, buffer);//, diskAddressList);
this.name = name;
}
@ -58,10 +56,11 @@ public class BootSector extends AbstractSector
byte[] newBuffer = new byte[buffer.length * 2];
System.arraycopy (buffer, 0, newBuffer, 0, buffer.length);
byte[] buf = disk.readSector (1);
System.arraycopy (buf, 0, newBuffer, buf.length, buf.length);
// byte[] buf = disk.readSector (1);
// System.arraycopy (buf, 0, newBuffer, buf.length, buf.length);
buffer = newBuffer;
// this was doubling the size of Pascal boot blocks - 06/08/2016
// buffer = newBuffer;
assembler1 = new AssemblerProgram (name + " Boot Loader", buffer, 0x00, 0);
}
}

View File

@ -1,7 +1,6 @@
package com.bytezone.diskbrowser.disk;
import java.awt.image.BufferedImage;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -15,10 +14,10 @@ public abstract class AbstractSector implements DataSource
private static String newLine = String.format ("%n");
private static String newLine2 = newLine + newLine;
public byte[] buffer;
final public byte[] buffer;
protected Disk disk;
protected DiskAddress diskAddress;
protected List<DiskAddress> diskAddressList;
// private List<DiskAddress> diskAddressList;
AssemblerProgram assembler;
String description;
@ -29,11 +28,11 @@ public abstract class AbstractSector implements DataSource
this.diskAddress = diskAddress;
}
public AbstractSector (Disk disk, byte[] buffer, List<DiskAddress> diskAddressList)
public AbstractSector (Disk disk, byte[] buffer)//, List<DiskAddress> diskAddressList)
{
this.buffer = buffer;
this.disk = disk;
this.diskAddressList = diskAddressList;
// this.diskAddressList = diskAddressList;
}
@Override
@ -95,22 +94,20 @@ public abstract class AbstractSector implements DataSource
switch (size)
{
case 1:
text.append (String.format ("%03X %02X %s%n", offset, b[offset],
desc));
text.append (
String.format ("%03X %02X %s%n", offset, b[offset], desc));
break;
case 2:
text.append (String.format ("%03X-%03X %02X %02X %s%n", offset,
offset + 1, b[offset], b[offset + 1], desc));
offset + 1, b[offset], b[offset + 1], desc));
break;
case 3:
text.append (String.format ("%03X-%03X %02X %02X %02X %s%n", offset,
offset + 2, b[offset], b[offset + 1], b[offset + 2],
desc));
offset + 2, b[offset], b[offset + 1], b[offset + 2], desc));
break;
case 4:
text.append (String.format ("%03X-%03X %02X %02X %02X %02X %s%n", offset,
offset + 3, b[offset], b[offset + 1], b[offset + 2],
b[offset + 3], desc));
offset + 3, b[offset], b[offset + 1], b[offset + 2], b[offset + 3], desc));
break;
default:
System.out.println ("Invalid length : " + size);

View File

@ -284,7 +284,7 @@ class DataPanel extends JTabbedPane
{
Graphics2D g2 = image.createGraphics ();
g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
RenderingHints.VALUE_ANTIALIAS_ON);
width = image.getWidth ();
height = image.getHeight ();
}
@ -314,7 +314,7 @@ class DataPanel extends JTabbedPane
Graphics2D g2 = ((Graphics2D) g);
g2.transform (AffineTransform.getScaleInstance (scale, scale));
g2.drawImage (image, (getWidth () - image.getWidth () * scale) / 2 / scale, 4,
this);
this);
}
}
}

View File

@ -17,7 +17,7 @@ class PascalCatalogSector extends AbstractSector
public PascalCatalogSector (Disk disk, byte[] buffer, List<DiskAddress> diskAddress)
{
super (disk, buffer, diskAddress);
super (disk, buffer);//, diskAddress);
}
@Override

View File

@ -52,10 +52,9 @@ public class PascalDisk extends AbstractFormattedDisk
// DiskAddress da = disk.getDiskAddress (0);
List<DiskAddress> blocks = disk.getDiskAddressList (0, 1);
byte[] buffer = disk.readSectors (blocks);
this.bootSector = new BootSector (disk, buffer, "Pascal", blocks);
this.bootSector = new BootSector (disk, disk.readSectors (blocks), "Pascal");//, blocks);
buffer = disk.readSector (2);
byte[] buffer = disk.readSector (2);
byte[] data = new byte[CATALOG_ENTRY_SIZE];
System.arraycopy (buffer, 0, data, 0, CATALOG_ENTRY_SIZE);
@ -81,8 +80,8 @@ public class PascalDisk extends AbstractFormattedDisk
freeBlocks.set (i, false);
}
buffer = disk.readSectors (sectors);
diskCatalogSector = new PascalCatalogSector (disk, buffer, sectors);
diskCatalogSector =
new PascalCatalogSector (disk, disk.readSectors (sectors), sectors);
DefaultMutableTreeNode root = getCatalogTreeRoot ();
DefaultMutableTreeNode volumeNode = new DefaultMutableTreeNode (volumeEntry);