You will implement, using C, pass 1 of an assembler for the machine architecture described in the SIC System Programmer's guide provided as reference for this course. Your project will accept 1 command-line argument, which is a file that contains a SIC assembler program. Project 1 will create and output a symbol table as a result of analyzing the input SIC assembly file.
Remember that to generate SIC object code, we will need to make two passes through the assembly file. Pass one generates the symbol table and pass two uses the symbol table and op codes to generate the object file. You will be doing pass two via project 2. Think about this in your design.
There are some validation checks which should be done during pass one. You should carefully consider the errors in the SIC assembly file input that can and should be discovered during pass one and when encountered in the source file, generate an appropriate error message and stop the assembly process. There are
AT LEAST FOUR
errors which pass one should be able to detect and report (all of which should HALT the assembly process and generate an error message).
For example: if an error is found with the input assembly file, you should stop the process of creating the symbol table and output the following:
ASSEMBLY ERROR:
Line
If the SIC assembly file is valid, then project 1 should output, its symbol table. For each symbol, there should be one line of output: the symbol name followed by a character, followed by the hexadecimal address of the symbol, followed by a .
----- Example ----
COPYSTART1000 FIRSTSTLRETADR CLOOPJSUBRDREC LDALENGTH COMPZERO JEQENDFIL JSUBWRREC JCLOOP ENDFILLDAEOF STABUFFER LDATHREE STALENGTH JSUBWRREC LDLRETADR RSUB EOFBYTEC'EOF' THREEWORD3 ZEROWORD0 RETADRRESW1 LENGTHRESW1 BUFFERRESB4096 RDRECLDXZERO LDAZERO RLOOPTDINPUT JEQRLOOP RDINPUT COMPZERO JEQEXIT STCHBUFFER,X TIXMAXLEN JLTRLOOP EXITSTXLENGTH RSUB INPUTBYTEX'F1' MAXLENWORD4096 WRRECLDXZERO WLOOPTDOUTPUT JEQWLOOP LDCHBUFFER,X WDOUTPUT TIXLENGTH JLTWLOOP RSUB OUTPUTBYTEX'05' ENDFIRST
The correct output for this input file would be:
COPY 1000
FIRST 1000
CLOOP 1003
ENDFIL 1015
EOF 102A
THREE 102D
ZERO 1030
RETADR 1033
LENGTH 1036
BUFFER 1039
RDREC 2039
RLOOP 203F
EXIT 2057
INPUT 205D
MAXLEN 205E
WRREC 2061
WLOOP 2064
OUTPUT 2079
I will build you project by typing make. I will then run your project by typing project1
where is the name of a SIC assembler file.
the turnin code for this project is:System_Software_Project1
You need to shar your .c and makefile and turnin the sharfile to me.
Additionally, I expect you to include a documentation.txt file in your sharfile. documentation.txt should contian approximately two paragraphs. Please let me know what, if anything, is incomplete (any specifications you did not complete), a description of your symbol table implementation.
Caveats:
We are writing system software (an assembler). You must use an appropriate ADT to store your symbol tab
le.
An array is not acceptable.
References:
1. The SIC System Programmer's Reference
2. The SIC Assembly Language Specification