Package edu.iu.jrsalata
Class SicStatement
java.lang.Object
edu.iu.jrsalata.Statement
edu.iu.jrsalata.BaseStatement
edu.iu.jrsalata.SicStatement
The SicStatement class represents a SIC statement
in an assembler. It extends the BaseStatement class and provides functionality for
handling SIC-specific instructions and addressing modes.
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
args is the arguments of the given statement default value is "000"protected boolean
xFlag represents if an index is being used represented by ",X" at the end of argsFields inherited from class edu.iu.jrsalata.BaseStatement
format, location, opcode
Fields inherited from class edu.iu.jrsalata.Statement
block, controlSection, line, size
-
Constructor Summary
ConstructorDescriptionConstructs a new SicStatement object with default values.SicStatement
(HexNum location, HexNum opcode, String args) Constructs a SicStatement object with the specified location, opcode, and arguments. -
Method Summary
Methods inherited from class edu.iu.jrsalata.BaseStatement
getLocation, setLocation
Methods inherited from class edu.iu.jrsalata.Statement
getBlock, getControlSection, getLine, getSize, setBlock, setControlSection, setLine
-
Field Details
-
args
args is the arguments of the given statement default value is "000" -
xFlag
protected boolean xFlagxFlag represents if an index is being used represented by ",X" at the end of args
-
-
Constructor Details
-
SicStatement
public SicStatement()Constructs a new SicStatement object with default values. Initializes the arguments to "000", sets the format to 3, and updates the size based on the format. -
SicStatement
Constructs a SicStatement object with the specified location, opcode, and arguments.- Parameters:
location
- the memory location of the statement as a HexNum objectopcode
- the operation code of the statement as a HexNum objectargs
- the arguments for the statement as a String; if empty, defaults to "000"
-
-
Method Details
-
setArgs
Sets the arguments for the SIC statement. If the provided arguments string are empty, the value of args will not change- Parameters:
args
- the arguments to be set
-
assemble
Assembles the SIC statement into its machine code representation. This method processes the arguments to determine the addressing mode and checks for the X flag. It then looks up the argument value in the symbol table or interprets it as a hexadecimal number. If the X flag is set, it adjusts the argument value to reflect indexed addressing. -
accept
Accepts a visitor object that implements the VisitorInterface. This method allows the visitor to perform some operation on this SicStatement instance.
-