mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-18 05:30:29 +00:00
tidying
This commit is contained in:
parent
03cfaa711d
commit
a5f57d54e3
@ -10,9 +10,10 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
|||||||
{
|
{
|
||||||
private final int segmentNoHeader;
|
private final int segmentNoHeader;
|
||||||
private int segmentNoBody;
|
private int segmentNoBody;
|
||||||
|
|
||||||
public final int blockNo;
|
public final int blockNo;
|
||||||
public final int size;
|
public final int size;
|
||||||
private List<PascalProcedure> procedures;
|
|
||||||
private final int segKind;
|
private final int segKind;
|
||||||
private final int textAddress;
|
private final int textAddress;
|
||||||
private final int machineType;
|
private final int machineType;
|
||||||
@ -21,14 +22,17 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
|||||||
private final int intrinsSegs2;
|
private final int intrinsSegs2;
|
||||||
private final int slot;
|
private final int slot;
|
||||||
private int totalProcedures;
|
private int totalProcedures;
|
||||||
|
private List<PascalProcedure> procedures;
|
||||||
|
|
||||||
public PascalSegment (String name, byte[] fullBuffer, int seq)
|
public PascalSegment (String name, byte[] fullBuffer, int seq)
|
||||||
{
|
{
|
||||||
super (name, fullBuffer); // sets this.buffer to the full buffer temporarily
|
super (name, fullBuffer); // sets this.buffer to the full buffer temporarily
|
||||||
|
|
||||||
this.slot = seq;
|
this.slot = seq;
|
||||||
this.blockNo = HexFormatter.intValue (fullBuffer[seq * 4], fullBuffer[seq * 4 + 1]);
|
this.blockNo = HexFormatter.intValue (fullBuffer[seq * 4], fullBuffer[seq * 4 + 1]);
|
||||||
this.size = HexFormatter.intValue (fullBuffer[seq * 4 + 2], fullBuffer[seq * 4 + 3]);
|
this.size = HexFormatter.intValue (fullBuffer[seq * 4 + 2], fullBuffer[seq * 4 + 3]);
|
||||||
this.segmentNoHeader = fullBuffer[0x100 + seq * 2];
|
this.segmentNoHeader = fullBuffer[0x100 + seq * 2];
|
||||||
|
|
||||||
segKind = HexFormatter.intValue (fullBuffer[0xC0 + seq * 2],
|
segKind = HexFormatter.intValue (fullBuffer[0xC0 + seq * 2],
|
||||||
fullBuffer[0xC0 + seq * 2 + 1]);
|
fullBuffer[0xC0 + seq * 2 + 1]);
|
||||||
textAddress = HexFormatter.intValue (fullBuffer[0xE0 + seq * 2],
|
textAddress = HexFormatter.intValue (fullBuffer[0xE0 + seq * 2],
|
||||||
@ -48,7 +52,10 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
|||||||
System.arraycopy (fullBuffer, blockNo * 512, buffer, 0, size);
|
System.arraycopy (fullBuffer, blockNo * 512, buffer, 0, size);
|
||||||
totalProcedures = buffer[size - 1] & 0xFF;
|
totalProcedures = buffer[size - 1] & 0xFF;
|
||||||
segmentNoBody = buffer[size - 2] & 0xFF;
|
segmentNoBody = buffer[size - 2] & 0xFF;
|
||||||
if (segmentNoBody != segmentNoHeader)
|
|
||||||
|
if (segmentNoHeader == 0)
|
||||||
|
System.out.printf ("Zero segment header in %s seq %d%n", name, seq);
|
||||||
|
else if (segmentNoBody != segmentNoHeader)
|
||||||
System.out.println ("Segment number mismatch : " + segmentNoBody + " / "
|
System.out.println ("Segment number mismatch : " + segmentNoBody + " / "
|
||||||
+ segmentNoHeader);
|
+ segmentNoHeader);
|
||||||
}
|
}
|
||||||
@ -107,10 +114,12 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
|||||||
if (procedure.valid)
|
if (procedure.valid)
|
||||||
{
|
{
|
||||||
int address = size - procedure.slot * 2 - 2;
|
int address = size - procedure.slot * 2 - 2;
|
||||||
text.append (String
|
text.append (String.format (
|
||||||
.format (" %2d %04X %3d %04X %04X %04X %04X (%04X - %04X = %04X)%n",
|
" %2d %04X %3d %04X %04X %04X "
|
||||||
procedure.procedureNo, procedure.offset, procedure.procLevel,
|
+ "%04X (%04X - %04X = %04X)%n",
|
||||||
procedure.codeStart, procedure.codeEnd, procedure.parmSize,
|
procedure.procedureNo, procedure.offset,
|
||||||
|
procedure.procLevel, procedure.codeStart,
|
||||||
|
procedure.codeEnd, procedure.parmSize,
|
||||||
procedure.dataSize, address, procedure.offset,
|
procedure.dataSize, address, procedure.offset,
|
||||||
procedure.procOffset));
|
procedure.procOffset));
|
||||||
}
|
}
|
||||||
|
@ -61,16 +61,15 @@ class DosTSListSector extends AbstractSector
|
|||||||
addText (text, buffer, 7, 4, "Not used");
|
addText (text, buffer, 7, 4, "Not used");
|
||||||
addText (text, buffer, 11, 1, "Not used");
|
addText (text, buffer, 11, 1, "Not used");
|
||||||
|
|
||||||
String message;
|
|
||||||
int sectorBase = HexFormatter.intValue (buffer[5], buffer[6]);
|
int sectorBase = HexFormatter.intValue (buffer[5], buffer[6]);
|
||||||
|
|
||||||
for (int i = 12; i <= 255; i += 2)
|
for (int i = 12; i <= 255; i += 2)
|
||||||
{
|
{
|
||||||
if (buffer[i] == 0 && buffer[i + 1] == 0)
|
if (buffer[i] == 0 && buffer[i + 1] == 0)
|
||||||
message = "";
|
msg = "";
|
||||||
else
|
else
|
||||||
message = "Track/sector of file sector " + ((i - 10) / 2 + sectorBase);
|
msg = "Track/sector of file sector " + ((i - 10) / 2 + sectorBase);
|
||||||
addText (text, buffer, i, 2, message);
|
addText (text, buffer, i, 2, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
text.deleteCharAt (text.length () - 1);
|
text.deleteCharAt (text.length () - 1);
|
||||||
|
@ -22,7 +22,9 @@ import com.bytezone.diskbrowser.gui.RedoHandler.RedoListener;
|
|||||||
|
|
||||||
class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
||||||
{
|
{
|
||||||
static final Cursor crosshairCursor = new Cursor (Cursor.CROSSHAIR_CURSOR);
|
private static final Cursor crosshairCursor = new Cursor (Cursor.CROSSHAIR_CURSOR);
|
||||||
|
private static final Color[] lightColors =
|
||||||
|
{ Color.WHITE, Color.YELLOW, Color.PINK, Color.CYAN, Color.ORANGE, Color.GREEN };
|
||||||
|
|
||||||
private FormattedDisk disk;
|
private FormattedDisk disk;
|
||||||
private LayoutDetails layoutDetails;
|
private LayoutDetails layoutDetails;
|
||||||
@ -166,9 +168,8 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
|||||||
|
|
||||||
private Color getContrastColor (SectorType type)
|
private Color getContrastColor (SectorType type)
|
||||||
{
|
{
|
||||||
if (type.colour == Color.WHITE || type.colour == Color.YELLOW
|
for (Color color : lightColors)
|
||||||
|| type.colour == Color.PINK || type.colour == Color.CYAN
|
if (type.colour == color)
|
||||||
|| type.colour == Color.ORANGE || type.colour == Color.GREEN)
|
|
||||||
return Color.BLACK;
|
return Color.BLACK;
|
||||||
return Color.WHITE;
|
return Color.WHITE;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ class DiskLayoutSelection implements Iterable<DiskAddress>
|
|||||||
public boolean isSelected (DiskAddress da)
|
public boolean isSelected (DiskAddress da)
|
||||||
{
|
{
|
||||||
for (DiskAddress selection : highlights)
|
for (DiskAddress selection : highlights)
|
||||||
if (selection.compareTo (da) == 0)
|
if (selection.matches (da)) // NPE 18/7/2016
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user