merge changes

This commit is contained in:
Denis Molony 2016-07-29 21:48:41 +10:00
parent 4baf2ea51e
commit ef328b7fbe
16 changed files with 384 additions and 222 deletions

View File

@ -13,9 +13,12 @@ public class BasicProgram extends AbstractFile
private static final byte ASCII_QUOTE = 0x22;
private static final byte ASCII_COLON = 0x3A;
private static final byte ASCII_SEMI_COLON = 0x3B;
private static final byte ASCII_CARET = 0x5E;
private static final byte BELL = 0x07;
private static final byte TOKEN_FOR = (byte) 0x81;
private static final byte TOKEN_NEXT = (byte) 0x82;
private static final byte TOKEN_INPUT = (byte) 0x84;
private static final byte TOKEN_LET = (byte) 0xAA;
private static final byte TOKEN_GOTO = (byte) 0xAB;
private static final byte TOKEN_IF = (byte) 0xAD;
@ -30,13 +33,13 @@ public class BasicProgram extends AbstractFile
private final Set<Integer> gotoLines = new HashSet<Integer> ();
private final Set<Integer> gosubLines = new HashSet<Integer> ();
boolean splitRem = false; // should be a user preference
boolean alignAssign = true; // should be a user preference
boolean showTargets = true; // should be a user preference
boolean showHeader = true; // should be a user preference
boolean onlyShowTargetLineNumbers = false; // should be a user preference
int wrapPrintAt = 40;
int wrapRemAt = 60;
private final boolean splitRem = false; // should be a user preference
private final boolean alignAssign = true; // should be a user preference
private final boolean showTargets = true; // should be a user preference
private final boolean showHeader = true; // should be a user preference
private final boolean onlyShowTargetLineNumbers = false; // should be a user preference
private final int wrapPrintAt = 40;
private final int wrapRemAt = 60;
public BasicProgram (String name, byte[] buffer)
{
@ -110,8 +113,7 @@ public class BasicProgram extends AbstractFile
fullText.deleteCharAt (fullText.length () - 1); // remove newline
fullText.append (" ");
}
// ... otherwise do all the indenting and showing of targets etc.
else
else // ... otherwise do all the indenting and showing of targets etc.
{
// Prepare target indicators for subsequent sublines (ie no line number)
if (showTargets && !subline.isFirst ())
@ -133,41 +135,69 @@ public class BasicProgram extends AbstractFile
int pos = subline.is (TOKEN_REM) ? 0 : alignPos;
String lineText = subline.getAlignedText (pos);
// if (subline.is (TOKEN_REM) && lineText.length () > wrapRemAt + 4)
// {
// System.out.println (subline.getAlignedText (pos));
// String copy = lineText.substring (4);
// text.append ("REM ");
// int inset = text.length ();
// System.out.println (inset);
// List<String> remarks = splitRemark (copy, wrapRemAt);
// for (String remark : remarks)
// text.append (" ".substring (0, inset) + remark);
// }
// else
text.append (lineText);
// Check for a wrapable PRINT statement (see FROM MACHINE LANGUAGE TO BASIC on DOSToolkit2eB.dsk)
if (subline.is (TOKEN_PRINT) && wrapPrintAt > 0
&& countChars (text, ASCII_QUOTE) == 2
&& countChars (text, ASCII_SEMI_COLON) == 0)
// Check for a wrappable REM statement
// (see SEA BATTLE on DISK283.DSK)
if (subline.is (TOKEN_REM) && lineText.length () > wrapRemAt + 4)
{
int first = text.indexOf ("\"");
int last = text.indexOf ("\"", first + 1);
if ((last - first) > wrapPrintAt)
// System.out.println (subline.getAlignedText (pos));
String copy = lineText.substring (4);
text.append ("REM ");
int inset = text.length ();
// System.out.println (inset);
List<String> remarks = splitRemark (copy, wrapRemAt);
for (String remark : remarks)
text.append (" ".substring (0, inset) + remark);
}
else
text.append (lineText);
// Check for a wrappable PRINT statement
// (see FROM MACHINE LANGUAGE TO BASIC on DOSToolkit2eB.dsk)
if (wrapPrintAt > 0 && (subline.is (TOKEN_PRINT) || subline.is (TOKEN_INPUT))
&& countChars (text, ASCII_QUOTE) == 2 // just start and end quotes
&& countChars (text, ASCII_CARET) == 0) // no control characters
// && countChars (text, ASCII_SEMI_COLON) == 0)
{
if (true) // new method
{
int ptr = first + wrapPrintAt;
do
List<String> lines = splitPrint (lineText);
if (lines != null)
{
fullText.append (text.substring (0, ptr)
+ "\n ".substring (0, first + 1));
text.delete (0, ptr);
ptr = wrapPrintAt;
} while (text.length () > wrapPrintAt);
int offset = text.indexOf ("PRINT");
if (offset < 0)
offset = text.indexOf ("INPUT");
String fmt = "%-" + offset + "." + offset + "s%s%n";
String padding = text.substring (0, offset);
for (String s : lines)
{
fullText.append (String.format (fmt, padding, s));
padding = "";
}
}
else
fullText.append (text + "\n");
}
else // old method
{
int first = text.indexOf ("\"") + 1;
int last = text.indexOf ("\"", first + 1) - 1;
if ((last - first) > wrapPrintAt)
{
int ptr = first + wrapPrintAt;
do
{
fullText.append (text.substring (0, ptr)
+ "\n ".substring (0, first + 1));
text.delete (0, ptr);
ptr = wrapPrintAt;
} while (text.length () > wrapPrintAt);
}
fullText.append (text + "\n");
}
}
else
fullText.append (text + "\n");
fullText.append (text + "\n");
text.setLength (0);
// Calculate indent changes that take effect after the current subline
@ -180,15 +210,58 @@ public class BasicProgram extends AbstractFile
}
}
// Reset the alignment value if we just left an IF - the indentation will be different now.
// Reset alignment value if we just left an IF - the indentation will be different now.
if (ifIndent > 0)
alignPos = 0;
}
fullText.deleteCharAt (fullText.length () - 1); // remove last newline
fullText.deleteCharAt (fullText.length () - 1); // remove last newline
return fullText.toString ();
}
private List<String> splitPrint (String line)
{
int first = line.indexOf ("\"") + 1;
int last = line.indexOf ("\"", first + 1) - 1;
if (first != 7 || (last - first) <= wrapPrintAt)
return null;
int charsLeft = last - first + 1;
List<String> lines = new ArrayList<String> ();
String padding = line.substring (0, 7);
line = line.substring (7);
String sub;
while (true)
{
if (line.length () >= wrapPrintAt)
{
sub = line.substring (0, wrapPrintAt);
line = line.substring (wrapPrintAt);
}
else
{
sub = line;
line = "";
}
String subline = padding + sub;
charsLeft -= wrapPrintAt;
if (charsLeft > 0)
lines.add (subline);
else
{
lines.add (subline + line);
break;
}
padding = " ";
}
return lines;
}
private List<String> splitRemark (String remark, int wrapLength)
{
List<String> remarks = new ArrayList<String> ();
@ -197,14 +270,14 @@ public class BasicProgram extends AbstractFile
int max = Math.min (wrapLength, remark.length () - 1);
while (max > 0 && remark.charAt (max) != ' ')
--max;
System.out.println (remark.substring (0, max));
// System.out.println (remark.substring (0, max));
remarks.add (remark.substring (0, max) + "\n");
if (max == 0)
break;
remark = remark.substring (max + 1);
}
remarks.add (remark);
System.out.println (remark);
// System.out.println (remark);
return remarks;
}
@ -252,7 +325,7 @@ public class BasicProgram extends AbstractFile
currentAlignPosition = findHighest (subline); // examine following sublines for alignment
return currentAlignPosition;
}
return 0; // reset it
return 0; // reset it
}
// The IF processing is so that any assignment that is being aligned doesn't continue
@ -409,44 +482,56 @@ public class BasicProgram extends AbstractFile
while ((b = buffer[ptr++]) != 0)
{
if (inRemark) // cannot terminate a REM
continue;
if (inString)
{
if (b == ASCII_QUOTE) // terminate string
inString = false;
continue;
}
switch (b)
{
// break IF statements into two sublines (allows for easier line indenting)
case TOKEN_IF:
if (!inString && !inRemark)
{
// skip to THEN or GOTO - if not found then it's an error
while (buffer[ptr] != TOKEN_THEN && buffer[ptr] != TOKEN_GOTO
&& buffer[ptr] != 0)
ptr++;
// skip to THEN or GOTO - if not found then it's an error
while (buffer[ptr] != TOKEN_THEN && buffer[ptr] != TOKEN_GOTO
&& buffer[ptr] != 0)
ptr++;
// keep THEN with the IF
if (buffer[ptr] == TOKEN_THEN)
++ptr;
// keep THEN with the IF
if (buffer[ptr] == TOKEN_THEN)
++ptr;
// create subline from the condition (and THEN if it exists)
sublines.add (new SubLine (this, startPtr, ptr - startPtr));
startPtr = ptr;
// create subline from the condition (and THEN if it exists)
sublines.add (new SubLine (this, startPtr, ptr - startPtr));
startPtr = ptr;
}
break;
// end of subline, so add it, advance startPtr and continue
case ASCII_COLON:
if (!inString && !inRemark)
{
sublines.add (new SubLine (this, startPtr, ptr - startPtr));
startPtr = ptr;
}
sublines.add (new SubLine (this, startPtr, ptr - startPtr));
startPtr = ptr;
break;
case TOKEN_REM:
if (!inString && !inRemark)
if (ptr != startPtr + 1) // REM appears mid-line (should follow a colon)
{
System.out.println ("mid-line REM token");
// System.out.println (HexFormatter.format (buffer, startPtr, 10));
sublines.add (new SubLine (this, startPtr, (ptr - startPtr) - 1));
startPtr = ptr - 1;
}
else
inRemark = true;
break;
case ASCII_QUOTE:
if (!inRemark)
inString = !inString;
inString = true;
break;
}
}
@ -476,7 +561,7 @@ public class BasicProgram extends AbstractFile
this.length = length;
byte b = buffer[startPtr];
if ((b & 0x80) > 0) // token
if ((b & 0x80) > 0) // token
{
switch (b)
{
@ -487,7 +572,7 @@ public class BasicProgram extends AbstractFile
break;
case TOKEN_NEXT:
if (length == 2) // no variables
if (length == 2) // no variables
nextVariables = new String[0];
else
{
@ -521,6 +606,7 @@ public class BasicProgram extends AbstractFile
}
catch (NumberFormatException e)
{
System.out.println (HexFormatter.format (buffer, startPtr + 1, length - 2));
System.out.println ("Error parsing : GOSUB " + target2 + " in "
+ parent.lineNumber);
}
@ -539,9 +625,12 @@ public class BasicProgram extends AbstractFile
}
catch (NumberFormatException e)
{
System.out.printf ("b: %d, start: %d, length: %d%n", b, startPtr,
(length - 1));
System.out.println (target);
System.out.println (HexFormatter.format (buffer, startPtr, length - 1));
System.out.println (e.toString ());
System.out.println (e);
assert false;
}
}
else if (alignAssign)

