mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-29 11:49:29 +00:00
wiz 4 changes
This commit is contained in:
parent
77aebb3597
commit
85e1f945cd
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.utilities.FileFormatException;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
|
||||
@ -12,7 +11,6 @@ public class PascalCode extends AbstractFile
|
||||
implements PascalConstants, Iterable<PascalSegment>
|
||||
{
|
||||
List<PascalSegment> segments = new ArrayList<PascalSegment> (16);
|
||||
String codeName;
|
||||
String comment;
|
||||
|
||||
public static void print ()
|
||||
@ -28,7 +26,7 @@ public class PascalCode extends AbstractFile
|
||||
int nonameCounter = 0;
|
||||
if (false)
|
||||
{
|
||||
System.out.println (name);
|
||||
// System.out.println (name);
|
||||
// byte[] key = new byte[] { 0x38, 0x00, 0x0C, 0x1C };
|
||||
byte[] key = new byte[] { 0x0F };
|
||||
Utility.find (buffer, key);
|
||||
@ -37,24 +35,15 @@ public class PascalCode extends AbstractFile
|
||||
// Create segment list (up to 16 segments)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
codeName = HexFormatter.getString (buffer, 0x40 + i * 8, 8).trim ();
|
||||
if (codeName.length () == 0)
|
||||
codeName = "<NULL" + nonameCounter++ + ">";
|
||||
String codeName = HexFormatter.getString (buffer, 0x40 + i * 8, 8).trim ();
|
||||
int size = HexFormatter.intValue (buffer[i * 4 + 2], buffer[i * 4 + 3]);
|
||||
if (codeName.length () == 0 && size > 0)
|
||||
codeName = "<NULL" + ++nonameCounter + ">";
|
||||
// System.out.printf ("%s %s %d %n", HexFormatter.getHexString (buffer, i * 4, 4),
|
||||
// codeName, size);
|
||||
if (size > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
segments.add (new PascalSegment (codeName, buffer, i));
|
||||
}
|
||||
catch (FileFormatException e)
|
||||
{
|
||||
System.out.printf ("Bad segment: %d%n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
comment = HexFormatter.getPascalString (buffer, 0x1B0);
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,14 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
|
||||
static
|
||||
{
|
||||
// somehow this should match the data in SYSTEM.RELOC
|
||||
// somehow the offsets should match the data in SYSTEM.RELOC
|
||||
redirections.add (new Redirection ("WIZARDRY", 0x01, 0x1C66, 0x01));
|
||||
redirections.add (new Redirection ("KANJIREA", 0x013F, 0x104E, 0x10));
|
||||
redirections.add (new Redirection ("KANJIREA", 0x3F, 0x104E, 0x10));
|
||||
redirections.add (new Redirection ("UTILITIE", 0x48, 0x1598, 0x19));
|
||||
redirections.add (new Redirection ("SHOPS", 0x53, 0x0BE2, 0x24));
|
||||
redirections.add (new Redirection ("CAMP", 0x70, 0x24CA, 0x2A));
|
||||
redirections.add (new Redirection ("DOCOPY", 0x83, 0x07A0, 0x3D));
|
||||
redirections.add (new Redirection ("DOCACHE", 0x87, 0x072E, 0x41));
|
||||
redirections.add (new Redirection ("SHOPS ", 0x53, 0x0BE2, 0x24));
|
||||
redirections.add (new Redirection ("CAMP ", 0x70, 0x24CA, 0x2A));
|
||||
redirections.add (new Redirection ("DOCOPY ", 0x83, 0x07A0, 0x3D));
|
||||
redirections.add (new Redirection ("DOCACHE ", 0x87, 0x072E, 0x41));
|
||||
}
|
||||
|
||||
public PascalSegment (String name, byte[] fullBuffer, int seq)
|
||||
@ -60,11 +60,18 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
fullBuffer[0xE0 + seq * 2 + 1]);
|
||||
|
||||
// segment 1 is the main segment, 2-6 are used by the system, and 7
|
||||
// onwards is for our program
|
||||
// onwards is for the program
|
||||
this.segmentNoHeader = fullBuffer[0x100 + seq * 2] & 0xFF;
|
||||
int flags = fullBuffer[0x101 + seq * 2] & 0xFF;
|
||||
|
||||
// 0 unknown,
|
||||
// 1 positive byte sex p-code
|
||||
// 2 negative byte sex p-code (apple pascal)
|
||||
// 3-9 6502 code (7 = apple 6502)
|
||||
machineType = flags & 0x0F;
|
||||
|
||||
version = (flags & 0xD0) >> 5;
|
||||
|
||||
intrinsSegs1 = HexFormatter.intValue (fullBuffer[0x120 + seq * 4],
|
||||
fullBuffer[0x120 + seq * 4 + 1]);
|
||||
intrinsSegs2 = HexFormatter.intValue (fullBuffer[0x120 + seq * 4 + 2],
|
||||
@ -172,6 +179,7 @@ public class PascalSegment extends AbstractFile implements PascalConstants
|
||||
for (PascalProcedure procedure : procedures)
|
||||
if (procedure.valid)
|
||||
text.append (procedure);
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
}
|
||||
@ -185,7 +193,7 @@ class Redirection
|
||||
|
||||
public Redirection (String name, int oldOffset, int length, int newOffset)
|
||||
{
|
||||
this.name = name;
|
||||
this.name = name.trim ();
|
||||
this.oldOffset = oldOffset;
|
||||
this.newOffset = newOffset;
|
||||
this.length = length;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.bytezone.diskbrowser.pascal;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.*;
|
||||
import com.bytezone.diskbrowser.utilities.FileFormatException;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
|
||||
class FileEntry extends CatalogEntry
|
||||
@ -63,11 +64,18 @@ class FileEntry extends CatalogEntry
|
||||
|
||||
switch (fileType)
|
||||
{
|
||||
case 2:
|
||||
case 2: // code (6502 or Pascal)
|
||||
try
|
||||
{
|
||||
file = new PascalCode (name, buffer);
|
||||
}
|
||||
catch (FileFormatException e)
|
||||
{
|
||||
if (name.equals ("SYSTEM.INTERP"))
|
||||
file = new AssemblerProgram (name, buffer, 0xD000);
|
||||
else
|
||||
file = new PascalCode (name, buffer);
|
||||
file = new AssemblerProgram (name, buffer, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
Loading…
Reference in New Issue
Block a user