mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-14 07:30:01 +00:00
bug fixes
This commit is contained in:
parent
e1811f8fbe
commit
ed137b5731
@ -1,64 +1,64 @@
|
||||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
public interface ApplesoftConstants
|
||||
{
|
||||
String[] tokens = { //
|
||||
"END ", "FOR ", "NEXT ", "DATA ", // 0x80 - 0x83
|
||||
"INPUT ", "DEL ", "DIM ", "READ ", // 0x84 - 0x87
|
||||
"GR ", "TEXT ", "PR# ", "IN# ", // 0x88 - 0x8B
|
||||
"CALL ", "PLOT ", "HLIN ", "VLIN ", // 0x8C - 0x8F
|
||||
"HGR2", "HGR", "HCOLOR=", "HPLOT ", // 0x90
|
||||
"DRAW ", "XDRAW ", "HTAB ", "HOME ", // 0x94
|
||||
"ROT=", "SCALE=", "SHLOAD ", "TRACE ", // 0x98
|
||||
"NOTRACE ", "NORMAL ", "INVERSE ", "FLASH ", // 0x9C
|
||||
"COLOR=", "POP ", "VTAB ", "HIMEM:", // 0xA0
|
||||
"LOMEM:", "ONERR ", "RESUME", "RECALL ", // 0xA4 - 0xA7
|
||||
"STORE ", "SPEED=", "LET ", "GOTO ", // 0xA8
|
||||
"RUN ", "IF ", "RESTORE ", "& ", // 0xAC
|
||||
"GOSUB ", "RETURN ", "REM ", "STOP ", // 0xB0
|
||||
"ON ", "WAIT ", "LOAD ", "SAVE ", // 0xB4
|
||||
"DEF", "POKE ", "PRINT ", "CONT", // 0xB8
|
||||
"LIST ", "CLEAR ", "GET ", "NEW ", // 0xBC
|
||||
"TAB(", "TO ", "FN ", "SPC(", // 0xC0
|
||||
"THEN ", "AT ", "NOT ", "STEP ", // 0xC4
|
||||
"+ ", "- ", "* ", "/ ", // 0xC8
|
||||
"^ ", "AND ", "OR ", "> ", // 0xCC
|
||||
"= ", "< ", "SGN ", "INT ", // 0xD0
|
||||
"ABS ", "USR", "FRE ", "SCRN(", // 0xD4
|
||||
"PDL ", "POS ", "SQR ", "RND ", // 0xD8
|
||||
"LOG ", "EXP ", "COS ", "SIN ", // 0xDC
|
||||
"TAN ", "ATN ", "PEEK ", "LEN ", // 0xE0 - 0xE3
|
||||
"STR$ ", "VAL ", "ASC ", "CHR$ ", // 0xE4 - 0xE7
|
||||
"LEFT$ ", "RIGHT$ ", "MID$ ", "", // 0xE8 - 0xEB
|
||||
"", "", "", "", // 0xEC - 0xEF
|
||||
"ELSE", "MOD", "INC", "DEC", // 0xF0 - 0xF3
|
||||
"DEEK", "DOKE", "REPEAT", "UNTIL", // 0xF4 - 0xF7
|
||||
"", "", "", "", // 0xF8 - 0xFB
|
||||
"", "", "", "", // 0xFC - 0xFF
|
||||
};
|
||||
|
||||
int[] tokenAddresses =
|
||||
{ 0xD870, 0xD766, 0xDCF9, 0xD995, 0xDBB2, 0xF331, 0xDFD9, 0xDBE2, 0xF390, 0xF399,
|
||||
0xF1E5, 0xF1DE, 0xF1D5, 0xF225, 0xF232, 0xF241, 0xF3D8, 0xF3E2, 0xF6E9, 0xF6FE,
|
||||
0xF769, 0xF76F, 0xF7E7, 0xFC58, 0xF721, 0xF727, 0xF775, 0xF26D, 0xF26F, 0xF273,
|
||||
0xF277, 0xF280, 0xF24F, 0xD96B, 0xF256, 0xF286, 0xF2A6, 0xF2CB, 0xF318, 0xF3BC,
|
||||
0xF39F, 0xF262, 0xDA46, 0xD93E, 0xD912, 0xD9C9, 0xD849, 0x03F5, 0xD921, 0xD96B,
|
||||
0xD9DC, 0xD86E, 0xD9EC, 0xE784, 0xD8C9, 0xD8B0, 0xE313, 0xE77B, 0xDAD5, 0xD896,
|
||||
0xD6A5, 0xD66A, 0xDBA0, 0xD649, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xEB90, 0xEC23, 0xEBAF, 0x000A, 0xE2DE,
|
||||
0xD412, 0xDFCD, 0xE2FF, 0xEE8D, 0xEFAE, 0xE941, 0xEF09, 0xEFEA, 0xEFF1, 0xF03A,
|
||||
0xF09E, 0xE764, 0xE6D6, 0xE3C5, 0xE707, 0xE6E5, 0xE646, 0xE65A, 0xE686, 0xE691 };
|
||||
}
|
||||
|
||||
/*
|
||||
https://groups.google.com/forum/#!topic/comp.sys.apple2/_lQ2-l9i5cw
|
||||
NEW Applesoft tokens
|
||||
$F0 - ELSE
|
||||
$F1 - MOD
|
||||
$F2 - INC - as in Increment, so instead of A=A+1: use INC A
|
||||
$F3 - DEC - opposite of INC
|
||||
$F4 - DEEK - two-byte PEEK
|
||||
$F5 - DOKE - two-byte POKE
|
||||
$F6 - REPEAT
|
||||
$F7 - UNTIL
|
||||
*/
|
||||
package com.bytezone.diskbrowser.applefile;
|
||||
|
||||
public interface ApplesoftConstants
|
||||
{
|
||||
String[] tokens = { //
|
||||
"END ", "FOR ", "NEXT ", "DATA ", // 0x80 - 0x83
|
||||
"INPUT ", "DEL ", "DIM ", "READ ", // 0x84 - 0x87
|
||||
"GR ", "TEXT ", "PR# ", "IN# ", // 0x88 - 0x8B
|
||||
"CALL ", "PLOT ", "HLIN ", "VLIN ", // 0x8C - 0x8F
|
||||
"HGR2", "HGR", "HCOLOR=", "HPLOT ", // 0x90
|
||||
"DRAW ", "XDRAW ", "HTAB ", "HOME ", // 0x94
|
||||
"ROT=", "SCALE=", "SHLOAD ", "TRACE ", // 0x98
|
||||
"NOTRACE ", "NORMAL ", "INVERSE ", "FLASH ", // 0x9C
|
||||
"COLOR=", "POP ", "VTAB ", "HIMEM:", // 0xA0
|
||||
"LOMEM:", "ONERR ", "RESUME", "RECALL ", // 0xA4 - 0xA7
|
||||
"STORE ", "SPEED=", "LET ", "GOTO ", // 0xA8
|
||||
"RUN ", "IF ", "RESTORE ", "&", // 0xAC
|
||||
"GOSUB ", "RETURN ", "REM ", "STOP ", // 0xB0
|
||||
"ON ", "WAIT ", "LOAD ", "SAVE ", // 0xB4
|
||||
"DEF", "POKE ", "PRINT ", "CONT", // 0xB8
|
||||
"LIST ", "CLEAR ", "GET ", "NEW ", // 0xBC
|
||||
"TAB(", "TO ", "FN ", "SPC(", // 0xC0
|
||||
"THEN ", "AT ", "NOT ", "STEP ", // 0xC4
|
||||
"+ ", "- ", "* ", "/ ", // 0xC8
|
||||
"^ ", "AND ", "OR ", "> ", // 0xCC
|
||||
"= ", "< ", "SGN ", "INT ", // 0xD0
|
||||
"ABS ", "USR", "FRE ", "SCRN(", // 0xD4
|
||||
"PDL ", "POS ", "SQR ", "RND ", // 0xD8
|
||||
"LOG ", "EXP ", "COS ", "SIN ", // 0xDC
|
||||
"TAN ", "ATN ", "PEEK ", "LEN ", // 0xE0 - 0xE3
|
||||
"STR$ ", "VAL ", "ASC ", "CHR$ ", // 0xE4 - 0xE7
|
||||
"LEFT$ ", "RIGHT$ ", "MID$ ", "", // 0xE8 - 0xEB
|
||||
"", "", "", "", // 0xEC - 0xEF
|
||||
"ELSE", "MOD", "INC", "DEC", // 0xF0 - 0xF3
|
||||
"DEEK", "DOKE", "REPEAT", "UNTIL", // 0xF4 - 0xF7
|
||||
"", "", "", "", // 0xF8 - 0xFB
|
||||
"", "", "", "", // 0xFC - 0xFF
|
||||
};
|
||||
|
||||
int[] tokenAddresses =
|
||||
{ 0xD870, 0xD766, 0xDCF9, 0xD995, 0xDBB2, 0xF331, 0xDFD9, 0xDBE2, 0xF390, 0xF399,
|
||||
0xF1E5, 0xF1DE, 0xF1D5, 0xF225, 0xF232, 0xF241, 0xF3D8, 0xF3E2, 0xF6E9, 0xF6FE,
|
||||
0xF769, 0xF76F, 0xF7E7, 0xFC58, 0xF721, 0xF727, 0xF775, 0xF26D, 0xF26F, 0xF273,
|
||||
0xF277, 0xF280, 0xF24F, 0xD96B, 0xF256, 0xF286, 0xF2A6, 0xF2CB, 0xF318, 0xF3BC,
|
||||
0xF39F, 0xF262, 0xDA46, 0xD93E, 0xD912, 0xD9C9, 0xD849, 0x03F5, 0xD921, 0xD96B,
|
||||
0xD9DC, 0xD86E, 0xD9EC, 0xE784, 0xD8C9, 0xD8B0, 0xE313, 0xE77B, 0xDAD5, 0xD896,
|
||||
0xD6A5, 0xD66A, 0xDBA0, 0xD649, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xEB90, 0xEC23, 0xEBAF, 0x000A, 0xE2DE,
|
||||
0xD412, 0xDFCD, 0xE2FF, 0xEE8D, 0xEFAE, 0xE941, 0xEF09, 0xEFEA, 0xEFF1, 0xF03A,
|
||||
0xF09E, 0xE764, 0xE6D6, 0xE3C5, 0xE707, 0xE6E5, 0xE646, 0xE65A, 0xE686, 0xE691 };
|
||||
}
|
||||
|
||||
/*
|
||||
https://groups.google.com/forum/#!topic/comp.sys.apple2/_lQ2-l9i5cw
|
||||
NEW Applesoft tokens
|
||||
$F0 - ELSE
|
||||
$F1 - MOD
|
||||
$F2 - INC - as in Increment, so instead of A=A+1: use INC A
|
||||
$F3 - DEC - opposite of INC
|
||||
$F4 - DEEK - two-byte PEEK
|
||||
$F5 - DOKE - two-byte POKE
|
||||
$F6 - REPEAT
|
||||
$F7 - UNTIL
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ import com.bytezone.diskbrowser.wizardry.WizardryScenarioDisk;
|
||||
public class DiskFactory
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static boolean debug = false;
|
||||
private static boolean debug = true;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private DiskFactory ()
|
||||
@ -199,7 +199,9 @@ public class DiskFactory
|
||||
return new DataDisk (appleDisk);
|
||||
}
|
||||
|
||||
if (((suffix.equals ("po") || suffix.equals ("dsk")) && file.length () > 143360))
|
||||
// Toolkit.do = 143488
|
||||
if (((suffix.equals ("po") || suffix.equals ("dsk") || suffix.equals ("do"))
|
||||
&& file.length () > 143360))
|
||||
{
|
||||
if (file.length () < 143500) // slightly bigger than a floppy
|
||||
{
|
||||
@ -359,7 +361,7 @@ public class DiskFactory
|
||||
System.out.println (" empty sector checksum : " + checksum);
|
||||
}
|
||||
else if (checksum == 3176296590L //
|
||||
|| checksum == 108825457L //
|
||||
|| checksum == 108825457L // ARCBOOT.DSK (looping)
|
||||
|| checksum == 1439356606L //
|
||||
|| checksum == 1550012074L //
|
||||
|| checksum == 1614602459L //
|
||||
|
@ -42,7 +42,7 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
|
||||
protected List<AppleFileSource> deletedFileEntries = new ArrayList<> ();
|
||||
|
||||
private static boolean debug = false;
|
||||
private static boolean debug = true;
|
||||
|
||||
enum FileType
|
||||
{
|
||||
@ -82,9 +82,11 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
DiskAddress catalogStart = disk.getDiskAddress (sectorBuffer[1], sectorBuffer[2]);
|
||||
|
||||
if (dosVTOCSector.sectorSize != disk.getBlockSize ())
|
||||
System.out.println ("Invalid sector size : " + dosVTOCSector.sectorSize);
|
||||
System.out.printf ("%s - invalid sector size : %d%n", disk.getFile ().getName (),
|
||||
dosVTOCSector.sectorSize);
|
||||
if (dosVTOCSector.maxSectors != disk.getSectorsPerTrack ())
|
||||
System.out.println ("Invalid sectors per track : " + dosVTOCSector.maxSectors);
|
||||
System.out.printf ("%s - invalid sectors per track : %d%n",
|
||||
disk.getFile ().getName (), dosVTOCSector.maxSectors);
|
||||
|
||||
// sectorTypes[CATALOG_TRACK * dosVTOCSector.maxSectors] = vtocSector;
|
||||
|
||||
@ -269,9 +271,9 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
public static boolean isCorrectFormat (AppleDisk disk)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (false)
|
||||
if (false) // testing
|
||||
{
|
||||
disk.setInterleave (2);
|
||||
disk.setInterleave (1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -279,27 +281,31 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
return false;
|
||||
|
||||
int[] cb = new int[3];
|
||||
int best = 0;
|
||||
int il = -1;
|
||||
|
||||
for (int interleave = 0; interleave < 3; interleave++)
|
||||
{
|
||||
if (debug)
|
||||
System.out.printf ("Checking interleave %d%n", interleave);
|
||||
|
||||
disk.setInterleave (interleave);
|
||||
cb[interleave] = checkFormat (disk);
|
||||
if (cb[interleave] > 3)
|
||||
if (cb[interleave] >= 15)
|
||||
return true;
|
||||
|
||||
if (cb[interleave] > best)
|
||||
{
|
||||
best = cb[interleave];
|
||||
il = interleave;
|
||||
}
|
||||
}
|
||||
|
||||
for (int max = 2; max > 0; max--)
|
||||
for (int interleave = 0; interleave < 3; interleave++)
|
||||
{
|
||||
if (cb[interleave] >= max)
|
||||
{
|
||||
disk.setInterleave (interleave);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (best == 0)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
disk.setInterleave (il);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -347,7 +353,8 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
|
||||
if (buffer[53] != 16 && buffer[53] != 13 && buffer[53] != 32) // sectors per track
|
||||
{
|
||||
System.out.printf ("Bad sectors per track : %02X%n", buffer[53]);
|
||||
if (debug)
|
||||
System.out.printf ("Bad sectors per track : %02X%n", buffer[53]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -394,9 +401,10 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (catalogAddresses.contains (da))
|
||||
if (isDuplicate (catalogAddresses, da))
|
||||
{
|
||||
System.out.println ("Catalog looping");
|
||||
if (debug)
|
||||
System.out.println ("Catalog looping");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -419,6 +427,16 @@ public class DosDisk extends AbstractFormattedDisk
|
||||
return catalogAddresses.size ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private static boolean isDuplicate (List<DiskAddress> catalogAddresses, DiskAddress da)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (DiskAddress diskAddress : catalogAddresses)
|
||||
if (diskAddress.getBlock () == da.getBlock ())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@Override
|
||||
public String toString ()
|
||||
|
@ -69,7 +69,15 @@ class DosTSListSector extends AbstractSector
|
||||
StringBuilder text = getHeader ("TS List Sector : " + name);
|
||||
addText (text, buffer, 0, 1, "Not used");
|
||||
addText (text, buffer, 1, 2, "Next TS list track/sector" + msg);
|
||||
addText (text, buffer, 3, 2, "Not used");
|
||||
|
||||
if ((buffer[3] != 0 || buffer[4] != 0) // not supposed to be used
|
||||
// Diags2E.dsk stores its own sector address here
|
||||
&& (diskAddress.getTrack () == (buffer[3] & 0xFF)
|
||||
&& diskAddress.getSector () == (buffer[4] & 0xFF)))
|
||||
addText (text, buffer, 3, 2, "Self-reference");
|
||||
else
|
||||
addText (text, buffer, 3, 2, "Not used");
|
||||
|
||||
addTextAndDecimal (text, buffer, 5, 2, "Sector base number");
|
||||
addText (text, buffer, 7, 4, "Not used");
|
||||
addText (text, buffer, 11, 1, "Not used");
|
||||
|
@ -259,7 +259,7 @@ public class InfocomDisk extends AbstractFormattedDisk
|
||||
int abbreviationsTable = HexFormatter.intValue (buffer[25], buffer[24]);
|
||||
int fileLength = HexFormatter.intValue (buffer[27], buffer[26]);
|
||||
|
||||
if (true)
|
||||
if (false)
|
||||
{
|
||||
System.out.printf ("Version %,6d%n", version);
|
||||
System.out.printf ("Abbreviations %,6d%n", abbreviationsTable);
|
||||
|
Loading…
x
Reference in New Issue
Block a user