View File

@ -5,18 +5,17 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class IntegerBasicProgram extends AbstractFile
{
private static String[] tokens =
{ "?", "?", "?", " : ", "?", "?", "?", "?", "?", "?", "?", "?", "CLR", "?", "?",
"?", "HIMEM: ", "LOMEM: ", " + ", " - ", " * ", " / ", " = ", " # ", " >= ",
" > ", " <= ", " <> ", " < ", " AND ", " OR ", " MOD ", "^", "+", "(", ",",
" THEN ", " THEN ", ",", ",", "\"", "\"", "(", "!", "!", "(", "PEEK ", "RND ",
"SGN", "ABS", "PDL", "RNDX", "(", "+", "-", "NOT ", "(", "=", "#", "LEN(", "ASC(",
"SCRN(", ",", "(", "$", "$", "(", ", ", ",", ";", ";", ";", ",", ",", ",", "TEXT",
"GR ", "CALL ", "DIM ", "DIM ", "TAB ", "END", "INPUT ", "INPUT ", "INPUT ",
"FOR ", " = ", " TO ", " STEP ", "NEXT ", ",", "RETURN", "GOSUB ", "REM ", "LET ",
"GOTO ", "IF ", "PRINT ", "PRINT ", "PRINT", "POKE ", ",", "COLOR=", "PLOT", ",",
"HLIN", ",", " AT ", "VLIN ", ",", " AT ", "VTAB ", " = ", " = ", ")", ")",
"LIST ", ",", "LIST ", "POP ", "NODSP ", "NODSP ", "NOTRACE ", "DSP ", "DSP ",
"TRACE ", "PR#", "IN#", };
{ "?", "?", "?", " : ", "?", "?", "?", "?", "?", "?", "?", "?", "CLR", "?", "?", "?",
"HIMEM: ", "LOMEM: ", " + ", " - ", " * ", " / ", " = ", " # ", " >= ", " > ",
" <= ", " <> ", " < ", " AND ", " OR ", " MOD ", "^", "+", "(", ",", " THEN ",
" THEN ", ",", ",", "\"", "\"", "(", "!", "!", "(", "PEEK ", "RND ", "SGN", "ABS",
"PDL", "RNDX", "(", "+", "-", "NOT ", "(", "=", "#", "LEN(", "ASC(", "SCRN(", ",",
"(", "$", "$", "(", ", ", ",", ";", ";", ";", ",", ",", ",", "TEXT", "GR ", "CALL ",
"DIM ", "DIM ", "TAB ", "END", "INPUT ", "INPUT ", "INPUT ", "FOR ", " = ", " TO ",
" STEP ", "NEXT ", ",", "RETURN", "GOSUB ", "REM ", "LET ", "GOTO ", "IF ", "PRINT ",
"PRINT ", "PRINT", "POKE ", ",", "COLOR=", "PLOT", ",", "HLIN", ",", " AT ", "VLIN ",
",", " AT ", "VTAB ", " = ", " = ", ")", ")", "LIST ", ",", "LIST ", "POP ",
"NODSP ", "NODSP ", "NOTRACE ", "DSP ", "DSP ", "TRACE ", "PR#", "IN#", };
public IntegerBasicProgram (String name, byte[] buffer)
{
@ -28,8 +27,8 @@ public class IntegerBasicProgram extends AbstractFile
{
StringBuilder pgm = new StringBuilder ();
pgm.append ("Name : " + name + "\n");
pgm.append ("Length : $" + HexFormatter.format4 (buffer.length) + " ("
+ buffer.length + ")\n\n");
pgm.append ("Length : $" + HexFormatter.format4 (buffer.length) + " (" + buffer.length
+ ")\n\n");
int ptr = 0;
boolean looksLikeAssembler = checkForAssembler (); // this can probably go
@ -118,6 +117,11 @@ public class IntegerBasicProgram extends AbstractFile
private boolean checkForSCAssembler ()
{
if (buffer.length == 0)
{
System.out.println ("Empty buffer array");
return false;
}
int lineLength = HexFormatter.intValue (buffer[0]);
if (lineLength <= 0)
return false;
@ -127,7 +131,7 @@ public class IntegerBasicProgram extends AbstractFile
private void appendSCAssembler (StringBuilder pgm, int ptr, int lineLength)
{
int lineNumber = HexFormatter.intValue (buffer[ptr + 2]) * 256
+ HexFormatter.intValue (buffer[ptr + 1]);
+ HexFormatter.intValue (buffer[ptr + 1]);
pgm.append (String.format ("%4d: ", lineNumber));
int p2 = ptr + 3;
while (buffer[p2] != 0)
@ -167,15 +171,15 @@ public class IntegerBasicProgram extends AbstractFile
int b = HexFormatter.intValue (buffer[p]);
if (b == 0x03 // token for colon (:)
&& !inString && !inRemark && buffer[p + 1] != 1) // not end of line
&& !inString && !inRemark && buffer[p + 1] != 1) // not end of line
{
pgm.append (":\n" + " ".substring (0, lineTab));
continue;
}
if (b >= 0xB0 && b <= 0xB9 // numeric literal
&& (buffer[p - 1] & 0x80) == 0 // not a variable name
&& !inString && !inRemark)
&& (buffer[p - 1] & 0x80) == 0 // not a variable name
&& !inString && !inRemark)
{
pgm.append (HexFormatter.intValue (buffer[p + 1], buffer[p + 2]));
p += 2;
@ -213,7 +217,7 @@ public class IntegerBasicProgram extends AbstractFile
pgm.append ("Name : " + name + "\n");
pgm.append ("Length : $" + HexFormatter.format4 (buffer.length) + " (" + buffer.length
+ ")\n\n");
+ ")\n\n");
int ptr = 0;

View File

@ -33,15 +33,15 @@ public class PascalSegment extends AbstractFile implements PascalConstants
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],
fullBuffer[0xE0 + seq * 2 + 1]);
segKind =
HexFormatter.intValue (fullBuffer[0xC0 + seq * 2], fullBuffer[0xC0 + seq * 2 + 1]);
textAddress =
HexFormatter.intValue (fullBuffer[0xE0 + seq * 2], fullBuffer[0xE0 + seq * 2 + 1]);
int flags = fullBuffer[0x101 + seq * 2] & 0xFF;
machineType = flags & 0x0F;
version = (flags & 0xD0) >> 5;
intrinsSegs1 = HexFormatter.intValue (fullBuffer[0x120 + seq * 4],
fullBuffer[0x120 + seq * 4 + 1]);
intrinsSegs1 =
HexFormatter.intValue (fullBuffer[0x120 + seq * 4], fullBuffer[0x120 + seq * 4 + 1]);
intrinsSegs2 = HexFormatter.intValue (fullBuffer[0x120 + seq * 4 + 2],
fullBuffer[0x120 + seq * 4 + 3]);
@ -57,7 +57,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants
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);
+ segmentNoHeader);
}
else
{
@ -76,10 +76,10 @@ public class PascalSegment extends AbstractFile implements PascalConstants
public String toText ()
{
return String
.format (" %2d %02X %04X %,6d %-8s %-15s %3d %3d %d %d %d %d",
slot, blockNo, size, size, name, SegmentKind[segKind], textAddress,
segmentNoHeader, machineType, version, intrinsSegs1, intrinsSegs2);
return String.format (
" %2d %02X %04X %,6d %-8s %-15s %3d %3d %d %d %d %d",
slot, blockNo, size, size, name, SegmentKind[segKind], textAddress,
segmentNoHeader, machineType, version, intrinsSegs1, intrinsSegs2);
}
@Override
@ -91,9 +91,9 @@ public class PascalSegment extends AbstractFile implements PascalConstants
StringBuilder text = new StringBuilder ();
String title = "Segment - " + name;
text.append (title + "\n"
+ "===============================".substring (0, title.length ()) + "\n\n");
+ "===============================".substring (0, title.length ()) + "\n\n");
String warning =
segmentNoBody == segmentNoHeader ? "" : " (" + segmentNoHeader + " in header)";
segmentNoBody == segmentNoHeader ? "" : " (" + segmentNoHeader + " in header)";
text.append (String.format ("Address........ %02X%n", blockNo));
text.append (String.format ("Length......... %04X%n", buffer.length));
text.append (String.format ("Machine type... %d%n", machineType));
@ -116,12 +116,11 @@ public class PascalSegment extends AbstractFile implements PascalConstants
int address = size - procedure.slot * 2 - 2;
text.append (String.format (
" %2d %04X %3d %04X %04X %04X "
+ "%04X (%04X - %04X = %04X)%n",
+ "%04X (%04X - %04X = %04X)%n",
procedure.procedureNo, procedure.offset,
procedure.procLevel, procedure.codeStart,
procedure.codeEnd, procedure.parmSize,
procedure.dataSize, address, procedure.offset,
procedure.procOffset));
procedure.codeEnd, procedure.parmSize, procedure.dataSize,
address, procedure.offset, procedure.procOffset));
}
else
text.append (String.format (" %2d %04X%n", procedure.slot, procedure.offset));
@ -132,8 +131,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants
{
List<PascalCodeStatement> strings = pp.extractStrings ();
for (PascalCodeStatement cs : strings)
text.append (String.format (" %2d %04X %s%n", pp.procedureNo, cs.ptr,
cs.text));
text.append (String.format (" %2d %04X %s%n", pp.procedureNo, cs.ptr, cs.text));
}
for (PascalProcedure procedure : procedures)

