TRESSEL Developer's Guide: Modules
TRESSEL Documentation
> TRESSEL Developer's Guide
> Modules
Table of Contents
1. Assembler modules
2. Linker modules
3. Simulator modules
Assembler modules
These are the modules in the source of the TRESSEL assembler.
Any error codes referred to are assembler error codes.
Please see the Assembler Error Messages section of the User's Guide for
messages related to error codes.
StringIsAlphabetical
Description: Returns
true if the first string is in alphabetical order to the second.
Input Parameters: First
String, Second String
Output Parameters:
Boolean
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
11th, 2009
Modifications: None
Date / Reason / Author
AddSymbolTableLine
Description: Adds a line
to the global Symbol table. Does an Insertion Sort to find the place(So
it's in alphabetical order).
Input Parameters: Label
String, Address String, Substitution String, Purpose String
Output Parameters: None
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
11th, 2009
Modifications: None
Date / Reason / Author
EditSymbolTableLineByLabel
Description: Edits a
line in the global Symbol table searching by its label. Pass "$" as a
field to copy that field from the existing line.
Input Parameters: Old
Label String, New Label String, New Address String, New Substitution
String, New Purpose String
Output Parameters: None
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
11th, 2009
Modifications: None
Date / Reason / Author
EditSymbolTableLineByPurpose
Description: Edits a
line in the Global Symbol Table searching by its purpose. Pass "$" as a
field to copy that field from the existing line.
Input Parameters: Old
Purpose String, New Label String, New Address String, New Substitution
String, New Purpose String
Output Parameters: None
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
13th, 2009
Modifications: None
Date / Reason / Author
ReturnSymbolTableAddressByLabel
Description: Returns an
address associated with a label in the Global Symbol Table.
Input Parameters: Search
Label String
Output Parameters:
Symbol Table Item Address
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
13th, 2009
Modifications: None
Date / Reason / Author
ReturnSymbolTableAddressByPurpose
Description: Returns an
address associated with a purpose in the Global Symbol Table.
Input Parameters: Search
Purpose String
Output Parameters:
Symbol Table Item Address
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
13th, 2009
Modifications: None
Date / Reason / Author
ReturnSymbolTableSubstitutionByLabel
Description: Returns a
substitution associated with a label in the Global Symbol Table.
Input Parameters: Search
Label String
Output Parameters:
Symbol Table Item Substitution
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
13th, 2009
Modifications: None
Date / Reason / Author
IntToString
Description: Converts an
Integer to a String.
Input Parameters:
intInput Integer
Output Parameters:
String of the given Integer
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
11th, 2009
Modifications: None
Date / Reason / Author
AddErrorTableLine
Description: Adds a line
number and then error number to the globalErrorTable.
Input Parameters:
errorNum Integer (line number is global)
Output Parameters: none.
It updates the globalErrorTable.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Jarrod
Freeman, David Straily
Date Installed: October
11th, 2009
Modifications: None
Date / Reason / Author
BuildList
Description: Creates a
doubley-linked list where each node of this list is a vector of
strings. The lists will be used to store our table info.
Input Parameters:
inputFile String (This is in the format of a text file.)
Output Parameters: A list>
table, which each contain our
Error, Instruction, and Directive tables.
Error Conditions Tested:
If the inputFile could be opened/found.
Error Messages Generated:
1
Original Author: Jarrod
Freeman, Chris Brainerd, David Straily, Abe kim, Abdul Modrokbi
Date Installed: October
6th, 2009
Modifications: None
Date / Reason / Author
PrintTable
Description: Used for
testing purposes to ensure that our tables are being built correctly.
Displays the inputted table in the console.
Input Parameters: A list>
Table.
Output Parameters: The
outputted display in the console.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Jarrod
Freeman (Chris Brainerd and Abe Kim also worked on alternate forms,
that were not used, in order to print table correctly.)
Date Installed: October
7th, 2009
Modifications: None
Date / Reason / Author
CheckTable
Description: Iterates
through the given list in order to check that a matching string can be
found in the given table column.
Input Parameters: A list>
Table, test_str String, column
Integer
Output Parameters:
bin_val String. Will return the reference type needed for the operands;
or an error if the string isn't found in the given column in the given
table. Will also check if the symbol already exists, if we select to
search the globalSymbolTable.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: David
Straily and Jarrod Freeman
Date Installed: October
8th, 2009
Modifications: One
Date / Reason / Author
Abe Kim / October 11th / Clean Up and Efficiency.
Removed unnecessary parameters and copying of tables.
For return value binary(or label type), the format of operand
parameter added.
SaveTable
Description: Saves a
table to a text file on disk.
Input Parameters: A
table (table to be saved), and the tablefilename (target filename)
Output Parameters: The
.txt file.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
11th, 2009
Modifications: None
Date/Reason/Author
CheckOp
Description: If it is a
valid directive or instruction, reftype becomes the reference type of
the operand it allows. If an error is found, it changes the value of
the reftype to be the corresponding error. The previous token cannot be
an error if it entered this function, this assumes the error has been
taken care of (or reported) beforehand.
Input Parameters:
Integer previoustokentype, String currenttoken, Integer &
reftype, String previoustoken
Output Parameters:
Returns Integer for token type (INSTRUCTION, DIRECTIVE, ERROR).
Error Conditions Tested:
12, Directive
cannot have a Label. **FATAL**. 13, Operation not recognized. 14,
Directive cannot follow an instruction. 15, Cannot have multiple
instructions on one line. 16, Directive requires a label. 17, Cannot
have multiple directives on one line. 18, Instruction cannot follow a
directive.
Error Messages Generated:
12, 13, 14, 15, 16, 17, 18.
Original Author: Abe Kim
Date Installed: October
12th, 2009
Modifications: None
Date/Reason/Author
AddObjectCodeTableLine
Description: Adds a line
to the Global Object Code table.
Input Parameters: String
opcode, String addressflags, String address
Output Parameters: None.
A line is added to the ObjectCodeTable.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd
Date Installed: October
10th, 2009
Modifications: None
Date/Reason/Author
CheckLabel
Description: Checks the
input and marks if it's a valid label. If not, it will return, listing
as a DIRECTIVE, INSTRUCTION, or ERROR.
Input Parameters: Pass
in the string to check for label validity.
Output Parameters: The
integer checkit defines what the string is: a legal label, error,
directive, or instruction.
The return value is dynamic. If an error, the return is the error
message. If an
instruction, the return value is the 6 bit binary value. If a
directive, the return is ol/rl/none; referencing label requirement. And
if the label is valid, it'll simply
return that label.
Error Conditions Tested:
3, Labels must not
exceed 64 characters. 4, Labels must begin with a letter. 5, Labels may
only contain letters and numbers. 6, Labels must contain at least 2
characters.
Error Messages Generated:
3, 4, 5, 6.
Original Author: David
Straily and Abe Kim
Date Installed: October
9th, 2009
Modifications: One
Date/Reason/Author
Abe Kim / October 10th / Clean up (No change of algorithm).
isValid
Description: Takes in a
String, and will return an integer describing the condition of the
string, according to the classifications listed below.
Input Parameters: token
String
Output Parameters:
Returns: 0 = Number, 1 = EQUed Symbol, 2 = Symbol, 3 = Literal, 4 =
REF#, 5 = REF%, 6 = Exp, 7 = Error
Error Conditions Tested:
Invalid operand.
Error Messages Generated:
Returns a 7, which equates to an error.
Original Author: Abdul
Modrokbi and Abe Kim
Date Installed: October
12th, 2009
Modifications: One
Date/Reason/Author
Abdul ModRokbi / October 13th / Update
CheckOperand
Description: Takes in
the token for the operands, and parses through that, checking to make
sure it is a valid call.
Input Parameters: The
reference type to check, and the actual token containing the operands
we are comparing against.
Output Parameters: A
boolean stating true or false, in regards to the validity of the
operands.
Error Conditions Tested:
28, word-chr limits to a maximum of 3 characters as an operand.
Error Messages Generated:
28
Original Author: Abdul
Modrokbi
Date Installed: October
11-12th, 2009
Modifications: One
Date/Reason/Author
Abdul ModRokbi and Abe Kim / October 12th / Update
DoDirective
Description: Executes
all the different directives, testing whether they consume memory or
not, and then converts the required directives to object code for the
ObjectCodeTable.
Input Parameters: Takes
in the label, the actual directive token, and the operands for the
directive.
Output Parameters: None,
simply updates the ObjectCodeTables if needed or adds more Symbols to
the globalSymbolTable.
Error Conditions Tested:
13, Operation not
recognized. 19, Duplicate START Directive. 20, END has operands
specified when no operands are expected. 21, Invalid LC: must be
greater than current Location Counter. 22, USING has operands specified
when no operands expected. 23, WORD-NUM requires base 10 number as
operand. 24, DEBUG operand must be ON or OFF. 25, ALT-START address
must be in range of program. 26, SKIP-MEM address must be in range of
program. 30, WORD-BIN has a limited maximum of 24 bits. 31, WORD-CHR
may only contain alphanumeric characters. 32, WORD-BIN must be in
binary format (0 or 1). 33, WORD-HEX must be in hexadecimal format (0-9
or A-F).
Error Messages Generated:
13, 19, 20, 21, 22, 23, 24, 25, 26, 30, 31, 32, 33.
Original Author: Chris
Brainerd for most, David Straily did all the WORD-XXX directives, Adr
and NOP. Abe Kim wrote the COMPs, and Chris also worked on an attempt
of the COMP as well.
Date Installed: October
11th, 2009
Modifications: Several
Date/Reason/Author
Jarrod Freeman and David Straily / October 16th / Repaired numerous
directive calls, and filled in still missing directives.
David Straily and Jarrod Freeman / November 2nd / Fixed the ADR
functionality.
ParseFirstLine
Description: Helper
function to Parser. Parses only the first line of code to ensure it is
a valid start line.
Input Parameters: char *
line : The first line of the source code; and Integer intTokensLen : To
help determine if there's whitespace at the end of the line; and help
us avoid null pointer errors.
Output Parameters: None,
will print errors if found. Initializes the global Location Counter.
Error Conditions Tested:
7, First line must
start with a label in column 1. 8, Program must begin with a START
directive on line 1 (**FATAL**). 9, Comments must begin with
a
':' character. 10, Start location must be between 0 and end of program
memory (**FATAL**).
Error Messages Generated:
7, 8, 9, 10.
Original Author: David
Straily. Jarrod Freeman decoupled this parse into an independent
function, rather than letting it clutter the Main Parser.
Date Installed: October
12th, 2009
Modifications: One
Date/Reason/Author
Jarrod Freeman / Oct. 12th, 2009 / Added theinteger input, to help us
avoid the null pointer errors for lack of whitespace at the end of a
line.
Parser
Description: Parses
through the TRESSEL source code and creates the intermediate file and
symbol tables.
Input Parameters: String
inputFile : The source in a .txt format.
Output Parameters: The
globalSymbolTable and Intermediate File.
Error Conditions Tested:
1, File could not be found (**FATAL**). 9, Comments must
begin with a ':' character. 11, Invalid operands.
Error Messages Generated:
1, 9, 11.
Original Author: David
Straily
Date Installed: October
7th, 2009
Modifications: Four
Date/Reason/Author
Jarrod Freeman, David Straily, Abe Kim / October 8th, 2009 / Expanded
parsing ability to parse first line correctly.
David Straily / October 11th, 2009 / Began work on parsing the rest of
the source code.
Jarrod Freeman / Oct. 12th, 2009 / Moved C++ code for parsing the first
line into a seperate function to optimize readability. Also wrote
outline for an improved version of the parsing for rest of source code.
Jarrod Freeman and David Straily / Oct. 13th, 2009 / Continued working
on improving the ability to parse the rest of the source code.
ConvertBase
Description: A custom
implemented converter that takes in any base X number, and converts in
to another base, determined by input. Can also convert ASCII characters
into binary representation, and converts Hexadecimal to Decimal to
Binary.
Input Parameters: String
inputNum, Integer inputBase, String outputNum, Integer outputBase.
Output Parameters: The
String outputNum, and the base of that is determined by the outputBase
integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: David
Straily and Jarrod Freeman
Date Installed: October
16th, 2009
Modifications: Two
Date/Reason/Author
Jarrod Freeman and David Straily / Oct. 16th, 2009 / Added
functionality to convert ASCII characters to binary representation.
David Straily / Oct. 26th, 2009 / Added functionality for hexadecimal
output.
Comp
Description: A custom
implemented system that takes a list of operands, computes using order
of operations, and then converts these operations to Object Code, and
adds them to the globalObjectCodeTable.
Input Parameters:
operands Token, and a Boolean for using ADR-COMP or COMP.
Output Parameters: The
Object Code generated by the computation.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Abe
Kim, with attempts on a different, but unused COMP by Chris Brainerd.
Date Installed: October
16th, 2009
Modifications: OneIt
stores position information
for strtok_s.
Date/Reason/Author
Jarrod Freeman and David Straily / Oct. 17th, 2009 / Added
functionality, and the input Boolean, to decipher between ADR-COMP and
COMP.
GetTokenType
Description: Returns the
token type for a token.
Input Parameters: token
String.
Output Parameters: token
type Integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
TokenTypeIsOperator
Description: Returns
whether or not a token type is an operator.
Input Parameters: tokentype
Integer.
Output Parameters:
Returns the Operator state for the tokentype in a Boolean.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
GetTokenPrecedence
Description: Returns
precedence value for a token type.
Input Parameters: tokentype
Integer.
Output Parameters:
Returns the tokentype in the form of an Integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
GetNextToken
Description: Returns the
next token from an expression, and erases it from the expression.
Input Parameters: The
Expression String.
Output Parameters: The
next token from the Expression in the form of a String.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
ExpressionPreprocess
Description: Removes the
'+' or '-' header from the Expression and marks a flag for it.
Input Parameters: The
Expression String.
Output Parameters: The
expression string modified with flags if a '+' or '-' was present.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
ExpressionToRPN
Description: Converts an
expression to RPN notation by shunting-yard algorithm.
Input Parameters: The
Expression String.
Output Parameters: The
Expression String in Reverse Polish Notation.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
EvaluateRPN
Description: Evaluates
the Reverse Polish Notation expression.
Input Parameters: The
Expression String in Reverse Polish Notation
Output Parameters: The
Evaluated Reverse Polish Notation Expression.
Error Conditions Tested:
38, Error
evaluating expression: operators require 2 operands. 39, Error
evaluating expression: multiple results. Check that every operator has
2 operands. 40, Operand in expression is not number or symbol equated
to number; operand is set to 0.
Error Messages Generated:
38, 39, 40.
Original Author: Chris
Brainerd.
Date Installed: October
16th, 2009
Modifications: None
Date/Reason/Author
AddIntermediateTableLine
Description: Adds a line
to the Intermediate Table Listing.
Input Parameters: The
Label String and the Instruction String.
Output Parameters: A new
line in the Intermediate Table Listing (global variables are also
added.).
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
17th, 2009
Modifications: None
Date/Reason/Author
ReturnSymbolTableLabelByAddress
Description: Returns a
Label associated with an address in the globalSymbolTable.
Input Parameters: The
searchaddress String.
Output Parameters: The
matching globalSymbolTable label.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
17th, 2009
Modifications: None
Date/Reason/Author
SaveIntermediateTable
Description: Saves
intermediate table to file on disk.
Input Parameters: The
File Name for the Intermediate Table (EX: intermediate.txt).
Output Parameters: The
actual output file.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
17th, 2009
Modifications: None
Date/Reason/Author
PrintIntermediateTable
Description: Prints
intermediate table to console.
Input Parameters: None
(The IntermediateFileListing is global.).
Output Parameters:
The output to console.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd.
Date Installed: October
17th, 2009
Modifications: None
Date/Reason/Author
CountSpaceAfterToken
Description: Counts the number of spaces
starting at the specified input token, up until the next specified
token.
Input Parameters: The start token String
and end token String.
Output Parameters: Returns the number of
spaces in between, in the form of an Integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd and Jarrod Freeman.
Date Installed: October
18th, 2009
Modifications: None
Date/Reason/Author
GetLiteralType
Description: Returns whether the literal is
in binary, hexadecimal, or decimal form.
Input Parameters: The literal in the form
of a String.
Output Parameters: Returns the literal type
in the form of an Integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd and Jarrod Freeman.
Date Installed: October
18th, 2009
Modifications: None
Date/Reason/Author
WriteLiteralPool
Description: Takes all the literal values
that are within the globalLiteralPool vector, and converts them into
propers Symbols and creates words.
Input Parameters: No input parameters.
Only the globalLiteralPool vector.
Output Parameters: Outputs content in the
IntermediateFileListing and in Object Code.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris
Brainerd and Jarrod Freeman.
Date Installed: October
18th, 2009
Modifications: None
Date/Reason/Author
PASS 2 -- ADDED MODULES
ColoredConsole
Description: A class we found online to
give text colors and highlights, to the console through the API.
All the inlines and the PrintColorReset() function were found online,
and we use them to help create a vivid console output.
Input Parameters: No input
parameters. Just simply add inline comnnads when using couts.
Output Parameters: Outputs colored font to
the console!
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Jaded Hobo over at
www.CodeProject.com
Date Installed: October 27th, 2009
Modifications: None
Date/Reason/Author
PrintHeader
Description: A function for ouputting
headers to the console; with our specified color style.
Input Parameters: The text we want
outputted to console.
Output Parameters: Outputs colored font to
the console!
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: October 27th, 2009
Modifications: None
Date/Reason/Author
CountSpaceAfterToken
Description: A function that counts how
many whitespace characters are following the inputted token on the line.
Input Parameters: The line and what
position to start counting at.
Output Parameters: The number of whitespace
characters following; outputted in a returned integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: October 27th, 2009
Modifications: None
Date/Reason/Author
CountCommaAfterToken
Description: A function that counts how
many comma characters are following the inputted token on the line.
Input Parameters: The line and what
position to start counting at.
Output Parameters: The number of comma
characters following; outputted in a returned integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: October 27th, 2009
Modifications: None
Date/Reason/Author
AddLinkingRecordLine
Description: Pushes back a linking record
to the globalLinkingRecordTable.
Input Parameters: The entry name (symbol),
and the address at which it is declared.
Output Parameters: Another entry into the
globalLinkingRecordTable.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Jarrod Freeman
Date Installed: October 27th, 2009
Modifications: None
Date/Reason/Author
AddTextRecordLine
Description: Pushes back a text record to
the globalTextRecordTable.
Input Parameters: The address at which the
instruction was called, the 6 digit hex code of the instruction, the
Relocation Type, the name of the operand/parameter, and the sign, a '+'
or '-'.
Output Parameters: Another entry into the
globalTextRecordTable.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Jarrod Freeman
Date Installed: October 27th, 2009
Modifications: None
Date/Reason/Author
PassTwo
Description: Iterates through the
globalIntermediateTable, absolving address values, creating Text
records, and doing numerous syntax/error checks.
Input Parameters: None. This function
simply uses and creates global tables.
Output Parameters: A completed Text Record
table, and a listing of errors in Pass Two.
Error Conditions Tested: Several small and
subtle errors.
Error Messages Generated: 70 "Cannot
reference a symbol as an operand if it hasn't been declared." 71
"Literal not stored inside the symbol table." 72 "This equated
symbol has not been declared for use." 64, "Cannot access memory out of
bounds of the program start and length."
Original Author: David Straily
Date Installed: October 29th, 2009
Modifications: Several
Date/Reason/Author
October 30th, 2009 / Fixed the indirect and direct address references.
/ David Straily
November 1st, 2009 / Added the ADR-COMP functionality. / Chris Brainerd
November 2nd, 2009 / Debugged numerous small errors. / Jarrod Freeman
November 6th, 2009 / Removed the stepper and fixed iteration issues. /
Abe Kim
November 7th, 2009 / Code celan-up and optimization. / Abe Kim and
Abdul Modrokbi
November 9th, 2009 / Fixed the error and out-of-bounds checking. /
Jarrod Freeman
CreateHeaderRecord
Description: Creates the Header Record for
the module.
Input Parameters: None, everything that
needs to be accessed is global.
Output Parameters: None, the Header Record
is created.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Abe Kim and Abdul Modrokbi
Date Installed: October 26th, 2009
Modifications: One
Date/Reason/Author
October 28th, 2009 / Fixed the date functionality and format. / Abe Kim
and Abdul Modrokbi
ReturnIntermediateTableLCBySourceLineNumber
Description: Returns the LC for the
specified Source Code Line Number, by using the globalIntermediateFile.
Input Parameters: The source line you want
the LC for.
Output Parameters: The Location Counter is
returned in a String.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: November 4th, 2009
Modifications: None
Date/Reason/Author
ReturnObjectCodeTableLineByLC
Description: Returns the Object Code line
for the specified Location Counter value.
Input Parameters: The Location Counter you
are searching with.
Output Parameters: The ObjectCodeTable line
you want, in the form of a string.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: November 4th, 2009
Modifications: None
Date/Reason/Author
ReturnObjectCodeLineByLineNum
Description: Returns the Object Code line
for the specified Line Number value.
Input Parameters: The Line Number you are
searching with.
Output Parameters: The ObjectCodeTable line
you want, in the form of a vector<string>.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: November 4th, 2009
Modifications: None
Date/Reason/Author
PrintAssemblyListing
Description: Prints to the console, a
colored and formatted list of the source code, with detailed
information and error messages generated inline.
Input Parameters: None, everything is
accessed globally.
Output Parameters: The Source Code to the
console.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Chris Brainerd
Date Installed: November 1st, 2009
Modifications: Several
Date/Reason/Author
November 4th, 2009 / Resolved the address values, hex codes, and
relocation types for each line. / David Straily and Jarrod Freeman
SaveObjTable
Description: Saves the Object file to a
.txt; including the Header, Linker, Text, and End records.
Input Parameters: None, everything is
accessed globally.
Output Parameters: The text file containing
all the records.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: Jarrod Freeman
Date Installed: November 5th, 2009
Modifications: None
Date/Reason/Author
Linker modules
These are the modules in the source of the TRESSEL linker.
Any error codes referred to are linker error codes.
Please see the Linker Error Messages section of the User's Guide for
messages related to error codes.
AddErrorTableLine
Description: Adds an error number and line
number to the ErrorTable
Input Parameters: None
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16th, 2009
Modifications: None
Date/Reason/Author
AddSymbolTableLine
Description: Adds a line to the global
Symbol table.
Input Parameters: string label,
string addrasm, string addrlink, string len, string adjust, string
symboltype
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
BuildList
Description: Creates a
doubley-linked list where each node of this list is a vector of
strings. The lists will be used to store our table info.
Input Parameters:
inputFile String (This is in the format of a text file.)
Output Parameters: A list>
table, which each contain our
Error, Instruction, and Directive tables.
Error Conditions Tested:
44
Error Messages Generated:
44
Original Author: Jarrod
Freeman, Chris Brainerd, David Straily, Abe kim, Abdul Modrokbi
Date Installed: October
6th, 2009
Modifications: None
Date / Reason / Author
CheckRecord
Description: Checks an object file record
for validity
Input Parameters: char* record
Output Parameters: None
Error Conditions Tested:
43,6,18,7,8,9,10,12,66,11,17,60,19,61,41,40,39,38,36,32,33,31,34,30,35,29,28,37,27,25,24,22,21,13,23,20,42,3,5,4,49
Error Messages Generated:
43,6,18,7,8,9,10,12,66,11,17,60,19,61,41,40,39,38,36,32,33,31,34,30,35,29,28,37,27,25,24,22,21,13,23,20,42,3,5,4,49
Original Author: Abraham Kim and Abdul
Modrokbi
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
ConvertBase
Description: Converts numbers between bases
Input Parameters: string inputNum,
int inputBase, int outputBase
Output Parameters: string&
outputNum
Error Conditions Tested: None
Error Messages Generated: None
Original Author: David Straily
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
DecToHex
Description: Converts a decimal integer to
hexadecimal
Input Parameters: int decint
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: h3X at
http://www.dreamincode.net/forums/showtopic19694.htm, fixed 0 and - by
Chris Brainerd
Date Installed: November 17 2009
Modifications: None
Date/Reason/Author
HexToDec
Description: Converts a hexadecimal number
to decimal
Input Parameters: string hexstr
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd and Abraham
Kim
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
IntToString
Description: Converts an integer to a string
Input Parameters: int intInput
Output Parameters: String
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: October 11 2009
Modifications: None
Date/Reason/Author
LinkPass1
Description: Pass 1 reads object files,
validates records and builds the linker symbol table
Input Parameters: string objfilename
Output Parameters: None
Error Conditions Tested:
44,45,46,54,48,47,50,51,52
Error Messages Generated:
44,45,46,54,48,47,50,51,52
Original Author: Chris Brainerd
Date Installed: November 17 2009
Modifications: None
Date/Reason/Author
LinkPass2
Description: Pass 2 generates a load file
from the intermediate load file written in pass 1
Input Parameters: None
Output Parameters: None
Error Conditions Tested:
57,58,26,65,59,62,63,64
Error Messages Generated:
57,58,26,65,59,62,63,64
Original Author: Chris Brainerd
Date Installed: November 17 2009
Modifications: None
Date/Reason/Author
PrintColorReset
Description: Resets the console colors to
black background and white text
Input Parameters: None
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
PrintErrorsForLine
Description: Finds all errors for a line in
a file and prints to console
Input Parameters: string objfilename,
int linenum
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
PrintErrorTable
Description: Prints the error table to the
console (Debugging output)
Input Parameters: None
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
PrintFileHeader
Description: Prints a yellow colored header
line to the console
Input Parameters: string strHeaderText
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
PrintHeader
Description: Prints a green colored header
line to the console
Input Parameters: None
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
PrintLinkerSymbolTable
Description: Prints the linker symbol table
to the console
Input Parameters: None
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16, 2009
Modifications: None
Date/Reason/Author
PrintLoadMemory
Description: Prints map of memory used by
load file to console
Input Parameters: None
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 24 2009
Modifications: None
Date/Reason/Author
ReturnAdjustByLabel
Description: Returns Adjust for label in
the linker symbol table.
Input Parameters: string label
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 18 2009
Modifications: None
Date/Reason/Author
ReturnFieldFromRecordLine
Description: Returns a specified field from
a line tokenized by | characters
Input Parameters: string
strRecordLine, int intFieldNum
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
ReturnLinkAddressByLabel
Description: Returns LinkAddr for label in
the linker symbol table.
Input Parameters: string label
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 18 2009
Modifications: None
Date/Reason/Author
ReturnModuleBySymbol
Description: Returns the module name of a
symbol
Input Parameters: string symbol
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Abraham Kim
Date Installed: November 24 2009
Modifications: None
Date/Reason/Author
SaveLoadFile
Description: Saves the load file to disk
Input Parameters: char* loadfilename
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
TrimLeadingZeroes
Description: Prints a yellow colored header
line to the console
Input Parameters: string strnum
Output Parameters: None
Error Conditions Tested: None
Error Messages Generated: None
Original Author: Chris Brainerd
Date Installed: November 17 2009
Modifications: None
Date/Reason/Author
ValidateSymbol
Description: Decides whether a symbol is
valid or not
Input Parameters: char* &pointer
Output Parameters: None
Error Conditions Tested: 2,16,14,15,17
Error Messages Generated: 2,16,14,15,17
Original Author: Abraham Kim and Abdul
Modrokbi
Date Installed: November 16 2009
Modifications: None
Date/Reason/Author
Simulator modules
These are the modules in the source of the TRESSEL simulator.
Any error codes referred to are simulator error codes.
Please see the Simulator Error Messages section of the User's Guide for
messages related to error codes.
ConvertBase
Description: Simply an updateed version of
the one used in Passes 1 & 2. Can now handle two's complement
form, as both input and output.
Input Parameters: String
inputNum, Integer inputBase, String outputNum, Integer outputBase.
Output Parameters: The
String outputNum, and the base of that is determined by the outputBase
integer.
Error Conditions Tested:
None
Error Messages Generated:
None
Original Author: David
Straily and Jarrod Freeman
Date Installed: November 21st, 2009
Modifications: None
Date/Reason/Author
CheckOverflow
Description: For almost all calls within
DoInstruction, CheckOverflow is called to determine if any execution
errors exist, and if so, prevent fatal errors from happening, and
thereby halting the program prematurely.
Input Parameters: String
inputNum, Integer inputBase, String outputNum, Integer outputBase.
Output Parameters: operand1 (double),
operand2 (double), a type (to determine what type of error we are
looking for), and the maximum bit size of the register we are working
with.
Error Conditions Tested: For each of the 16
bits within the Status Register, the listed, relevant error, will turn
that specific bit on:
SR States:
0 Overflow - add
1 Overflow - sub
2 Overflow - mul
3 Overflow - div
4 Shift - value larger than 23
5 Rotate - value larger than 23
6 Address before start of program
7 Address within bounds of program
(different than al's website; he says "address after start of
program"
which could mean inside or
outside of the program bounds)
8 Address after the end of program
9 Shift - value less than 0
10 Rotate - value less than 0
11 Overflow - abs
12 Overflow - ldn
13 Nothing
14 Nothing
15 Nothing
Error Messages Generated:
None, bits within the SR are turned on and off for relevant issues.
Original Author: Jarrod Freeman
Date Installed: November 19th, 2009
Modifications: None
Date/Reason/Author
DoInstruction
Description: This function is what actually
simulates specific Instructions. This will literally do the
adding, subtracting, shifting, rotating, reading, writing, and logic
cases. A total of 62 different cases.
Input Parameters: The 6-digit binary opcode
represented in a string, and the EFFADR value, stored in an int.
Output Parameters: Memory will be modified
accordingly, or input will be asked for, or DISPLAYs will be made.
Error Conditions Tested:
None
Error Messages Generated: All errors for
READ-NUM, READ-STR, and DISPLAY. Every other error is handled in
CheckOverflow.
Original Author: David
Straily and Jarrod Freeman
Date Installed: November 20th, 2009
Modifications: None
Date/Reason/Author
EFFADDR
Description: Takes the address value, and
resolves it so we get the relevant, effective address we need.
This function helps readability and decouples processes from
DoInstruction, thereby reducing overhead.
Input Parameters: The 24 digit binary
instruction.
Output Parameters: We parse off the address
flags, determine effective addressing, and then return the proper 11
bit binary address value.
Error Conditions Tested:
None
Error Messages Generated: None.
Original Author: David
Straily and Jarrod Freeman
Date Installed: November 18th, 2009
Modifications: None
Date/Reason/Author
Main
Description: We decided that within the
main function of SP4, that is where we will parse through the load
file, initialize memory, and then itertae through the simulation.
Because the code required to complete SP4 didn't involve too much, we
didn't thing any additional functions were necessary. This is
completed in two passes.
Input Parameters: The load file.
Output Parameters: We give you as output a
memory dump from the simuation, in a text filed labelled
"out.FILENAME.txt" where FILENAME is the same as your inputted load
file.
Error Conditions Tested:
None
Error Messages Generated: None.
Original Author: David
Straily and Jarrod Freeman
Date Installed: November 17th, 2009
Modifications: None
Date/Reason/Author
Written by Group 3 of CSE
560 Autumn 2009 5:30 section
Chris Brainerd, Jarrod Freeman, Abe Kim, Abdul Modrokbi, and
David Straily
The Ohio State University