dmolony-DiskBrowser/src/com/bytezone/diskbrowser/applefile/SegmentDictionary.java

46 lines
1.5 KiB
Java
Raw Normal View History

2016-08-06 07:17:16 +00:00
package com.bytezone.diskbrowser.applefile;
2022-02-07 05:28:22 +00:00
import com.bytezone.diskbrowser.utilities.Utility;
2020-02-07 11:52:46 +00:00
// -----------------------------------------------------------------------------------//
2016-08-06 07:17:16 +00:00
public class SegmentDictionary
2020-02-07 11:52:46 +00:00
// -----------------------------------------------------------------------------------//
2016-08-06 07:17:16 +00:00
{
private final boolean isValid;
2022-02-07 05:28:22 +00:00
private int[] codeAddress = new int[16];
private int[] codeLength = new int[16];
private String[] segName = new String[16];
2016-08-06 07:17:16 +00:00
2020-02-07 11:52:46 +00:00
// ---------------------------------------------------------------------------------//
2016-08-06 07:17:16 +00:00
public SegmentDictionary (String name, byte[] buffer)
2020-02-07 11:52:46 +00:00
// ---------------------------------------------------------------------------------//
2016-08-06 07:17:16 +00:00
{
isValid = !name.equals ("SYSTEM.INTERP"); // temporary
2022-02-07 05:28:22 +00:00
int ptr = 0;
for (int seg = 0; seg < 16; seg++)
{
codeAddress[seg] = Utility.getShort (buffer, ptr);
ptr += 2;
codeLength[seg] = Utility.getShort (buffer, ptr);
ptr += 2;
}
ptr = 64;
for (int seg = 0; seg < 16; seg++)
{
segName[seg] = new String (buffer, ptr, 8);
ptr += 8;
}
2022-03-28 03:55:49 +00:00
// for (int seg = 0; seg < 16; seg++)
// System.out.printf ("%04X %04X %s%n", codeAddress[seg], codeLength[seg], segName[seg]);
2016-08-06 07:17:16 +00:00
}
2020-02-07 11:52:46 +00:00
// ---------------------------------------------------------------------------------//
2016-08-06 07:17:16 +00:00
public boolean isValid ()
2020-02-07 11:52:46 +00:00
// ---------------------------------------------------------------------------------//
2016-08-06 07:17:16 +00:00
{
return isValid;
}
}