View File

@ -35,10 +35,10 @@ public class AppleDisk implements Disk
private int interleave = 0;
private static int[][] interleaveSector = //
{ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, // Dos
{ 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15 }, // Prodos
{ 0, 13, 11, 9, 7, 5, 3, 1, 14, 12, 10, 8, 6, 4, 2, 15 }, // Infocom
{ 0, 6, 12, 3, 9, 15, 14, 5, 11, 2, 8, 7, 13, 4, 10, 1 } }; // CPM
{ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, // Dos
{ 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15 }, // Prodos
{ 0, 13, 11, 9, 7, 5, 3, 1, 14, 12, 10, 8, 6, 4, 2, 15 }, // Infocom
{ 0, 6, 12, 3, 9, 15, 14, 5, 11, 2, 8, 7, 13, 4, 10, 1 } }; // CPM
// Info from http://www.applelogic.org/TheAppleIIEGettingStarted.html
// Block: 0 1 2 3 4 5 6 7 8 9 A B C D E F
@ -82,7 +82,7 @@ public class AppleDisk implements Disk
int skip = 0;
if ((pos > 0 && name.substring (pos + 1).equalsIgnoreCase ("2mg"))
|| "2IMG".equals (prefix))
|| "2IMG".equals (prefix))
// if ("2IMG".equals (prefix))
{
if (debug)
@ -368,11 +368,12 @@ public class AppleDisk implements Disk
@Override
public DiskAddress getDiskAddress (int block)
{
// assert (isValidAddress (block)) : "Invalid address : " + block;
if (!isValidAddress (block))
{
System.out.println ("Invalid block : " + block);
// return null;
return new AppleDiskAddress (this, 0);
return null;
// return new AppleDiskAddress (this, 0); this was looping 26/07/2016
}
return new AppleDiskAddress (this, block);
}
@ -394,8 +395,7 @@ public class AppleDisk implements Disk
public DiskAddress getDiskAddress (int track, int sector)
{
// should this return null for invalid addresses?
assert (isValidAddress (track, sector)) : "Invalid address : " + track + ", "
+ sector;
assert (isValidAddress (track, sector)) : "Invalid address : " + track + ", " + sector;
return new AppleDiskAddress (this, track, sector);
}
@ -438,22 +438,22 @@ public class AppleDisk implements Disk
assert da.getDisk () == this : "Disk address not applicable to this disk";
assert sectorSize == 256 || sectorSize == 512 : "Invalid sector size : " + sectorSize;
assert interleave >= 0 && interleave <= MAX_INTERLEAVE : "Invalid interleave : "
+ interleave;
+ interleave;
if (sectorSize == 256)
{
int diskOffset = da.getTrack () * trackSize
+ interleaveSector[interleave][da.getSector ()] * sectorSize;
+ interleaveSector[interleave][da.getSector ()] * sectorSize;
System.arraycopy (diskBuffer, diskOffset, buffer, bufferOffset, sectorSize);
}
else if (sectorSize == 512)
{
int diskOffset = da.getTrack () * trackSize
+ interleaveSector[interleave][da.getSector () * 2] * 256;
+ interleaveSector[interleave][da.getSector () * 2] * 256;
System.arraycopy (diskBuffer, diskOffset, buffer, bufferOffset, 256);
diskOffset = da.getTrack () * trackSize
+ interleaveSector[interleave][da.getSector () * 2 + 1] * 256;
+ interleaveSector[interleave][da.getSector () * 2 + 1] * 256;
System.arraycopy (diskBuffer, diskOffset, buffer, bufferOffset + 256, 256);
}
}
@ -474,7 +474,7 @@ public class AppleDisk implements Disk
{
if (actionListenerList != null)
actionListenerList
.actionPerformed (new ActionEvent (this, ActionEvent.ACTION_PERFORMED, text));
.actionPerformed (new ActionEvent (this, ActionEvent.ACTION_PERFORMED, text));
}
public AppleFileSource getDetails ()

