mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-25 16:34:00 +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 int segmentNoBody;
|
||||
|
||||
public final int blockNo;
|
||||
public final int size;
|
||||
private List<PascalProcedure> procedures;
|
||||
|
||||
private final int segKind;
|
||||
private final int textAddress;
|
||||
private final int machineType;
|
||||
@ -21,14 +22,17 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
private final int intrinsSegs2;
|
||||
private final int slot;
|
||||
private int totalProcedures;
|
||||
private List<PascalProcedure> procedures;
|
||||
|
||||
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.blockNo = HexFormatter.intValue (fullBuffer[seq * 4], fullBuffer[seq * 4 + 1]);
|
||||
this.size = HexFormatter.intValue (fullBuffer[seq * 4 + 2], fullBuffer[seq * 4 + 3]);
|
||||
this.segmentNoHeader = fullBuffer[0x100 + seq * 2];
|
||||
|
||||
segKind = HexFormatter.intValue (fullBuffer[0xC0 + seq * 2],
|
||||
fullBuffer[0xC0 + seq * 2 + 1]);
|
||||
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);
|
||||
totalProcedures = buffer[size - 1] & 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 + " / "
|
||||
+ segmentNoHeader);
|
||||
}
|
||||
@ -107,12 +114,14 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
if (procedure.valid)
|
||||
{
|
||||
int address = size - procedure.slot * 2 - 2;
|
||||
text.append (String
|
||||
.format (" %2d %04X %3d %04X %04X %04X %04X (%04X - %04X = %04X)%n",
|
||||
procedure.procedureNo, procedure.offset, procedure.procLevel,
|
||||
procedure.codeStart, procedure.codeEnd, procedure.parmSize,
|
||||
procedure.dataSize, address, procedure.offset,
|
||||
procedure.procOffset));
|
||||
text.append (String.format (
|
||||
" %2d %04X %3d %04X %04X %04X "
|
||||
+ "%04X (%04X - %04X = %04X)%n",
|
||||
procedure.procedureNo, procedure.offset,
|
||||
procedure.procLevel, procedure.codeStart,
|
||||
procedure.codeEnd, procedure.parmSize,
|
||||
procedure.dataSize, address, procedure.offset,
|
||||
procedure.procOffset));
|
||||
}
|
||||
else
|
||||
text.append (String.format (" %2d %04X%n", procedure.slot, procedure.offset));
|
||||
|
@ -61,16 +61,15 @@ class DosTSListSector extends AbstractSector
|
||||
addText (text, buffer, 7, 4, "Not used");
|
||||
addText (text, buffer, 11, 1, "Not used");
|
||||
|
||||
String message;
|
||||
int sectorBase = HexFormatter.intValue (buffer[5], buffer[6]);
|
||||
|
||||
for (int i = 12; i <= 255; i += 2)
|
||||
{
|
||||
if (buffer[i] == 0 && buffer[i + 1] == 0)
|
||||
message = "";
|
||||
msg = "";
|
||||
else
|
||||
message = "Track/sector of file sector " + ((i - 10) / 2 + sectorBase);
|
||||
addText (text, buffer, i, 2, message);
|
||||
msg = "Track/sector of file sector " + ((i - 10) / 2 + sectorBase);
|
||||
addText (text, buffer, i, 2, msg);
|
||||
}
|
||||
|
||||
text.deleteCharAt (text.length () - 1);
|
||||
|
@ -22,7 +22,9 @@ import com.bytezone.diskbrowser.gui.RedoHandler.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 LayoutDetails layoutDetails;
|
||||
@ -166,10 +168,9 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
||||
|
||||
private Color getContrastColor (SectorType type)
|
||||
{
|
||||
if (type.colour == Color.WHITE || type.colour == Color.YELLOW
|
||||
|| type.colour == Color.PINK || type.colour == Color.CYAN
|
||||
|| type.colour == Color.ORANGE || type.colour == Color.GREEN)
|
||||
return Color.BLACK;
|
||||
for (Color color : lightColors)
|
||||
if (type.colour == color)
|
||||
return Color.BLACK;
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ class DiskLayoutSelection implements Iterable<DiskAddress>
|
||||
public boolean isSelected (DiskAddress da)
|
||||
{
|
||||
for (DiskAddress selection : highlights)
|
||||
if (selection.compareTo (da) == 0)
|
||||
if (selection.matches (da)) // NPE 18/7/2016
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user