Class ProgramAddress

java.lang.Object
svm.value.Value
svm.value.ProgramAddress

public class ProgramAddress extends Value

ProgramAddress.

program_address ::= c-paddr label:tag

Link to GitHub: Source File.

Author:
S-Port: Definition of S-code, Øystein Myhre Andersen
  • Field Details

    • segID

      public String segID
      Segment ident
    • ofst

      public int ofst
      Address offset
  • Constructor Details

    • ProgramAddress

      public ProgramAddress()
      Default Constructor
    • ProgramAddress

      public ProgramAddress(Type type, String segID, int ofst)
      Construct a new ProgramAddress with the given parameters
      Parameters:
      type - the address type: PADDR or RADDR
      segID - the Segment ident when kind SEGMNT_ADDR
      ofst - The offset
  • Method Details

    • ofScode

      public static ProgramAddress ofScode(Type type)
      Scans the remaining S-Code (if any) belonging to this ProgramAddress Value. Then construct a new ProgramAddress instance.
      Parameters:
      type - The address type
      Returns:
      that ProgramAddress instance.
    • ofFixup

      public static ProgramAddress ofFixup(Type type)
      Create a new Fixup address.
      Parameters:
      type - The address type
      Returns:
      an ProgramAddress
    • fixupAddress

      public void fixupAddress(String segID, int ofst)
      Fixup this ProgramAddress by the given parameters
      Parameters:
      segID - the segment ident
      ofst - the offset
    • segment

      public Segment segment()
      Returns the Segment part of a Segment Address
      Returns:
      the Segment part of a Segment Address
    • copy

      public ProgramAddress copy()
      Returns a copy of this ObjectAddress
      Overrides:
      copy in class Value
      Returns:
      a copy of this ObjectAddress
    • emit

      public void emit(DataSegment dseg)
      Description copied from class: Value
      Add this value to the given DataSegment
      Overrides:
      emit in class Value
      Parameters:
      dseg - the DataSegment
    • compare

      public boolean compare(int relation, Value other)
      Description copied from class: Value
      Compare this Value with the given Value according to the given relation.
      Overrides:
      compare in class Value
      Parameters:
      relation - one of: LT, LE, EQ, GE, GT, NE
      other - the other Value
      Returns:
      true: if the relation holds
    • execute

      public void execute()
      Execute this ProgramSegment
    • printInstr

      public static void printInstr(SVM_Instruction cur, boolean decr)
      Print a SVM-Instruction
      Parameters:
      cur - a SVM-Instruction
      decr - signals decrement of paddr in the printout
    • printInstr

      public static void printInstr(String cur, boolean decr)
      Print a SVM-Instruction
      Parameters:
      cur - a SVM-Instruction
      decr - signals decrement of paddr in the printout
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • write

      public void write(AttributeOutputStream oupt) throws IOException
      Description copied from class: Value
      Writes this Value to the given output.
      Overrides:
      write in class Value
      Parameters:
      oupt - the output stream
      Throws:
      IOException - if IOException occur
    • read

      public static ProgramAddress read(AttributeInputStream inpt) throws IOException
      Reads a ObjectAddress from the given input.
      Parameters:
      inpt - the AttributeInputStream
      Returns:
      the ObjectAddress read
      Throws:
      IOException - if IOException occur