SIC System Programmer

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.

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 ----

COPY START 1000
FIRST STL RETADR
CLOOP JSUB RDREC
LDA LENGTH
COMP ZERO
JEQ ENDFIL
JSUB WRREC
J CLOOP
ENDFIL LDA EOF
STA BUFFER
LDA THREE
STA LENGTH
JSUB WRREC
LDL RETADR
RSUB
EOF BYTE C'EOF'
THREE WORD 3
ZERO WORD 0
RETADR RESW 1
LENGTH RESW 1
BUFFER RESB 4096
RDREC LDX ZERO
LDA ZERO
RLOOP TD INPUT
JEQ RLOOP
RD INPUT
COMP ZERO
JEQ EXIT
STCH BUFFER,X
TIX MAXLEN
JLT RLOOP
EXIT STX LENGTH
RSUB
INPUT BYTE X'F1'
MAXLEN WORD 4096
WRREC LDX ZERO
WLOOP TD OUTPUT
JEQ WLOOP
LDCH BUFFER,X
WD OUTPUT
TIX LENGTH
JLT WLOOP
RSUB
OUTPUT BYTE X'05'
END FIRST
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 table. An array is not acceptable.