tools.disassembly
Class Disassembler

java.lang.Object
  extended by tools.disassembly.Disassembler

public class Disassembler
extends java.lang.Object

This class manages the conversion of binary data into disassembly.


Constructor Summary
Disassembler()
           
 
Method Summary
static java.lang.String getDisassembly(int address, int[] data, Opcode opcode, java.util.List<OpcodeParamFieldReplaceInfo> replacements, java.lang.String[] resultMnemonics, int fieldPadding)
          This method returns the disassembly mnemonic for the given run of data.
static java.util.List<CodeLine> getDisassemblyOpcodes(Processor processor, int[] binary, int origin)
          This function disassembles the binary data into a list of opcodes.
static void main(java.lang.String[] args)
          This tool disassembles a binary file into text opcodes for a target processor.
static void printDisassembly(java.util.List<CodeLine> lines, java.lang.String cpu, java.lang.String[] mnemonicSets, boolean commentOverride)
          This function prints the disassembly of a list of code lines in the given mnemonic set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Disassembler

public Disassembler()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This tool disassembles a binary file into text opcodes for a target processor. Command line arguments: binFile cpu [start] [end] [resultMnemonic] The 'binFile' is a list of ROM files each with a given origin. For instance: 0x0000~invaders.h+invaders.g+invaders.f+invaders.e This puts the four Space Invaders ROM files together in order. The first file is given the origin "0x0000" and the others follow right behind it. The 'cpu' is the CPU that runs the code. The 'start' and 'end' are optional starting and ending points in the disassembly ROM data. If 'start' is not given then the first address is used. If 'end' is not given the the last address is used. Leave both out to disassemble the entire binary collection. The 'resultMnemonic' gives the output menonic set for the opcodes. The default is to use the same CPU as the 'cpu' value. Most of the time this is exactly what you want to do. But this is useful if you want to disassemble cpu=8080 code but output the mnemonics as resultCPU=Z80. If you used cpu=Z80 then you would get Z80 mnemonics in the output in data sections. Once a file has been disassembled to text then it can be annotated and run through ReDiss to change the mnemonic set(s) and spacing.

Parameters:
args - see above
Throws:
java.lang.Exception - errors opening files

getDisassemblyOpcodes

public static java.util.List<CodeLine> getDisassemblyOpcodes(Processor processor,
                                                             int[] binary,
                                                             int origin)
This function disassembles the binary data into a list of opcodes.

Parameters:
processor - the target processor
binary - the binary data
origin - the origin of the first location of the data
Returns:
the disassembled opcodes

getDisassembly

public static java.lang.String getDisassembly(int address,
                                              int[] data,
                                              Opcode opcode,
                                              java.util.List<OpcodeParamFieldReplaceInfo> replacements,
                                              java.lang.String[] resultMnemonics,
                                              int fieldPadding)
This method returns the disassembly mnemonic for the given run of data. The field is padded to the visible length (certain substituted fields may contribute invisible (HTML markup) text.

Parameters:
address - the memory address of this data (needed for relative destinations
data - the opcode data bytes
opcode - the opcode information
replacements - list of any substitution labels into the mnemonic text (or null for pure numeric values)
resultMnemonics - the mnemonics set names to generate in order (within the processor family)
fieldPadding - the mnemonic field spacing override. Use 0 for the default.

printDisassembly

public static void printDisassembly(java.util.List<CodeLine> lines,
                                    java.lang.String cpu,
                                    java.lang.String[] mnemonicSets,
                                    boolean commentOverride)
This function prints the disassembly of a list of code lines in the given mnemonic set.

Parameters:
lines - the list of lines
mnemonicSets - the name of the mnemonic sets to output (in order)
commentOverride - true will always add a comment, even if it is blank