mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-23 19:31:00 +00:00
some CPM
This commit is contained in:
parent
ec1472d13e
commit
71e94c61ba
@ -3,7 +3,6 @@ package com.bytezone.diskbrowser.cpm;
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.HexFormatter;
|
||||
import com.bytezone.diskbrowser.applefile.BootSector;
|
||||
import com.bytezone.diskbrowser.disk.AbstractFormattedDisk;
|
||||
import com.bytezone.diskbrowser.disk.AppleDisk;
|
||||
@ -53,10 +52,11 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||
return false;
|
||||
if (buffer[i] == 0)
|
||||
{
|
||||
String filename = HexFormatter.getString (buffer, i + 1, 8);
|
||||
String filetype = HexFormatter.getString (buffer, i + 9, 3);
|
||||
String bytes = HexFormatter.getHexString (buffer, i + 12, 20);
|
||||
System.out.println (filename + " " + filetype + " " + bytes);
|
||||
// String filename = HexFormatter.getString (buffer, i + 1, 8);
|
||||
// String filetype = HexFormatter.getString (buffer, i + 9, 3);
|
||||
// String bytes = HexFormatter.getHexString (buffer, i + 12, 20);
|
||||
// System.out.println (filename + " " + filetype + " " + bytes);
|
||||
System.out.println (new DirectoryEntry (buffer, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
48
src/com/bytezone/diskbrowser/cpm/DirectoryEntry.java
Normal file
48
src/com/bytezone/diskbrowser/cpm/DirectoryEntry.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.bytezone.diskbrowser.cpm;
|
||||
|
||||
import com.bytezone.diskbrowser.HexFormatter;
|
||||
|
||||
public class DirectoryEntry
|
||||
{
|
||||
private final int userNumber;
|
||||
private final String name;
|
||||
private final String type;
|
||||
private final int ex;
|
||||
private final int s1;
|
||||
private final int s2;
|
||||
private final int rc;
|
||||
private final byte[] blockList = new byte[16];
|
||||
|
||||
public DirectoryEntry (byte[] buffer, int offset)
|
||||
{
|
||||
userNumber = buffer[offset] & 0xFF;
|
||||
name = new String (buffer, offset + 1, 8).trim ();
|
||||
type = new String (buffer, offset + 9, 3).trim ();
|
||||
ex = buffer[offset + 12] & 0xFF;
|
||||
s2 = buffer[offset + 13] & 0xFF;
|
||||
s1 = buffer[offset + 14] & 0xFF;
|
||||
rc = buffer[offset + 15] & 0xFF;
|
||||
System.arraycopy (buffer, offset + 16, blockList, 0, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString ()
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append (String.format ("User number .... %d%n", userNumber));
|
||||
text.append (String.format ("File name ...... %s%n", name + "." + type));
|
||||
// text.append (String.format ("File type ...... %s%n", type));
|
||||
text.append (String.format ("Extents lo ..... %d%n", ex));
|
||||
text.append (String.format ("Extents hi ..... %d%n", s2));
|
||||
text.append (String.format ("Reserved ....... %d%n", s1));
|
||||
|
||||
int blocks = ((rc & 0xF0) >> 3) + (((rc & 0x0F) + 7) / 8);
|
||||
text.append (String.format ("Records ........ %02X (%d)%n", rc, blocks));
|
||||
text.append (String
|
||||
.format ("Allocation ..... %s%n",
|
||||
HexFormatter.formatNoHeader (blockList, 0, 16).subSequence (8, 55)));
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ import com.bytezone.diskbrowser.wizardry.WizardryScenarioDisk;
|
||||
|
||||
public class DiskFactory
|
||||
{
|
||||
private static boolean debug = false;
|
||||
private static boolean debug = true;
|
||||
|
||||
private DiskFactory ()
|
||||
{
|
||||
@ -178,9 +178,12 @@ public class DiskFactory
|
||||
else if (checksum == 3028642627L || checksum == 2070151659L)
|
||||
disk = checkInfocomDisk (file);
|
||||
|
||||
else if (checksum == 1212926910L || checksum == 1365043894L)
|
||||
else if (checksum == 1212926910L || checksum == 1365043894L
|
||||
|| checksum == 2128073918L)
|
||||
disk = checkCPMDisk (file);
|
||||
|
||||
// System.out.println (checksum);
|
||||
|
||||
if (disk != null)
|
||||
{
|
||||
if (compressed)
|
||||
|
Loading…
Reference in New Issue
Block a user