View File

@ -1,10 +1,6 @@
package com.bytezone.diskbrowser.disk;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.GZIPInputStream;
@ -155,8 +151,7 @@ public class DiskFactory
long length = file.length ();
if (length != 143360 && length != 116480)
{
System.out.printf ("%s: invalid file length : %,d%n", file.getName (),
file.length ());
System.out.printf ("%s: invalid file length : %,d%n", file.getName (), file.length ());
return null;
}
@ -167,9 +162,9 @@ public class DiskFactory
long checksum = appleDisk.getBootChecksum ();
if (checksum == 3176296590L || checksum == 108825457L || checksum == 1439356606L
|| checksum == 1550012074L || checksum == 1614602459L || checksum == 940889336L
|| checksum == 990032697 || checksum == 2936955085L || checksum == 1348415927L
|| checksum == 3340889101L || checksum == 18315788L || checksum == 993895235L)
|| checksum == 1550012074L || checksum == 1614602459L || checksum == 940889336L
|| checksum == 990032697 || checksum == 2936955085L || checksum == 1348415927L
|| checksum == 3340889101L || checksum == 18315788L || checksum == 993895235L)
{
disk = checkDos (file);
disk2 = checkProdos (file);
@ -185,8 +180,8 @@ public class DiskFactory
disk = new DualDosDisk (disk, disk2);
}
else if (checksum == 2803644711L || checksum == 3317783349L
|| checksum == 1728863694L || checksum == 198094178L)
else if (checksum == 2803644711L || checksum == 3317783349L || checksum == 1728863694L
|| checksum == 198094178L)
disk = checkPascalDisk (file);
else if (checksum == 3028642627L || checksum == 2070151659L)
@ -248,8 +243,8 @@ public class DiskFactory
disk = new DataDisk (new AppleDisk (file, 35, 16));
if (debug)
System.out.println (" Factory creating disk : "
+ disk.getDisk ().getFile ().getAbsolutePath ());
System.out.println ("Factory creating disk : "
+ disk.getDisk ().getFile ().getAbsolutePath ());
if (disk != null && compressed)
disk.setOriginalPath (p);

