mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-28 06:30:08 +00:00
added header underlines
This commit is contained in:
parent
147f7e03f2
commit
600c3a5ce2
@ -13,7 +13,9 @@ import com.bytezone.diskbrowser.gui.AssemblerPreferences;
|
|||||||
import com.bytezone.diskbrowser.gui.DiskBrowser;
|
import com.bytezone.diskbrowser.gui.DiskBrowser;
|
||||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
public class AssemblerProgram extends AbstractFile
|
public class AssemblerProgram extends AbstractFile
|
||||||
|
// -----------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
static AssemblerPreferences assemblerPreferences; // set by MenuHandler
|
static AssemblerPreferences assemblerPreferences; // set by MenuHandler
|
||||||
|
|
||||||
@ -27,12 +29,16 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
private List<Integer> entryPoints;
|
private List<Integer> entryPoints;
|
||||||
private List<StringLocation> stringLocations;
|
private List<StringLocation> stringLocations;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public static void setAssemblerPreferences (AssemblerPreferences assemblerPreferences)
|
public static void setAssemblerPreferences (AssemblerPreferences assemblerPreferences)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
AssemblerProgram.assemblerPreferences = assemblerPreferences;
|
AssemblerProgram.assemblerPreferences = assemblerPreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public AssemblerProgram (String name, byte[] buffer, int address)
|
public AssemblerProgram (String name, byte[] buffer, int address)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
super (name, buffer);
|
super (name, buffer);
|
||||||
this.loadAddress = address;
|
this.loadAddress = address;
|
||||||
@ -43,13 +49,17 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
// AssemblerBlocks assemblerBlocks = new AssemblerBlocks (buffer, address);
|
// AssemblerBlocks assemblerBlocks = new AssemblerBlocks (buffer, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public AssemblerProgram (String name, byte[] buffer, int address, int executeOffset)
|
public AssemblerProgram (String name, byte[] buffer, int address, int executeOffset)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
this (name, buffer, address);
|
this (name, buffer, address);
|
||||||
this.executeOffset = executeOffset;
|
this.executeOffset = executeOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
public void setExtraBuffer (byte[] fullBuffer, int offset, int length)
|
public void setExtraBuffer (byte[] fullBuffer, int offset, int length)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (length >= 0)
|
if (length >= 0)
|
||||||
{
|
{
|
||||||
@ -60,8 +70,10 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
System.out.println ("Invalid length in setExtraBuffer() : " + length);
|
System.out.println ("Invalid length in setExtraBuffer() : " + length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getHexDump ()
|
public String getHexDump ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
// It might be useful to add opt-O to change the offset. Sometimes it's useful
|
// It might be useful to add opt-O to change the offset. Sometimes it's useful
|
||||||
// to see the hex dump offset from zero, other times it's better to use the
|
// to see the hex dump offset from zero, other times it's better to use the
|
||||||
@ -75,8 +87,10 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
.format (extraBuffer, 0, extraBuffer.length, loadAddress + buffer.length);
|
.format (extraBuffer, 0, extraBuffer.length, loadAddress + buffer.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getAssembler ()
|
public String getAssembler ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
return "No buffer";
|
return "No buffer";
|
||||||
@ -94,7 +108,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
return assembler.getText () + "\n\n" + assemblerProgram.getText ();
|
return assembler.getText () + "\n\n" + assemblerProgram.getText ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private void addHeader (StringBuilder pgm)
|
private void addHeader (StringBuilder pgm)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
pgm.append (String.format ("Name : %s%n", name));
|
pgm.append (String.format ("Name : %s%n", name));
|
||||||
pgm.append (String.format ("Length : $%04X (%,d)%n", buffer.length, buffer.length));
|
pgm.append (String.format ("Length : $%04X (%,d)%n", buffer.length, buffer.length));
|
||||||
@ -105,8 +121,10 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
pgm.append ("\n");
|
pgm.append ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
@Override
|
@Override
|
||||||
public String getText ()
|
public String getText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder pgm = new StringBuilder ();
|
StringBuilder pgm = new StringBuilder ();
|
||||||
|
|
||||||
@ -121,7 +139,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
return pgm.toString ();
|
return pgm.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private String getListing ()
|
private String getListing ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
StringBuilder pgm = new StringBuilder ();
|
StringBuilder pgm = new StringBuilder ();
|
||||||
|
|
||||||
@ -199,7 +219,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private List<AssemblerStatement> getLines ()
|
private List<AssemblerStatement> getLines ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
List<AssemblerStatement> lines = new ArrayList<> ();
|
List<AssemblerStatement> lines = new ArrayList<> ();
|
||||||
Map<Integer, AssemblerStatement> linesMap = new HashMap<> ();
|
Map<Integer, AssemblerStatement> linesMap = new HashMap<> ();
|
||||||
@ -245,7 +267,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private String getStringsText ()
|
private String getStringsText ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
if (stringLocations.size () == 0)
|
if (stringLocations.size () == 0)
|
||||||
return "";
|
return "";
|
||||||
@ -265,7 +289,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
return text.toString ();
|
return text.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private void getStrings ()
|
private void getStrings ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
entryPoints = new ArrayList<> ();
|
entryPoints = new ArrayList<> ();
|
||||||
stringLocations = new ArrayList<> ();
|
stringLocations = new ArrayList<> ();
|
||||||
@ -298,7 +324,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private String getArrow (AssemblerStatement cmd)
|
private String getArrow (AssemblerStatement cmd)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
String arrow = "";
|
String arrow = "";
|
||||||
|
|
||||||
@ -317,13 +345,17 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
return arrow;
|
return arrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private boolean isLocal (int target)
|
private boolean isLocal (int target)
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
return target >= loadAddress
|
return target >= loadAddress
|
||||||
&& target < loadAddress + buffer.length + extraBuffer.length;
|
&& target < loadAddress + buffer.length + extraBuffer.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
private void getEquates ()
|
private void getEquates ()
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
equates = new HashMap<Integer, String> ();
|
equates = new HashMap<Integer, String> ();
|
||||||
DataInputStream inputEquates =
|
DataInputStream inputEquates =
|
||||||
@ -353,7 +385,9 @@ public class AssemblerProgram extends AbstractFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
class StringLocation
|
class StringLocation
|
||||||
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
byte hi, lo;
|
byte hi, lo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user