com.github.croesch.micro_debug.mic1.controlstore
Class MicroControlStore

java.lang.Object
  extended by com.github.croesch.micro_debug.commons.AbstractCodeContainer
      extended by com.github.croesch.micro_debug.mic1.controlstore.MicroControlStore

public final class MicroControlStore
extends AbstractCodeContainer

The store for MicroInstructions.

Since:
Date: Nov 19, 2011
Author:
croesch

Constructor Summary
MicroControlStore(InputStream in)
          Constructs a MicroControlStore with the MicroInstruction fetched from the given stream.
 
Method Summary
protected  int getFirstPossibleCodeAddress()
          Returns the address where the first possible code is stored.
 MicroInstruction getInstruction(int mpc)
          Returns the instruction from the store that is stored under the given mpc (address).
protected  int getLastPossibleCodeAddress()
          Returns the address where the last possible code is stored.
protected  int printCodeLine(int i)
          Prints the line with the given number to the user.
 
Methods inherited from class com.github.croesch.micro_debug.commons.AbstractCodeContainer
formatIntToHex, printCode, printCode, printCodeAroundLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MicroControlStore

public MicroControlStore(InputStream in)
                  throws FileFormatException
Constructs a MicroControlStore with the MicroInstruction fetched from the given stream. If the magic number is incorrect, or if there are too few or too many bytes to read, a FileFormatException will be thrown.

Parameters:
in - the stream to read the instructions from
Throws:
FileFormatException - if
  • the stream does only contain less or equal than four bytes
  • the magic number isn't correct
  • the stream contains too much data
  • an IOException occurs
Since:
Date: Nov 19, 2011
Method Detail

getInstruction

public MicroInstruction getInstruction(int mpc)
Returns the instruction from the store that is stored under the given mpc (address).

Parameters:
mpc - the address of the instruction to fetch - only the least nine bits will be used.
Returns:
the MicroInstruction that is stored at the given address, or null if there is no instruction at the given address.
Since:
Date: Nov 20, 2011

getFirstPossibleCodeAddress

protected int getFirstPossibleCodeAddress()
Description copied from class: AbstractCodeContainer
Returns the address where the first possible code is stored.

Specified by:
getFirstPossibleCodeAddress in class AbstractCodeContainer
Returns:
the number of the first code line.

getLastPossibleCodeAddress

protected int getLastPossibleCodeAddress()
Description copied from class: AbstractCodeContainer
Returns the address where the last possible code is stored.

Specified by:
getLastPossibleCodeAddress in class AbstractCodeContainer
Returns:
the number of the last code line.

printCodeLine

protected int printCodeLine(int i)
Description copied from class: AbstractCodeContainer
Prints the line with the given number to the user. Returns the number of code lines to skip after this line, in case of reading arguments.

Specified by:
printCodeLine in class AbstractCodeContainer
Parameters:
i - the line number of the code instruction to print
Returns:
the number of lines that can be skipped after printing this line


Copyright © 2012. All Rights Reserved.