View File

@ -155,7 +155,7 @@ class DataPanel extends JTabbedPane
if (currentDataSource instanceof VisicalcFile)
{
VisicalcFile visicalcFile = (VisicalcFile) currentDataSource;
visicalcFile.setDebug (value);
VisicalcFile.setDebug (value);
setText (formattedText, visicalcFile.getText ());
}
}

View File

@ -49,7 +49,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
addPanel (dataPanel, "Output", BorderLayout.CENTER);
// create and add the right-hand disk layout panel
DiskLayoutPanel diskLayoutPanel = new DiskLayoutPanel ();
DiskLayoutPanel diskLayoutPanel = new DiskLayoutPanel (menuHandler, prefs);
JPanel layoutBorderPanel =
addPanel (diskLayoutPanel, "Disk layout", BorderLayout.EAST);
@ -100,7 +100,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
menuHandler.fontAction.addFontChangeListener (dataPanel);
menuHandler.fontAction.addFontChangeListener (catalogPanel);
menuHandler.fontAction.addFontChangeListener (diskLayoutPanel);
// menuHandler.fontAction.addFontChangeListener (diskLayoutPanel);
// set the MenuItem Actions
menuHandler.printItem.setAction (print);
@ -119,6 +119,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
quitAction.addQuitListener (menuHandler);
quitAction.addQuitListener (menuHandler.fontAction);
quitAction.addQuitListener (catalogPanel);
quitAction.addQuitListener (diskLayoutPanel);
quitAction.addQuitListener (this);
catalogPanel.setDuplicateAction (duplicateAction);

View File

@ -38,6 +38,8 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
private int gw = 8;
private int gh = 35;
private boolean retina;
public DiskLayoutImage ()
{
setPreferredSize (new Dimension (240 + 1, 525 + 1));
@ -76,6 +78,12 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
repaint ();
}
public void setRetina (boolean value)
{
retina = value;
repaint ();
}
void setSelection (List<DiskAddress> sectors)
{
selectionHandler.setSelection (sectors);
@ -109,6 +117,8 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
// maxBlock = d.getTotalBlocks ();
// the index error is caused by not recalculating the grid layout
Graphics2D g2d = (Graphics2D) g;
for (int y = p1.y; y <= p2.y; y += bh)
for (int x = p1.x; x <= p2.x; x += bw)
{
@ -116,9 +126,9 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
if (blockNo < maxBlock)
{
DiskAddress da = d.getDiskAddress (blockNo);
boolean flag = showFreeSectors && disk.isSectorFree (da);
drawBlock ((Graphics2D) g, blockNo, x, y, flag,
selectionHandler.isSelected (da));
boolean free = showFreeSectors && disk.isSectorFree (da);
boolean selected = selectionHandler.isSelected (da);
drawBlock (g2d, blockNo, x, y, free, selected);
}
}
}
@ -145,10 +155,10 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
g.setColor (type.colour);
// this is weird, the retina OSX screen needs the second fillRect
// see also DiskLegendPanel.paint()
if (false)
g.fillRect (rect.x + 2, rect.y + 2, rect.width - 3, rect.height - 3);
else
if (retina)
g.fillRect (rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
else
g.fillRect (rect.x + 2, rect.y + 2, rect.width - 3, rect.height - 3);
}
// draw an indicator in free blocks

