Skip to content

Commit

Permalink
fixed extra boot sectors
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolony committed Aug 6, 2016
1 parent 8d562dd commit 1642954
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 28 deletions.
15 changes: 7 additions & 8 deletions src/com/bytezone/diskbrowser/applefile/BootSector.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -22,10 +20,10 @@ public BootSector (Disk disk, byte[] buffer, String name, DiskAddress diskAddres
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;
}

Expand Down Expand Up @@ -58,10 +56,11 @@ public String createText ()
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);
}
}
Expand Down
21 changes: 9 additions & 12 deletions src/com/bytezone/diskbrowser/disk/AbstractSector.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand All @@ -29,11 +28,11 @@ public AbstractSector (Disk disk, byte[] buffer, DiskAddress diskAddress)
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
Expand Down Expand Up @@ -95,22 +94,20 @@ protected void addText (StringBuilder text, byte[] b, int offset, int size, Stri
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);
Expand Down
4 changes: 2 additions & 2 deletions src/com/bytezone/diskbrowser/gui/DataPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private void setImage (BufferedImage image)
{
Graphics2D g2 = image.createGraphics ();
g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
RenderingHints.VALUE_ANTIALIAS_ON);
width = image.getWidth ();
height = image.getHeight ();
}
Expand Down Expand Up @@ -314,7 +314,7 @@ public void paintComponent (Graphics g)
Graphics2D g2 = ((Graphics2D) g);
g2.transform (AffineTransform.getScaleInstance (scale, scale));
g2.drawImage (image, (getWidth () - image.getWidth () * scale) / 2 / scale, 4,
this);
this);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions src/com/bytezone/diskbrowser/pascal/PascalDisk.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ public PascalDisk (Disk disk)

// 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);

Expand All @@ -81,8 +80,8 @@ public PascalDisk (Disk disk)
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);
Expand Down

0 comments on commit 1642954

Please sign in to comment.