minor bug fixes

This commit is contained in:
Denis Molony 2020-05-15 11:14:01 +10:00
parent 96c49fc61d
commit 7e499e208f
10 changed files with 292 additions and 216 deletions

View File

@ -5,12 +5,14 @@ import java.util.List;
import com.bytezone.diskbrowser.utilities.HexFormatter; import com.bytezone.diskbrowser.utilities.HexFormatter;
// -----------------------------------------------------------------------------------//
public class BasicProgramGS extends BasicProgram public class BasicProgramGS extends BasicProgram
// -----------------------------------------------------------------------------------//
{ {
private static String[] // private static String[] //
tokens = { "AUTO", "DEL", "EDI", "HLIST ", // 0x80 - 0x83 tokens = { "AUTO", "DEL", "EDI", "HLIST ", // 0x80 - 0x83
"LIST", "RENUM", "BREAK ", "FN ", // 0x84 - 0x87 "LIST", "RENUM", "BREAK ", "FN ", // 0x84 - 0x87
"PROC ", "GOSUB", " GOTO ", "FOR ", // 0x88 - 0x8B "PROC ", "GOSUB", " GOTO ", "FOR ", // 0x88 - 0x8B
" THEN ", "ELSE ", "NEXT ", "OFF ", // 0x8C - 0x8F " THEN ", "ELSE ", "NEXT ", "OFF ", // 0x8C - 0x8F
"ON ", "INPUT ", "OUTPUT ", "TEXT ", // 0x90 - 0x93 "ON ", "INPUT ", "OUTPUT ", "TEXT ", // 0x90 - 0x93
"TIMER ", "EXCEPTION ", "CAT ", " 97 ", // 0x94 - 0x97 "TIMER ", "EXCEPTION ", "CAT ", " 97 ", // 0x94 - 0x97
@ -79,10 +81,15 @@ public class BasicProgramGS extends BasicProgram
private final List<SourceLine> sourceLines = new ArrayList<> (); private final List<SourceLine> sourceLines = new ArrayList<> ();
// ---------------------------------------------------------------------------------//
public BasicProgramGS (String name, byte[] buffer) public BasicProgramGS (String name, byte[] buffer)
// ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
// need to validate these files - seem to sometimes contain palette files
// 0132 816-Paint.po
int ptr = 5; int ptr = 5;
while (ptr < buffer.length) while (ptr < buffer.length)
{ {
@ -97,8 +104,10 @@ public class BasicProgramGS extends BasicProgram
} }
// ---------------------------------------------------------------------------------//
@Override @Override
public String getText () public String getText ()
// ---------------------------------------------------------------------------------//
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
for (SourceLine sourceLine : sourceLines) for (SourceLine sourceLine : sourceLines)
@ -106,7 +115,9 @@ public class BasicProgramGS extends BasicProgram
return text.toString (); return text.toString ();
} }
// ---------------------------------------------------------------------------------//
private class SourceLine private class SourceLine
// ---------------------------------------------------------------------------------//
{ {
int lineNumber; int lineNumber;
int length; int length;

View File

@ -6,17 +6,13 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class FinderData extends AbstractFile public class FinderData extends AbstractFile
// -----------------------------------------------------------------------------------// // -----------------------------------------------------------------------------------//
{ {
int totFiles; int version = buffer[0];
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public FinderData (String name, byte[] buffer) public FinderData (String name, byte[] buffer)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
super (name, buffer); super (name, buffer);
int xx = buffer[40] & 0xFF;
if (xx == 0x2A)
totFiles = buffer[34] & 0xFF; // not always
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
@ -28,32 +24,47 @@ public class FinderData extends AbstractFile
text.append ("Name : " + name + "\n\n"); text.append ("Name : " + name + "\n\n");
if (buffer.length < 50)
{
text.append (HexFormatter.format (buffer));
return text.toString ();
}
text.append (HexFormatter.format (buffer, 0, 42));
text.append ("\n\n"); text.append ("\n\n");
int ptr = 42; if (version == 1)
for (int i = 0; i < totFiles; i++)
{ {
String line = HexFormatter.getHexString (buffer, ptr, 8); int ptr = 16;
text.append (line + " "); text.append (HexFormatter.getHexString (buffer, 0, ptr));
text.append ("\n\n");
while (buffer[ptr] != 0)
{
String line = HexFormatter.getHexString (buffer, ptr, 6);
text.append (line + " ");
ptr += 8; String name = HexFormatter.getPascalString (buffer, ptr + 6);
String name = HexFormatter.getPascalString (buffer, ptr); text.append (name + "\n");
// text.append (name + "\n");
text.append (String.format ("%-20s ", name));
ptr += name.length () + 1; ptr += 22;
text.append (String.format ("%02X%n", buffer[ptr++])); }
}
else if (version == 2)
{
int totFiles = buffer[34];
int ptr = 42;
text.append (HexFormatter.format (buffer, 0, ptr));
text.append ("\n\n");
for (int i = 0; i < totFiles; i++)
{
String line = HexFormatter.getHexString (buffer, ptr, 8);
text.append (line + " ");
ptr += 8;
String name = HexFormatter.getPascalString (buffer, ptr);
text.append (String.format ("%-20s ", name));
ptr += name.length () + 1;
text.append (String.format ("%02X%n", buffer[ptr++]));
}
} }
// if (text.length () > 0) if (text.length () > 0)
// text.deleteCharAt (text.length () - 1); text.deleteCharAt (text.length () - 1);
return text.toString (); return text.toString ();
} }

View File

@ -44,7 +44,7 @@ public abstract class HiResImage extends AbstractFile
// $06 BIN .3200 SHRPictureFile2 // $06 BIN .3200 SHRPictureFile2
// $06 BIN .3201 SHRPictureFile2 packed // $06 BIN .3201 SHRPictureFile2 packed
// ---- ---- ------ -------------------------------------- ------------------------ // ---- ---- ------ -------------------------------------- ------------------------
// $08 FOT <$4000 Apple II Graphics File ??? // $08 FOT <$4000 Apple II Graphics File OriginalHiResImage
// $08 FOT $4000 Packed Hi-Res file ??? // $08 FOT $4000 Packed Hi-Res file ???
// $08 FOT $4001 Packed Double Hi-Res file ??? // $08 FOT $4001 Packed Double Hi-Res file ???
// $08 FOT $8066 Fadden Hi-res FaddenHiResImage // $08 FOT $8066 Fadden Hi-res FaddenHiResImage
@ -239,6 +239,7 @@ public abstract class HiResImage extends AbstractFile
monochrome = value; monochrome = value;
} }
// byte +120 is the first screen hole
/*- /*-
* Files of type $08 and any auxiliary type less than or equal to $3FFF contain a * Files of type $08 and any auxiliary type less than or equal to $3FFF contain a
* standard Apple II graphics file in one of several modes. After determining that * standard Apple II graphics file in one of several modes. After determining that

View File

@ -1,166 +1,184 @@
package com.bytezone.diskbrowser.applefile; package com.bytezone.diskbrowser.applefile;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer; import java.awt.image.DataBuffer;
public class OriginalHiResImage extends HiResImage // -----------------------------------------------------------------------------------//
{ public class OriginalHiResImage extends HiResImage
private static final int WHITE = 0xFFFFFF; // -----------------------------------------------------------------------------------//
private static final int BLACK = 0x000000; {
private static final int[][] paletteTable = { { 9, 6 }, { 12, 3 } }; private static final int WHITE = 0xFFFFFF;
private static final int BLACK = 0x000000;
private static boolean matchColourBits = false; private static final int[][] paletteTable = { { 9, 6 }, { 12, 3 } };
private final int[] line = new int[280]; private static boolean matchColourBits = false;
private final int[] colourBits = new int[280];
private final int[] line = new int[280];
public OriginalHiResImage (String name, byte[] buffer, int loadAddress) private final int[] colourBits = new int[280];
{
super (name, buffer, loadAddress); // ---------------------------------------------------------------------------------//
public OriginalHiResImage (String name, byte[] buffer, int loadAddress)
createImage (); // ---------------------------------------------------------------------------------//
} {
super (name, buffer, loadAddress);
public OriginalHiResImage (String name, byte[] buffer, int loadAddress,
boolean scrunched) createImage ();
{ }
super (name, buffer, loadAddress, scrunched);
// ---------------------------------------------------------------------------------//
createImage (); public OriginalHiResImage (String name, byte[] buffer, int loadAddress,
} boolean scrunched)
// ---------------------------------------------------------------------------------//
public OriginalHiResImage (String name, byte[] buffer, int fileType, int auxType, {
int eof) super (name, buffer, loadAddress, scrunched);
{
super (name, buffer, fileType, auxType, eof); createImage ();
}
// will call createImage () itself
} // ---------------------------------------------------------------------------------//
public OriginalHiResImage (String name, byte[] buffer, int fileType, int auxType,
// https://github.com/Michaelangel007/apple2_hgr_font_tutorial int eof)
// hgr[ y ] = 0x2000 + (y/64)*0x28 + (y%8)*0x400 + ((y/8)&7)*0x80; // ---------------------------------------------------------------------------------//
// or... Y = aabbbccc {
// address = BASE + aa * 0x28 + bb * 0x80 + ccc * 0x0400 + X super (name, buffer, fileType, auxType, eof);
@Override // will call createImage () itself
protected void createMonochromeImage () }
{
int rows = buffer.length <= 8192 ? 192 : 384; // https://github.com/Michaelangel007/apple2_hgr_font_tutorial
image = new BufferedImage (280, rows, BufferedImage.TYPE_BYTE_GRAY); // hgr[ y ] = 0x2000 + (y/64)*0x28 + (y%8)*0x400 + ((y/8)&7)*0x80;
DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); // or... Y = aabbbccc
int element = 0; // address = BASE + aa * 0x28 + bb * 0x80 + ccc * 0x0400 + X
for (int page = 0; page < rows / 192; page++) // ---------------------------------------------------------------------------------//
for (int i = 0; i < 3; i++) @Override
for (int j = 0; j < 8; j++) protected void createMonochromeImage ()
for (int k = 0; k < 8; k++) // ---------------------------------------------------------------------------------//
{ {
int base = page * 0x2000 + i * 0x28 + j * 0x80 + k * 0x400; int rows = buffer.length <= 8192 ? 192 : 384;
int max = Math.min (base + 40, buffer.length); image = new BufferedImage (280, rows, BufferedImage.TYPE_BYTE_GRAY);
for (int ptr = base; ptr < max; ptr++) DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
{ int element = 0;
int value = buffer[ptr] & 0x7F;
for (int px = 0; px < 7; px++) for (int page = 0; page < rows / 192; page++)
{ for (int i = 0; i < 3; i++)
int val = (value >> px) & 0x01; for (int j = 0; j < 8; j++)
dataBuffer.setElem (element++, val == 0 ? 0 : 255); for (int k = 0; k < 8; k++)
} {
} int base = page * 0x2000 + i * 0x28 + j * 0x80 + k * 0x400;
} int max = Math.min (base + 40, buffer.length);
} for (int ptr = base; ptr < max; ptr++)
{
@Override int value = buffer[ptr] & 0x7F;
protected void createColourImage () for (int px = 0; px < 7; px++)
{ {
paletteIndex = paletteFactory.getCurrentPaletteIndex (); int val = (value >> px) & 0x01;
int rows = buffer.length <= 8192 ? 192 : 384; dataBuffer.setElem (element++, val == 0 ? 0 : 255);
image = new BufferedImage (280, rows, BufferedImage.TYPE_INT_RGB); }
DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); }
int element = 0; }
}
for (int page = 0; page < rows / 192; page++)
for (int i = 0; i < 3; i++) // ---------------------------------------------------------------------------------//
for (int j = 0; j < 8; j++) @Override
for (int k = 0; k < 8; k++) protected void createColourImage ()
{ // ---------------------------------------------------------------------------------//
fillLine (page * 0x2000 + i * 0x28 + j * 0x80 + k * 0x400); {
for (int pixel : line) paletteIndex = paletteFactory.getCurrentPaletteIndex ();
dataBuffer.setElem (element++, pixel); int rows = buffer.length <= 8192 ? 192 : 384;
} image = new BufferedImage (280, rows, BufferedImage.TYPE_INT_RGB);
} DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
int element = 0;
private void fillLine (int base)
{ for (int page = 0; page < rows / 192; page++)
Palette palette = paletteFactory.getCurrentPalette (); for (int i = 0; i < 3; i++)
int[] colours = palette.getColours (); for (int j = 0; j < 8; j++)
for (int k = 0; k < 8; k++)
int max = Math.min (base + 40, buffer.length); {
int linePtr = 0; fillLine (page * 0x2000 + i * 0x28 + j * 0x80 + k * 0x400);
assert colourBits != null; for (int pixel : line)
dataBuffer.setElem (element++, pixel);
for (int ptr = base; ptr < max; ptr++) }
{ }
int colourBit = (buffer[ptr] & 0x80) >> 7;
int value = buffer[ptr] & 0x7F; // ---------------------------------------------------------------------------------//
private void fillLine (int base)
for (int px = 0; px < 7; px++) // ---------------------------------------------------------------------------------//
{ {
colourBits[linePtr] = colourBit; // store the colour bit Palette palette = paletteFactory.getCurrentPalette ();
int val = (value >> px) & 0x01; // get the next pixel to draw int[] colours = palette.getColours ();
int column = (ptr + px) % 2; // is it in an odd or even column?
line[linePtr++] = val == 0 ? 0 : // black pixel int max = Math.min (base + 40, buffer.length);
colours[paletteTable[colourBit][column]]; // coloured pixel - use lookup table int linePtr = 0;
} assert colourBits != null;
}
for (int ptr = base; ptr < max; ptr++)
// convert consecutive ON pixels to white {
for (int x = 1; x < line.length; x++) // skip first pixel, refer back int colourBit = (buffer[ptr] & 0x80) >> 7;
{ int value = buffer[ptr] & 0x7F;
if (matchColourBits && colourBits[x - 1] != colourBits[x])
continue; // only modify values with matching colour bits for (int px = 0; px < 7; px++)
{
int px0 = line[x - 1]; colourBits[linePtr] = colourBit; // store the colour bit
int px1 = line[x]; int val = (value >> px) & 0x01; // get the next pixel to draw
if (px0 != BLACK && px1 != BLACK) int column = (ptr + px) % 2; // is it in an odd or even column?
line[x - 1] = line[x] = WHITE; line[linePtr++] = val == 0 ? 0 : // black pixel
} colours[paletteTable[colourBit][column]]; // coloured pixel - use lookup table
}
// optionally do physics }
if (colourQuirks)
applyColourQuirks (); // convert consecutive ON pixels to white
} for (int x = 1; x < line.length; x++) // skip first pixel, refer back
{
private boolean isColoured (int pixel) if (matchColourBits && colourBits[x - 1] != colourBits[x])
{ continue; // only modify values with matching colour bits
return pixel != BLACK && pixel != WHITE;
} int px0 = line[x - 1];
int px1 = line[x];
private void applyColourQuirks () if (px0 != BLACK && px1 != BLACK)
{ line[x - 1] = line[x] = WHITE;
for (int x = 3; x < line.length; x++) // skip first three pixels, refer back }
{
if (matchColourBits && colourBits[x - 2] != colourBits[x - 1]) // optionally do physics
continue; // only modify values with matching colour bits if (colourQuirks)
applyColourQuirks ();
int px0 = line[x - 3]; }
int px1 = line[x - 2];
int px2 = line[x - 1]; // ---------------------------------------------------------------------------------//
int px3 = line[x]; private boolean isColoured (int pixel)
// ---------------------------------------------------------------------------------//
if (px1 == BLACK) {
{ return pixel != BLACK && pixel != WHITE;
if (px3 == BLACK && px0 == px2 && isColoured (px0)) // V-B-V-B }
line[x - 2] = px0; // --> V-V-V-B
else if (px3 == WHITE && px2 == WHITE && isColoured (px0)) // V-B-W-W // ---------------------------------------------------------------------------------//
line[x - 2] = px0; // --> V-V-W-W private void applyColourQuirks ()
} // ---------------------------------------------------------------------------------//
else if (px2 == BLACK) {
{ for (int x = 3; x < line.length; x++) // skip first three pixels, refer back
if (px0 == BLACK && px1 == px3 && isColoured (px3)) // B-G-B-G {
line[x - 1] = px3; // --> B-G-G-G if (matchColourBits && colourBits[x - 2] != colourBits[x - 1])
else if (px0 == WHITE && px1 == WHITE && isColoured (px3)) // W-W-B-G continue; // only modify values with matching colour bits
line[x - 1] = px3; // --> W-W-G-G
} int px0 = line[x - 3];
} int px1 = line[x - 2];
} int px2 = line[x - 1];
int px3 = line[x];
if (px1 == BLACK)
{
if (px3 == BLACK && px0 == px2 && isColoured (px0)) // V-B-V-B
line[x - 2] = px0; // --> V-V-V-B
else if (px3 == WHITE && px2 == WHITE && isColoured (px0)) // V-B-W-W
line[x - 2] = px0; // --> V-V-W-W
}
else if (px2 == BLACK)
{
if (px0 == BLACK && px1 == px3 && isColoured (px3)) // B-G-B-G
line[x - 1] = px3; // --> B-G-G-G
else if (px0 == WHITE && px1 == WHITE && isColoured (px3)) // W-W-B-G
line[x - 1] = px3; // --> W-W-G-G
}
}
}
} }

View File

@ -50,11 +50,11 @@ public class DiskFactory
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
FormattedDisk disk = create (path); FormattedDisk disk = create (path);
if (disk.getDisk ().getInterleave () > 0) // if (disk.getDisk ().getInterleave () > 0)
{ // {
System.out.println (disk); // System.out.println (disk);
System.out.println (); // System.out.println ();
} // }
return disk; return disk;
} }

View File

@ -59,8 +59,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource
name = getName ("", entryBuffer); name = getName ("", entryBuffer);
reportedSize = HexFormatter.unsignedShort (entryBuffer, 33); reportedSize = HexFormatter.unsignedShort (entryBuffer, 33);
if (reportedSize == 0) // if (reportedSize == 0)
System.out.printf ("%s size 0%n", name); // System.out.printf ("%s size 0%n", name);
int type = entryBuffer[2] & 0x7F; int type = entryBuffer[2] & 0x7F;
locked = (entryBuffer[2] & 0x80) != 0; locked = (entryBuffer[2] & 0x80) != 0;

View File

@ -307,7 +307,7 @@ public class DosDisk extends AbstractFormattedDisk
} }
} }
if (best == 0) if (best <= 1)
return false; return false;
disk.setInterleave (il); disk.setInterleave (il);
@ -354,6 +354,14 @@ public class DosDisk extends AbstractFormattedDisk
// if (buffer[1] != 0x11) // first catalog track // if (buffer[1] != 0x11) // first catalog track
// return 0; // return 0;
// Apple Assembly Language.dsk claims 0x2A tracks per disk
// if (buffer[52] != 35 && buffer[52] != 50)
// {
// if (debug)
// System.out.printf ("Bad tracks per disk : %02X%n", buffer[52]);
// return 0;
// }
if (debug) if (debug)
System.out.printf ("Sectors per track: %02X%n", buffer[53]); System.out.printf ("Sectors per track: %02X%n", buffer[53]);
@ -374,9 +382,10 @@ public class DosDisk extends AbstractFormattedDisk
int version = buffer[3] & 0xFF; int version = buffer[3] & 0xFF;
if (debug) if (debug)
System.out.printf ("Version: %02X%n", buffer[3]); System.out.printf ("Version: %02X%n", buffer[3]);
if (version > 0x43 && version != 0xFF) if (version == 0 || (version > 0x43 && version != 0xFF))
{ {
System.out.printf ("Bad version : %02X%n", version); if (debug)
System.out.printf ("Bad version : %02X%n", version);
return 0; return 0;
} }

View File

@ -37,6 +37,7 @@ class DosVTOCSector extends AbstractSector
maxTracks = buffer[52] & 0xFF; maxTracks = buffer[52] & 0xFF;
maxSectors = buffer[53] & 0xFF; maxSectors = buffer[53] & 0xFF;
sectorSize = HexFormatter.intValue (buffer[54], buffer[55]); sectorSize = HexFormatter.intValue (buffer[54], buffer[55]);
flagSectors2 (); flagSectors2 ();
} }
@ -72,7 +73,16 @@ class DosVTOCSector extends AbstractSector
addTextAndDecimal (text, buffer, 48, 1, "Last allocated track"); addTextAndDecimal (text, buffer, 48, 1, "Last allocated track");
addText (text, buffer, 49, 1, "Direction to look when allocating the next file"); addText (text, buffer, 49, 1, "Direction to look when allocating the next file");
addText (text, buffer, 50, 2, "Not used"); addText (text, buffer, 50, 2, "Not used");
addTextAndDecimal (text, buffer, 52, 1, "Maximum tracks"); addTextAndDecimal (text, buffer, 52, 1, "Maximum tracks");
if (maxTracks != disk.getTotalTracks ())
{
text.deleteCharAt (text.length () - 1);
text.append (String.format (" <-- Should be 0x%02X !!%n",
disk.getTotalTracks ()));
}
addTextAndDecimal (text, buffer, 53, 1, "Maximum sectors"); addTextAndDecimal (text, buffer, 53, 1, "Maximum sectors");
addTextAndDecimal (text, buffer, 54, 2, "Bytes per sector"); addTextAndDecimal (text, buffer, 54, 2, "Bytes per sector");
@ -176,7 +186,7 @@ class DosVTOCSector extends AbstractSector
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
int firstSector = 0x38; int firstSector = 0x38;
int max = maxTracks * 4 + firstSector; int max = disk.getTotalTracks () * 4 + firstSector;
for (int i = firstSector; i < max; i += 4) for (int i = firstSector; i < max; i += 4)
{ {
int track = (i - firstSector) / 4; int track = (i - firstSector) / 4;

View File

@ -326,6 +326,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
// see gs basic disk, one of the four pictures looks ok // see gs basic disk, one of the four pictures looks ok
file = new SHRPictureFile2 (name, exactBuffer, 0xC1, 0, endOfFile); file = new SHRPictureFile2 (name, exactBuffer, 0xC1, 0, endOfFile);
} }
// else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
else else
{ {
file = new AssemblerProgram (name, exactBuffer, auxType); file = new AssemblerProgram (name, exactBuffer, auxType);
@ -352,7 +354,11 @@ class FileEntry extends CatalogEntry implements ProdosConstants
break; break;
case FILE_TYPE_GS_BASIC: case FILE_TYPE_GS_BASIC:
file = new BasicProgramGS (name, exactBuffer); // 0132 816-Paint.po has GSB files that crash because they are palettes
if (buffer[0] == 4 && buffer[1] == 16) // complete guess
file = new BasicProgramGS (name, exactBuffer);
else
file = new DefaultAppleFile (name, exactBuffer);
break; break;
case FILE_TYPE_INTEGER_BASIC: case FILE_TYPE_INTEGER_BASIC:
@ -427,10 +433,28 @@ class FileEntry extends CatalogEntry implements ProdosConstants
case FILE_TYPE_FOT: case FILE_TYPE_FOT:
if (auxType == HiResImage.FADDEN_AUX) if (auxType == HiResImage.FADDEN_AUX)
file = new FaddenHiResImage (name, exactBuffer, fileType, auxType, endOfFile); file = new FaddenHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
else if (auxType < 0x4000)
{
file = new OriginalHiResImage (name, exactBuffer, 0x2000);
System.out.printf ("FOT %02X%n", exactBuffer[121]);
}
else if (auxType == 0x4000)
{
// packed hi-res
System.out.println ("FOT - packed hi res");
file = new DefaultAppleFile (name, exactBuffer);
}
else if (auxType == 0x4001)
{
// packed double hi-res
System.out.println ("FOT - double hi res");
file = new DefaultAppleFile (name, exactBuffer);
}
else else
{ {
System.out.println ("Unwritten FOT: " + name);
file = new DefaultAppleFile (name, exactBuffer); file = new DefaultAppleFile (name, exactBuffer);
// file =
// new OriginalHiResImage (name, exactBuffer, fileType, auxType, endOfFile);
} }
break; break;

View File

@ -337,14 +337,14 @@ public class HexFormatter
public static int intValue (byte b1, byte b2) public static int intValue (byte b1, byte b2)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
return (b1 & 0xFF) + (b2 & 0xFF) * 256; return (b1 & 0xFF) | ((b2 & 0xFF) << 8);
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public static int intValue (byte b1, byte b2, byte b3) public static int intValue (byte b1, byte b2, byte b3)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
return (b1 & 0xFF) + (b2 & 0xFF) * 256 + (b3 & 0xFF) * 65536; return (b1 & 0xFF) | ((b2 & 0xFF) << 8) | ((b3 & 0xFF) << 16);
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
@ -360,14 +360,6 @@ public class HexFormatter
return val; return val;
} }
// ---------------------------------------------------------------------------------//
public static int signedLong (byte[] buffer, int ptr)
// ---------------------------------------------------------------------------------//
{
return (((buffer[ptr] & 0xFF) << 24) | ((buffer[ptr] & 0xFF) << 16)
| ((buffer[ptr] & 0xFF) << 8) | (buffer[ptr + 1] & 0xFF));
}
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public static int getLongBigEndian (byte[] buffer, int ptr) public static int getLongBigEndian (byte[] buffer, int ptr)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//