View File

@ -12,13 +12,13 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.prefs.Preferences;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import com.bytezone.common.FontAction.FontChangeEvent;
import com.bytezone.common.FontAction.FontChangeListener;
import com.bytezone.common.QuitAction.QuitListener;
import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.disk.DualDosDisk;
@ -26,10 +26,15 @@ import com.bytezone.diskbrowser.disk.FormattedDisk;
import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent;
import com.bytezone.diskbrowser.gui.RedoHandler.RedoListener;
class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
FileSelectionListener, RedoListener, FontChangeListener
class DiskLayoutPanel extends JPanel
implements DiskSelectionListener, FileSelectionListener, RedoListener, QuitListener
//, FontChangeListener
{
private static final int SIZE = 15; // basic unit of a display block
private static final int SIZE = 15; // basic unit of a display block
private static final String PREFS_RETINA = "retina";
private final Preferences prefs;
private final MenuHandler mh;
private final DiskLayoutImage image;
private final ScrollRuler verticalRuler;
@ -38,10 +43,13 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
private final JScrollPane sp;
private LayoutDetails layout;
public DiskLayoutPanel ()
public DiskLayoutPanel (MenuHandler mh, Preferences prefs)
{
super (new BorderLayout ());
this.prefs = prefs;
this.mh = mh;
image = new DiskLayoutImage ();
verticalRuler = new ScrollRuler (image, ScrollRuler.VERTICAL);
horizontalRuler = new ScrollRuler (image, ScrollRuler.HORIZONTAL);
@ -64,13 +72,15 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
// this is just so the pack is correct
add (sp, BorderLayout.CENTER);
add (legendPanel, BorderLayout.SOUTH);
mh.retinaItem.setAction (new RetinaAction (this));
}
public DiskLayoutPanel (FormattedDisk disk)
{
this ();
setDisk (disk);
}
// public DiskLayoutPanel (FormattedDisk disk)
// {
// this ();
// setDisk (disk);
// }
public void setDisk (final FormattedDisk disk)
{
@ -113,6 +123,12 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
repaint ();
}
public void setRetina (boolean value)
{
image.setRetina (value);
legendPanel.setRetina (value);
}
public void setHex (boolean hex)
{
verticalRuler.setHex (hex);
@ -192,9 +208,9 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
Color backgroundColor = Color.WHITE;
boolean showHex = true;
public Corner (boolean click)
public Corner (boolean allowClick)
{
if (click)
if (allowClick)
addMouseListener (new MouseAdapter ()
{
@Override
@ -240,10 +256,23 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
}
@Override
public void changeFont (FontChangeEvent e)
public void quit (Preferences arg0)
{
verticalRuler.changeFont (e.font);
horizontalRuler.changeFont (e.font);
legendPanel.changeFont (e.font);
prefs.putBoolean (PREFS_RETINA, mh.retinaItem.isSelected ());
}
@Override
public void restore (Preferences arg0)
{
mh.retinaItem.setSelected (prefs.getBoolean (PREFS_RETINA, false));
setRetina (mh.retinaItem.isSelected ());
}
// @Override
// public void changeFont (FontChangeEvent e)
// {
// // verticalRuler.changeFont (e.font);
// // horizontalRuler.changeFont (e.font);
// // legendPanel.changeFont (e.font);
// }
}

View File

@ -22,6 +22,7 @@ class DiskLegendPanel extends JPanel
FormattedDisk disk;
LayoutDetails layoutDetails;
Font font;
private boolean retina;
public DiskLegendPanel ()
{
@ -37,12 +38,18 @@ class DiskLegendPanel extends JPanel
repaint ();
}
void changeFont (Font font)
public void setRetina (boolean value)
{
this.font = font;
retina = value;
repaint ();
}
// void changeFont (Font font)
// {
// this.font = font;
// repaint ();
// }
@Override
public Dimension getPreferredSize ()
{
@ -73,12 +80,12 @@ class DiskLegendPanel extends JPanel
// draw the colour
g.setColor (type.colour);
if (false)
g.fillRect (x + 2, y + 2, layoutDetails.block.width - 3,
layoutDetails.block.height - 3);
else
if (retina)
g.fillRect (x + 1, y + 1, layoutDetails.block.width - 2,
layoutDetails.block.height - 2);
else
g.fillRect (x + 2, y + 2, layoutDetails.block.width - 3,
layoutDetails.block.height - 3);
// draw the text
g.setColor (Color.BLACK);

View File

@ -64,6 +64,7 @@ public class MenuHandler
JMenuItem colourQuirksItem = new JCheckBoxMenuItem ("Colour quirks");
JMenuItem monochromeItem = new JCheckBoxMenuItem ("Monochrome");
JMenuItem debuggingItem = new JCheckBoxMenuItem ("Debugging");
JMenuItem retinaItem = new JCheckBoxMenuItem ("Retina display");
public MenuHandler (Preferences prefs)
{
@ -122,6 +123,7 @@ public class MenuHandler
formatMenu.add (colourQuirksItem);
formatMenu.add (monochromeItem);
formatMenu.add (debuggingItem);
formatMenu.add (retinaItem);
helpMenu.add (new JMenuItem (new EnvironmentAction ()));

View File

@ -0,0 +1,27 @@
package com.bytezone.diskbrowser.gui;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JMenuItem;
public class RetinaAction extends AbstractAction
{
private final DiskLayoutPanel owner;
public RetinaAction (DiskLayoutPanel owner)
{
super ("Retina display");
putValue (Action.SHORT_DESCRIPTION, "use hi resolution graphics");
// putValue (Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke ("alt G"));
// putValue (Action.MNEMONIC_KEY, KeyEvent.VK_G);
this.owner = owner;
}
@Override
public void actionPerformed (ActionEvent e)
{
owner.setRetina (((JMenuItem) e.getSource ()).isSelected ());
}
}

View File

@ -1,10 +1,6 @@
package com.bytezone.diskbrowser.gui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.*;
import javax.swing.JComponent;
@ -22,7 +18,7 @@ class ScrollRuler extends JComponent
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
private Font font = Platform.getFont (FontType.SANS_SERIF, FontSize.BASE);
private final Font font = Platform.getFont (FontType.SANS_SERIF, FontSize.BASE);
private final int orientation;
private boolean isHex = true;
private boolean isTrackMode = true;
@ -47,11 +43,9 @@ class ScrollRuler extends JComponent
// Must match the preferred size of DiskLayoutImage
if (orientation == HORIZONTAL)
setPreferredSize (new Dimension (layout.block.width * layout.grid.width + 1,
HEIGHT)); // width/height
setPreferredSize (new Dimension (layout.block.width * layout.grid.width + 1, HEIGHT));
else
setPreferredSize (new Dimension (WIDTH,
layout.block.height * layout.grid.height + 1));
setPreferredSize (new Dimension (WIDTH, layout.block.height * layout.grid.height + 1));
setTrackMode (layout.grid.width == 16 || layout.grid.width == 13);
}
@ -62,11 +56,12 @@ class ScrollRuler extends JComponent
repaint ();
}
public void changeFont (Font font)
{
this.font = font;
repaint ();
}
// public void changeFont (Font font)
// {
// System.out.println (font);
// this.font = font;
// repaint ();
// }
public void setHex (boolean hex)
{

View File

@ -23,7 +23,7 @@ public class PascalDisk extends AbstractFormattedDisk
private final PascalCatalogSector diskCatalogSector;
final String[] fileTypes =
{ "Volume", "Xdsk", "Code", "Text", "Info", "Data", "Graf", "Foto", "SecureDir" };
{ "Volume", "Xdsk", "Code", "Text", "Info", "Data", "Graf", "Foto", "SecureDir" };
SectorType diskBootSector = new SectorType ("Boot", Color.lightGray);
SectorType catalogSector = new SectorType ("Catalog", Color.magenta);
@ -109,7 +109,7 @@ public class PascalDisk extends AbstractFormattedDisk
for (PascalSegment ps : pc)
{
DefaultMutableTreeNode segmentNode =
new DefaultMutableTreeNode (new PascalCodeObject (this, ps, fe.firstBlock));
new DefaultMutableTreeNode (new PascalCodeObject (this, ps, fe.firstBlock));
node.add (segmentNode);
segmentNode.setAllowsChildren (false);
}
@ -204,7 +204,7 @@ public class PascalDisk extends AbstractFormattedDisk
if (blocks > 280)
{
if (debug)
System.out.printf ("Blocks: %d%n", blocks);
System.out.printf ("Blocks > 280: %d%n", blocks);
return false;
}
@ -254,15 +254,13 @@ public class PascalDisk extends AbstractFormattedDisk
{
String newLine = String.format ("%n");
String newLine2 = newLine + newLine;
String line =
"---- --------------- ---- -------- ------- ---- ----" + newLine;
String line = "---- --------------- ---- -------- ------- ---- ----" + newLine;
String date = volume.date == null ? "--" : df.format (volume.date.getTime ());
StringBuilder text = new StringBuilder ();
text.append ("Disk : " + disk.getFile ().getAbsolutePath () + newLine2);
text.append ("Volume : " + volume.name + newLine);
text.append ("Date : " + date + newLine2);
text.append ("Blks Name Type Date Length Frst Last"
+ newLine);
text.append ("Blks Name Type Date Length Frst Last" + newLine);
text.append (line);
int usedBlocks = 6;
@ -274,13 +272,13 @@ public class PascalDisk extends AbstractFormattedDisk
date = ce.date == null ? "--" : df.format (ce.date.getTime ());
int bytes = (size - 1) * 512 + ce.bytesUsedInLastBlock;
text.append (String.format (" %3d %-15s %s %8s %,8d $%03X $%03X%n", size,
ce.name, fileTypes[ce.fileType], date, bytes,
ce.firstBlock, ce.lastBlock));
ce.name, fileTypes[ce.fileType], date, bytes, ce.firstBlock,
ce.lastBlock));
}
text.append (line);
text.append (String
.format ("Blocks free : %3d Blocks used : %3d Total blocks : %3d%n",
(volume.totalBlocks - usedBlocks), usedBlocks, volume.totalBlocks));
text.append (String.format ("Blocks free : %3d Blocks used : %3d Total blocks : %3d%n",
(volume.totalBlocks - usedBlocks), usedBlocks,
volume.totalBlocks));
return new DefaultAppleFileSource (volume.name, text.toString (), this);
}
}

