Create a SIC/XE Assembler Pass 1 should construct the symbol table, the addresse
ID: 3769364 • Letter: C
Question
Create a SIC/XE Assembler
Pass 1 should construct the symbol table, the addresses associated with each instruction, addresses of each label. The input file will be in fixed format:
Col 1-8 label optional
Col 9 blank
Col 10 + optional
Col 11-17 mneumonic
Col 18 blank
Col 19 #, @ ... optional
Col 20-29 label, register, ',',X optional ...
Col 30-31 blank
Col 32-80 comments optional
There may be blank lines in the source file. Your project should assemble all of SIC/XE and be equivalent to sicasm. Included features such as EQU, CSECT, USE. All test files will be entered in upper case. Appropriate error conditions such as duplicately defined labels or undefined labels. Invalid mneumonics should be ignored in maintaining your addresses and your assembler should continue processing. Your should anticipate project 4 as pass two, thus you might, in the design of pass 1, consider pass 2.
Pass 2 should complete pass 1 creating the .obj file similar to the file created by sicasm. Both the .obj file and the .lst file should be created using appropriate names.
Test File
Explanation / Answer
char firCol[8]; //first 8 characters including delimiters
char space[1] = {' '}; //guaranteed space
char secCol[1] = {' '}; //space or '+'
char thirCol[7]; //word of length -7 but if shorter includes delitimers
char forCol[1] = {' '}; //guaranteed space
char fifCol[10]; //sames of 7 but length
char comm[52]; // length 52 char and delimitrer
memset(firCol, ' ', 8);
memset(thirCol, ' ', 7);
memset(comm, ' ', 52);
f = fopen(argv[1], "r");
memset(info, 0, sizeof(struct Account) * TABLE_SIZE);
while(EOF != fscanf(f, "%8c %1c %1c %7c %1c %10c %52c", firCol, space, secCol, thirCol, forCol, fifCol, comm))
{
pass1(info, firCol, space, secCol, thirCol, forCol, fifCol, comm);
}