fi.hu.cs.titokone
Class RunDebugger

java.lang.Object
  extended byfi.hu.cs.titokone.RunDebugger

public class RunDebugger
extends java.lang.Object

This class produces objects describing what has changed due to the last command having been run.


Field Summary
static short ALU_OPERATION
          constant numerical value for ALU-operation type
static short BRANCH_OPERATION
          constant numerical value for branching operation type
private  java.util.LinkedList changedMemoryLines
          List of changed memory lines
static short COMP_OPERATION
          constant numerical value for Comparing operation type
private  int compareBit
          Compare bit tells compare status of status register.
static short DATA_TRANSFER_OPERATION
          constant numerical value for Data transfer operation type
private  int deviceValue
           
private static java.lang.String DIRECT
          constant String for comment line memory addressing
private static java.lang.String DIRECT_ADDRESSING
          constant String for comment line memory addressing
private static java.lang.String INDIRECT_ADDRESSING
          constant String for comment line memory addressing
private  RunInfo info
          Runinfo for each command line of the program
private  java.lang.String memoryComment
          String for memory part of comment
static short NO_OPERATION
          constant numerical value for operation type NOP
private  java.lang.String[] parameters
          String array for the comment message
static short STACK_OPERATION
          constant numerical value for stack operation type
static short SUB_OPERATION
          constant numerical value for subroutines operation type
static short SVC_DATE
          constant short for supervisor call Date
static short SVC_HALT
          constant short for supervisor call Halt
static short SVC_OPERATION
          constant numerical value for SVC operation type
static short SVC_READ
          constant short for supervisor call Read
static short SVC_TIME
          constant short for supervisor call Time
static short SVC_WRITE
          constant short for supervisor call Write
 
Constructor Summary
RunDebugger()
          This constructor initializes the RunDebugger.
 
Method Summary
 void addChangedMemoryLine(int row, MemoryLine changedMemoryLine)
          This method tells debugger that one or more memorylines were changed.
 RunInfo cycleEnd()
          This method return the current runinfo after the line is executed
 void cycleStart(int lineNumber, java.lang.String lineContents)
          This method tells debugger that a new cycle has been started.
 void runCommand(int command)
          This method tells what was operation run and its parts.
 void setALUResult(int result)
          This method sets the result of ALU operation.
private  void setComments()
          Sets the comment message of the current RunInfo.
 void setCompareResult(int whichBit)
          This method tells what was the result of compare operation.
 void setIN(int deviceNumber, int value)
          This method tells debugger that something was read from the given device.
 void setNewPC(int newPC)
          Sets value of new PC.
 void setOperationType(int opcode)
          This method sets the type of operation.
 void setOUT(int deviceNumber, int value)
          This method tells debugger that something was written to the given device.
 void setRegisters(int[] registers)
          This method tells debugger that one or more registers were changed.
 void setSecondFetchValue(int secondFetchValue)
          This method sets value of second memory fetch.
 void setSVCOperation(int operation)
          This method tells debugger which SVC operation was done.
 void setValueAtADDR(int value)
          This method tells debugger what value was found from the ADDR part of the command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_OPERATION

public static final short NO_OPERATION
constant numerical value for operation type NOP

See Also:
Constant Field Values

DATA_TRANSFER_OPERATION

public static final short DATA_TRANSFER_OPERATION
constant numerical value for Data transfer operation type

See Also:
Constant Field Values

ALU_OPERATION

public static final short ALU_OPERATION
constant numerical value for ALU-operation type

See Also:
Constant Field Values

COMP_OPERATION

public static final short COMP_OPERATION
constant numerical value for Comparing operation type

See Also:
Constant Field Values

BRANCH_OPERATION

public static final short BRANCH_OPERATION
constant numerical value for branching operation type

See Also:
Constant Field Values

SUB_OPERATION

public static final short SUB_OPERATION
constant numerical value for subroutines operation type

See Also:
Constant Field Values

STACK_OPERATION

public static final short STACK_OPERATION
constant numerical value for stack operation type

See Also:
Constant Field Values

SVC_OPERATION

public static final short SVC_OPERATION
constant numerical value for SVC operation type

