mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-02 22:32:45 +00:00
CPM fixes
This commit is contained in:
parent
7d162a4baf
commit
5e053872a9
@ -26,6 +26,7 @@ public class PascalText extends TextFile
|
||||
++ptr;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (buffer[ptr] == 0x10)
|
||||
{
|
||||
int tab = buffer[ptr + 1] - 0x20;
|
||||
@ -33,6 +34,7 @@ public class PascalText extends TextFile
|
||||
text.append (" ");
|
||||
ptr += 2;
|
||||
}
|
||||
|
||||
String line = getLine (ptr);
|
||||
text.append (line + "\n");
|
||||
ptr += line.length () + 1;
|
||||
@ -49,8 +51,10 @@ public class PascalText extends TextFile
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
StringBuilder line = new StringBuilder ();
|
||||
|
||||
while (buffer[ptr] != 0x0D)
|
||||
line.append ((char) buffer[ptr++]);
|
||||
|
||||
return line.toString ();
|
||||
}
|
||||
}
|
@ -50,8 +50,14 @@ class CPMCatalogSector extends AbstractSector
|
||||
extra = "";
|
||||
}
|
||||
|
||||
addText (text, buffer, i, 1, "User number");
|
||||
addText (text, buffer, i + 1, 4, "File name : " + new String (buffer, i + 1, 8));
|
||||
if (buffer[i] == (byte) 0xE5)
|
||||
addText (text, buffer, i, 1, "Deleted file?");
|
||||
else
|
||||
addText (text, buffer, i, 1, "User number");
|
||||
if (buffer[i + 1] == 0)
|
||||
addText (text, buffer, i + 1, 4, "File name : ");
|
||||
else
|
||||
addText (text, buffer, i + 1, 4, "File name : " + new String (buffer, i + 1, 8));
|
||||
addText (text, buffer, i + 5, 4, "");
|
||||
addText (text, buffer, i + 9, 3, "File type : " + type + extra);
|
||||
addText (text, buffer, i + 12, 1, "Extent counter LO");
|
||||
|
@ -80,7 +80,7 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||
int b1 = buffer[0] & 0xFF;
|
||||
int b2 = buffer[1] & 0xFF;
|
||||
|
||||
if (b1 == EMPTY_BYTE_VALUE && b2 == EMPTY_BYTE_VALUE)
|
||||
if (b1 == EMPTY_BYTE_VALUE && (b2 == EMPTY_BYTE_VALUE || b2 == 0))
|
||||
continue;
|
||||
|
||||
if (b1 > 31 && b1 != EMPTY_BYTE_VALUE)
|
||||
@ -233,21 +233,54 @@ public class CPMDisk extends AbstractFormattedDisk
|
||||
if (bufferContainsAll (buffer, (byte) EMPTY_BYTE_VALUE))
|
||||
break;
|
||||
|
||||
int b1 = buffer[0] & 0xFF;
|
||||
int b2 = buffer[1] & 0xFF;
|
||||
|
||||
if (b1 == EMPTY_BYTE_VALUE && (b2 == EMPTY_BYTE_VALUE || b2 == 0))
|
||||
continue;
|
||||
|
||||
if (b1 > 31 && b1 != EMPTY_BYTE_VALUE)
|
||||
break;
|
||||
|
||||
if (b2 < 32 || (b2 > 126 && b2 != EMPTY_BYTE_VALUE))
|
||||
break;
|
||||
|
||||
for (int i = 0; i < buffer.length; i += 32)
|
||||
{
|
||||
int val = buffer[i] & 0xFF;
|
||||
if (val == EMPTY_BYTE_VALUE)
|
||||
break;
|
||||
b1 = buffer[i] & 0xFF;
|
||||
b2 = buffer[i + 1] & 0xFF;
|
||||
|
||||
if (val > 31)
|
||||
if (b1 == EMPTY_BYTE_VALUE) // deleted file??
|
||||
continue;
|
||||
|
||||
if (b2 < 32 || (b2 > 126 && b2 != EMPTY_BYTE_VALUE))
|
||||
return false;
|
||||
|
||||
for (int j = 1; j <= 8; j++)
|
||||
{
|
||||
val = buffer[i + j] & 0xFF;
|
||||
if (val < 32 || (val > 126 && val != EMPTY_BYTE_VALUE))
|
||||
return false;
|
||||
}
|
||||
// int val = buffer[i] & 0xFF;
|
||||
// if (val == EMPTY_BYTE_VALUE)
|
||||
// {
|
||||
// if (debug)
|
||||
// System.out.println ("empty value found - deleted file?");
|
||||
// break;
|
||||
// }
|
||||
|
||||
// if (val > 31)
|
||||
// {
|
||||
// if (debug)
|
||||
// System.out.println ("val > 31");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// for (int j = 1; j <= 8; j++)
|
||||
// {
|
||||
// val = buffer[i + j] & 0xFF;
|
||||
// if (val < 32 || (val > 126 && val != EMPTY_BYTE_VALUE))
|
||||
// {
|
||||
// if (debug)
|
||||
// System.out.println ("val < 32 || val > 126");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,10 @@ class DirectoryEntry implements AppleFileSource
|
||||
type = new String (typeBuffer).trim ();
|
||||
|
||||
userNumber = buffer[offset] & 0xFF;
|
||||
name = new String (buffer, offset + 1, 8).trim ();
|
||||
if (userNumber == 0xE5 && buffer[offset + 1] == 0)
|
||||
name = "";
|
||||
else
|
||||
name = new String (buffer, offset + 1, 8).trim ();
|
||||
extent = buffer[offset + 12] & 0xFF;
|
||||
s2 = buffer[offset + 13] & 0xFF;
|
||||
s1 = buffer[offset + 14] & 0xFF;
|
||||
@ -120,6 +123,7 @@ class DirectoryEntry implements AppleFileSource
|
||||
for (DiskAddress sector : blocks)
|
||||
if (sector.matches (da))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user