tools.code
Class CodeLine

java.lang.Object
  extended by tools.code.CodeLine

public class CodeLine
extends java.lang.Object

This class encapsulates a single line of assembly or disassembly. Example of Assembly: 0xF000: MySpot: LDA MYVAL-2[SPOTA-SPOTB+10] ; Comment Example of Disassembly: F000: 80 40 55 55 LDA 0x20[0x0400]


Constructor Summary
CodeLine(java.lang.String code, java.lang.String filename, int lineNumber)
          This constructs a new CodeLine with the given original text.
CodeLine(java.lang.String code, java.lang.String filename, int lineNumber, boolean hexAddress)
           
 
Method Summary
 int getAddress()
          This method returns the code address or -1 if there is none.
 java.lang.String getComment()
          This method returns the code comment or null if there is none.
 int[] getData()
          This method returns the code data or null if there is none.
 java.lang.String getError()
          This method returns any errors attached to the line or null if none.
 java.lang.String getErrorDescription()
          This method returns the complete description of an error for the line.
 java.lang.String getFilename()
          This method returns the name of the file the line was loaded from.
 java.util.List<java.lang.String> getLabels()
          This method returns all labels attached to this assembly line.
 int getLineNumber()
          This method returns the line number of the file this line was loaded from.
 Opcode getOpcode()
          This method gets the line's opcode or null if none.
 java.util.Map<java.lang.String,OpcodeParameterInfo> getOpcodeParamInfo()
          This method returns the map of opcode-parameter information.
 java.lang.String getOpcodeString()
          This method returns the mnemonic text.
 java.lang.String getOriginalText()
          This method returns the original code text.
 java.lang.String getSpecialCommentData()
          This method returns the data of a system-targeted comment.
 boolean isDirective()
          This method returns true if the line has been flagged as an assembler directive.
 void setAddress(int address)
          This sets the code address.
 void setComment(java.lang.String comment)
          This sets the code's comment.
 void setData(int[] data)
          This sets the code's data.
 void setDirective(boolean directive)
          This method flags a line as an assembler directive.
 void setError(java.lang.String error)
          This method attaches an error to the code line.
 void setOpcode(Opcode opcode)
          This method sets the line's opcode.
 void setOpcodeString(java.lang.String t)
          This sets the opcode string.
 void setOriginalText(java.lang.String originalText)
          This sets the line's "original text".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeLine

public CodeLine(java.lang.String code,
                java.lang.String filename,
                int lineNumber)
This constructs a new CodeLine with the given original text. The line fragments are parsed here but not the opcode.

Parameters:
code - the original line of code
filename - the name of the file this line came from
lineNumber - the line-number in the file this came from
hexAddress - true if the address is just a 4-byte hex number (like with disassembly)

CodeLine

public CodeLine(java.lang.String code,
                java.lang.String filename,
                int lineNumber,
                boolean hexAddress)
Method Detail

getSpecialCommentData

public java.lang.String getSpecialCommentData()
This method returns the data of a system-targeted comment. These comments begin with ##. If the comment is not for the system this method returns null.

Returns:
the system-targeted comment data or null if not a system-target

isDirective

public boolean isDirective()
This method returns true if the line has been flagged as an assembler directive.

Returns:
true if this is an assembler directive

setDirective

public void setDirective(boolean directive)
This method flags a line as an assembler directive.

Parameters:
directive - true if this is an assembler directive

getLabels

public java.util.List<java.lang.String> getLabels()
This method returns all labels attached to this assembly line.

Returns:
the list of lines

getAddress

public int getAddress()
This method returns the code address or -1 if there is none.

Returns:
the code address or -1

setAddress

public void setAddress(int address)
This sets the code address.

Parameters:
address - the new address

getData

public int[] getData()
This method returns the code data or null if there is none.

Returns:
data array or null

setData

public void setData(int[] data)
This sets the code's data.

Parameters:
data - the code's data

getComment

public java.lang.String getComment()
This method returns the code comment or null if there is none.

Returns:
comment or null

setComment

public void setComment(java.lang.String comment)
This sets the code's comment.

Parameters:
comment - the comment

getOriginalText

public java.lang.String getOriginalText()
This method returns the original code text.

Returns:
the original text

setOriginalText

public void setOriginalText(java.lang.String originalText)
This sets the line's "original text".

Parameters:
originalText - the original text

getOpcode

public Opcode getOpcode()
This method gets the line's opcode or null if none.

Returns:
the opcode

setOpcode

public void setOpcode(Opcode opcode)
This method sets the line's opcode.

Parameters:
opcode - the new opcode

getOpcodeString

public java.lang.String getOpcodeString()
This method returns the mnemonic text.

Returns:
the opcode

setOpcodeString

public void setOpcodeString(java.lang.String t)
This sets the opcode string.

Parameters:
t - the new opcode string

getFilename

public java.lang.String getFilename()
This method returns the name of the file the line was loaded from.

Returns:
the file name

getLineNumber

public int getLineNumber()
This method returns the line number of the file this line was loaded from.

Returns:
the line number

getError

public java.lang.String getError()
This method returns any errors attached to the line or null if none.

Returns:
error string or null if OK

setError

public void setError(java.lang.String error)
This method attaches an error to the code line.

Parameters:
error - the error string

getErrorDescription

public java.lang.String getErrorDescription()
This method returns the complete description of an error for the line.

Returns:
the error description

getOpcodeParamInfo

public java.util.Map<java.lang.String,OpcodeParameterInfo> getOpcodeParamInfo()
This method returns the map of opcode-parameter information.

Returns:
the opcode parameter information