mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-20 04:29:02 +00:00
c string reader
This commit is contained in:
parent
ca44da4c94
commit
93186f2b6d
@ -4,6 +4,8 @@ import java.awt.image.DataBuffer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
|
|
||||||
// see graffidisk.v1.0.2mg
|
// see graffidisk.v1.0.2mg
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
public class CharacterRom extends CharacterList
|
public class CharacterRom extends CharacterList
|
||||||
@ -22,7 +24,7 @@ public class CharacterRom extends CharacterList
|
|||||||
{
|
{
|
||||||
super (name, buffer, charsX, charsY, HEADER_LENGTH);
|
super (name, buffer, charsX, charsY, HEADER_LENGTH);
|
||||||
|
|
||||||
description = new String (buffer, 16, 16);
|
description = HexFormatter.getCString (buffer, 16);
|
||||||
|
|
||||||
assert sizeX == (buffer[5] & 0xFF);
|
assert sizeX == (buffer[5] & 0xFF);
|
||||||
assert sizeY == (buffer[6] & 0xFF);
|
assert sizeY == (buffer[6] & 0xFF);
|
||||||
@ -35,10 +37,11 @@ public class CharacterRom extends CharacterList
|
|||||||
if (buffer.length != 0x400)
|
if (buffer.length != 0x400)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// no idea what these mean
|
// see CHARROM.S on graffidisk
|
||||||
// BD 41 53 10 A0 07 08
|
// BD 41 53 10 A0 07 08
|
||||||
return buffer[0] == (byte) 0xBD && buffer[1] == (byte) 0x41
|
return buffer[0] == (byte) 0xBD && buffer[1] == (byte) 0x41
|
||||||
&& buffer[2] == (byte) 0x53 && buffer[3] == (byte) 0x10;
|
&& buffer[2] == (byte) 0x53 && buffer[4] == (byte) 0xA0
|
||||||
|
&& buffer[5] == (byte) 0x07 && buffer[6] == (byte) 0x08;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -18,11 +18,11 @@ import com.bytezone.diskbrowser.duplicates.RootFolderData;
|
|||||||
public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitListener
|
public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitListener
|
||||||
// -----------------------------------------------------------------------------------//
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
static long start;
|
// static long start;
|
||||||
static
|
// static
|
||||||
{
|
// {
|
||||||
start = System.currentTimeMillis ();
|
// start = System.currentTimeMillis ();
|
||||||
}
|
// }
|
||||||
private static String[] args;
|
private static String[] args;
|
||||||
private static final String windowTitle = "Apple ][ Disk Browser";
|
private static final String windowTitle = "Apple ][ Disk Browser";
|
||||||
private final Preferences prefs = Preferences.userNodeForPackage (this.getClass ());
|
private final Preferences prefs = Preferences.userNodeForPackage (this.getClass ());
|
||||||
@ -38,7 +38,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
|||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (windowTitle);
|
super (windowTitle);
|
||||||
System.out.printf ("Start Init: %,5d%n", System.currentTimeMillis () - start);
|
// System.out.printf ("Start Init: %,5d%n", System.currentTimeMillis () - start);
|
||||||
|
|
||||||
if (args.length > 0 && "-reset".equals (args[0]))
|
if (args.length > 0 && "-reset".equals (args[0]))
|
||||||
new WindowState (prefs).clear ();
|
new WindowState (prefs).clear ();
|
||||||
@ -185,7 +185,7 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
|
|||||||
|
|
||||||
// activate the highest panel now that the listeners are ready
|
// activate the highest panel now that the listeners are ready
|
||||||
catalogPanel.activate ();
|
catalogPanel.activate ();
|
||||||
System.out.printf ("End Init : %,5d%n", System.currentTimeMillis () - start);
|
// System.out.printf ("End Init : %,5d%n", System.currentTimeMillis () - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -528,4 +528,15 @@ public class HexFormatter
|
|||||||
int length = buffer[offset] & 0xFF;
|
int length = buffer[offset] & 0xFF;
|
||||||
return HexFormatter.getString (buffer, offset + 1, length);
|
return HexFormatter.getString (buffer, offset + 1, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
public static String getCString (byte[] buffer, int offset)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
|
{
|
||||||
|
int end = offset;
|
||||||
|
while (buffer[end] != 0)
|
||||||
|
end++;
|
||||||
|
|
||||||
|
return HexFormatter.getString (buffer, offset, end - offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user