View File

@ -0,0 +1,19 @@
package com.bytezone.diskbrowser.utilities;
import java.awt.Toolkit;
public class Utility
{
public static boolean hasRetinaDisplay ()
{
Object obj =
Toolkit.getDefaultToolkit ().getDesktopProperty ("apple.awt.contentScaleFactor");
if (obj instanceof Float)
{
Float f = (Float) obj;
int scale = f.intValue ();
return (scale == 2); // 1 indicates a regular mac display.
}
return false;
}
}

View File

@ -9,11 +9,7 @@ import javax.swing.tree.DefaultTreeModel;
import com.bytezone.diskbrowser.applefile.AbstractFile;
import com.bytezone.diskbrowser.applefile.AppleFileSource;
import com.bytezone.diskbrowser.disk.DefaultAppleFileSource;
import com.bytezone.diskbrowser.disk.DefaultDataSource;
import com.bytezone.diskbrowser.disk.Disk;
import com.bytezone.diskbrowser.disk.DiskAddress;
import com.bytezone.diskbrowser.disk.SectorType;
import com.bytezone.diskbrowser.disk.*;
import com.bytezone.diskbrowser.gui.DataSource;
import com.bytezone.diskbrowser.pascal.PascalDisk;
import com.bytezone.diskbrowser.utilities.HexFormatter;
@ -97,8 +93,7 @@ public class WizardryScenarioDisk extends PascalDisk
extractMonsters (linkNode ("Monsters", "Monsters string", dataNode), sectors);
extractCharacters (linkNode ("Characters", "Characters string", dataNode), sectors);
extractImages (linkNode ("Images", "Images string", dataNode), sectors);
extractExperienceLevels (linkNode ("Experience", "Experience string", dataNode),
sectors);
extractExperienceLevels (linkNode ("Experience", "Experience string", dataNode), sectors);
// node = linkNode ("Spells", "Spells string", dataNode);
node = null;
extractSpells (node, sectors);
@ -117,7 +112,7 @@ public class WizardryScenarioDisk extends PascalDisk
}
private DefaultMutableTreeNode linkNode (String name, String text,
DefaultMutableTreeNode parent)
DefaultMutableTreeNode parent)
{
DefaultAppleFileSource afs = new DefaultAppleFileSource (name, text, this);
DefaultMutableTreeNode node = new DefaultMutableTreeNode (afs);
@ -127,8 +122,6 @@ public class WizardryScenarioDisk extends PascalDisk
public static boolean isWizardryFormat (Disk disk, boolean debug)
{
if (false)
return false;
byte[] buffer = disk.readSector (2);
int totalFiles = HexFormatter.intValue (buffer[16], buffer[17]);
if (totalFiles != 3)
@ -138,7 +131,7 @@ public class WizardryScenarioDisk extends PascalDisk
{
String text = HexFormatter.getPascalString (buffer, ptr);
if (!text.equals ("SCENARIO.DATA") && !text.equals ("SCENARIO.MESGS")
&& !text.equals ("WIZARDRY.CODE"))
&& !text.equals ("WIZARDRY.CODE"))
return false;
}
return true;
@ -194,8 +187,8 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
private int addReward (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node, int seq)
private int addReward (byte[] buffer, List<DiskAddress> blocks, DefaultMutableTreeNode node,
int seq)
{
int recLen = 168;
for (int ptr = 0; ptr < 1008; ptr += recLen)
@ -229,9 +222,9 @@ public class WizardryScenarioDisk extends PascalDisk
StringBuilder text = new StringBuilder ();
text.append ("Name Age Align Race Type "
+ "HP St In Pi Vi Ag Lu Status\n");
+ "HP St In Pi Vi Ag Lu Status\n");
text.append ("------------- ---- -------- -------- ---------- "
+ "-- -- -- -- -- -- -- ------\n");
+ "-- -- -- -- -- -- -- ------\n");
for (Character ch : characters)
{
Statistics stats = ch.getStatistics ();
@ -242,8 +235,7 @@ public class WizardryScenarioDisk extends PascalDisk
text.append (String.format (" %2d %2d %2d %2d %2d %2d", att.strength,
att.intelligence, att.piety, att.vitality, att.agility,
att.luck));
text.append (String.format (" %5s %s%n", stats.status,
ch.isOut () ? "* OUT *" : ""));
text.append (String.format (" %5s %s%n", stats.status, ch.isOut () ? "* OUT *" : ""));
}
DefaultAppleFileSource afs = (DefaultAppleFileSource) node.getUserObject ();
@ -253,7 +245,7 @@ public class WizardryScenarioDisk extends PascalDisk
}
private void addCharacters (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node)
DefaultMutableTreeNode node)
{
int recLen = 208;
for (int ptr = 0; ptr < 832; ptr += recLen)
@ -306,7 +298,7 @@ public class WizardryScenarioDisk extends PascalDisk
}
private void addMonsters (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node)
DefaultMutableTreeNode node)
{
int recLen = 158;
for (int ptr = 0; ptr < 948; ptr += recLen)
@ -358,8 +350,7 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
private void addItems (byte[] buffer, List<DiskAddress> blocks,
DefaultMutableTreeNode node)
private void addItems (byte[] buffer, List<DiskAddress> blocks, DefaultMutableTreeNode node)
{
int recLen = 78;
for (int ptr = 0; ptr < 1014; ptr += recLen)
@ -532,7 +523,7 @@ public class WizardryScenarioDisk extends PascalDisk
}
AbstractImage mi = scenarioHeader.scenarioID < 3 ? new Image (name, buffer)
: new ImageV2 (name, exactBuffer);
: new ImageV2 (name, exactBuffer);
images.add (mi);
addToNode (mi, node, da, imageSector);
}
@ -547,8 +538,7 @@ public class WizardryScenarioDisk extends PascalDisk
dds.text = text.toString ();
}
private void extractExperienceLevels (DefaultMutableTreeNode node,
List<DiskAddress> sectors)
private void extractExperienceLevels (DefaultMutableTreeNode node, List<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA);
@ -579,7 +569,7 @@ public class WizardryScenarioDisk extends PascalDisk
}
private void addToNode (AbstractFile af, DefaultMutableTreeNode node, DiskAddress block,
SectorType type)
SectorType type)
{
ArrayList<DiskAddress> blocks = new ArrayList<DiskAddress> (1);
blocks.add (block);
@ -587,17 +577,15 @@ public class WizardryScenarioDisk extends PascalDisk
}
private void addToNode (AbstractFile af, DefaultMutableTreeNode node,
List<DiskAddress> blocks, SectorType type)
List<DiskAddress> blocks, SectorType type)
{
DefaultAppleFileSource dafs =
new DefaultAppleFileSource (af.getName (), af, this, blocks);
DefaultAppleFileSource dafs = new DefaultAppleFileSource (af.getName (), af, this, blocks);
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode (dafs);
node.add (childNode);
childNode.setAllowsChildren (false);
}
private List<DiskAddress> getTwoBlocks (ScenarioData sd, int i,
List<DiskAddress> sectors)
private List<DiskAddress> getTwoBlocks (ScenarioData sd, int i, List<DiskAddress> sectors)
{
ArrayList<DiskAddress> blocks = new ArrayList<DiskAddress> (2);
blocks.add (sectors.get (sd.dataOffset + i * 2));