See Also:
Constant Field Values

SVC_HALT

public static final short SVC_HALT
constant short for supervisor call Halt

See Also:
Constant Field Values

SVC_READ

public static final short SVC_READ
constant short for supervisor call Read

See Also:
Constant Field Values

SVC_WRITE

public static final short SVC_WRITE
constant short for supervisor call Write

See Also:
Constant Field Values

SVC_TIME

public static final short SVC_TIME
constant short for supervisor call Time

See Also:
Constant Field Values

SVC_DATE

public static final short SVC_DATE
constant short for supervisor call Date

See Also:
Constant Field Values

DIRECT

private static final java.lang.String DIRECT
constant String for comment line memory addressing

See Also:
Constant Field Values

DIRECT_ADDRESSING

private static final java.lang.String DIRECT_ADDRESSING
constant String for comment line memory addressing

See Also:
Constant Field Values

INDIRECT_ADDRESSING

private static final java.lang.String INDIRECT_ADDRESSING
constant String for comment line memory addressing

See Also:
Constant Field Values

memoryComment

private java.lang.String memoryComment
String for memory part of comment


parameters

private java.lang.String[] parameters
String array for the comment message


deviceValue

private int deviceValue

info

private RunInfo info
Runinfo for each command line of the program


changedMemoryLines

private java.util.LinkedList changedMemoryLines
List of changed memory lines


compareBit

private int compareBit
Compare bit tells compare status of status register. 0 - greater, 1 - equal, 2 - less.

Constructor Detail

RunDebugger

public RunDebugger()
This constructor initializes the RunDebugger.

Method Detail

cycleStart

public void cycleStart(int lineNumber,
                       java.lang.String lineContents)
This method tells debugger that a new cycle has been started.

Parameters:
lineNumber - Tells the number of the current command line in memory.
lineContents - String containing symbolic command.

setOperationType

public void setOperationType(int opcode)
This method sets the type of operation.

Parameters:
opcode - Operation code of command.

runCommand

public void runCommand(int command)
This method tells what was operation run and its parts.

Parameters:
command - TTK91 command.

setValueAtADDR

public void setValueAtADDR(int value)
This method tells debugger what value was found from the ADDR part of the command.

Parameters:
value - int containing the value.

setRegisters

public void setRegisters(int[] registers)
This method tells debugger that one or more registers were changed. If value has not changed, value is null, otherwise changed value is in current index

Parameters:
registers - Array containing new values.

addChangedMemoryLine

public void addChangedMemoryLine(int row,
                                 MemoryLine changedMemoryLine)
This method tells debugger that one or more memorylines were changed. First cell contains number of the line and second the new value..

Parameters:
row - The index of the changed line in memory.
changedMemoryLine - The changed memory line.

setALUResult

public void setALUResult(int result)
This method sets the result of ALU operation.

Parameters:
result - Value of result.

setCompareResult

public void setCompareResult(int whichBit)
This method tells what was the result of compare operation.

Parameters:
whichBit - Number of SR bit set.

setSecondFetchValue

public void setSecondFetchValue(int secondFetchValue)
This method sets value of second memory fetch. Indirect memory accessing mode needs two memory fetches.

Parameters:
secondFetchValue - Value which have got at second memory fetch.

setIN

public void setIN(int deviceNumber,
                  int value)
This method tells debugger that something was read from the given device. Devices are STDIN and KBD.

Parameters:
deviceNumber - Number of the device.
value - Value written.

setOUT

public void setOUT(int deviceNumber,
                   int value)
This method tells debugger that something was written to the given device. Devices are STDOUT and CRT.

Parameters:
deviceNumber - Number of the device.
value - Value written.

setSVCOperation

public void setSVCOperation(int operation)
This method tells debugger which SVC operation was done.

Parameters:
operation - Int containing operation type.

setComments

private void setComments()
Sets the comment message of the current RunInfo.


setNewPC

public void setNewPC(int newPC)
Sets value of new PC.

Parameters:
newPC - Value of new PC.

cycleEnd

public RunInfo cycleEnd()
This method return the current runinfo after the line is executed

Returns:
RunInfo of the current line.