hades.models.mips.memory
Class MemoryLoader

java.lang.Object
  extended byhades.models.mips.memory.MemoryLoader

public class MemoryLoader
extends java.lang.Object

The MemoryLoader is able to fill instances with the Memory- interface with the content of *.o, *.hex and *.rom files. The content can be saved in *.rom-Format.


Field Summary
protected  boolean debug
           
protected  MemoryDispatcher dispatch
           
protected  Memory mem
           
static int PHDRMAX
           
static int SHDRMAX
           
 
Constructor Summary
MemoryLoader(Memory newMem)
           
 
Method Summary
 boolean getLog()
           
 int load(java.lang.String name, java.lang.String dir)
          General interface for different formats, returns entry point if defined in object file or 0
 boolean loadBin(java.io.InputStream bs, int offset)
          Load files with raw data directly into memory.
 int loadElf(java.io.InputStream bs)
          Load ELF-files (no shared libraries).
 boolean loadHex(java.io.InputStream bs)
          Load files containing data in *.hex format.
 boolean loadRom(java.lang.String name, java.lang.String dir)
          Load files containig data in *.rom format.
 void save(java.lang.String name, java.lang.String dir)
          Save memory into a file with *.rom-Format
 void setLog(boolean newDebug)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mem

protected Memory mem

dispatch

protected MemoryDispatcher dispatch

PHDRMAX

public static final int PHDRMAX
See Also:
Constant Field Values

SHDRMAX

public static final int SHDRMAX
See Also:
Constant Field Values

debug

protected boolean debug
Constructor Detail

MemoryLoader

public MemoryLoader(Memory newMem)
Method Detail

save

public void save(java.lang.String name,
                 java.lang.String dir)
Save memory into a file with *.rom-Format


load

public int load(java.lang.String name,
                java.lang.String dir)
General interface for different formats, returns entry point if defined in object file or 0


loadElf

public int loadElf(java.io.InputStream bs)
Load ELF-files (no shared libraries). The value returned is the value for the initial program counter to execute the loaded code. If an error occurs -1 will be returned. If the memory the ELF-file will be loaded to is an instance of a MemoryDispatcher every single ELF-segment will be a new allocated TinyBPMemory dispatched to the right address.


loadHex

public boolean loadHex(java.io.InputStream bs)
Load files containing data in *.hex format. Returns error.


loadBin

public boolean loadBin(java.io.InputStream bs,
                       int offset)
Load files with raw data directly into memory. An offset tells the start of the raw data so this can be used to read different formats. Returns error.


loadRom

public boolean loadRom(java.lang.String name,
                       java.lang.String dir)
Load files containig data in *.rom format. Return error. This does not use the InputStream the calling instance serves because the data in a rom-file is not binary.


setLog

public void setLog(boolean newDebug)

getLog

public boolean getLog()