Question: Write pass one of a two-pass assembler for the SIC assembler language program. It should be written in C language and be able to compile

Write pass one of a two-pass assembler for the SIC assembler language program. It should be written in C language and be able to compile and run in linux environment.

Write pass one of a two-pass assembler for the SIC assembler language

program. It should be written in C language and be able to

compile and run in linux environment. Pass one will read each line

Pass one will read each line of the source file, and begin the process of translating it to object code. (Note: it will be to your advantage to have a separate procedure handle reading, and perhaps tokenizing, the source file.) Among other things, this pass will create the symbol table. At the end of the pass, the symbol table should be printed, showing each symbol together with its location. This pass must also recognize and handle the assembler mnemonics in addition to the directives START, END, BYTE, WORD, RESB, and RESW. It should also be able to recognize the following types of errors (note that this is not an exhaustive list) Duplicate labels Illegal label Illegal operation Missing or illegal operand on data storage directive Missing or illegal operand on START directive Missing or illegal operand on END directive (note: you do not need to check if the symbol is defined) Too many symbols in source program Program too long (note: could specify why it is illegal, but not necessary) r assembler should continue processing the source file so that all errors are flagged After flagging an error, you in a single run. These errors will not be printed, but must be passed to the second pass of the assembler NOTE: Your assembler should not terminate abnormally because of anything (legal or not) in the source program being assembled. Since some processing must take place on each line during pass one, is advantageous to save this information in an intermediate file for use by pass two. Some things you may wish to place in this file are copy of source line value of location counter values of mnemonics used (since they had to be looked up) operand (since you had to get it) error messages (from pass 1 best to use codes and not the actual message) This information should be easy to retrieve that is, you should not have to break up anything to get this saved information. Note that pass two will do the actual encoding of the opcode and operand into object code, and create the listing file together with all error messages. . A documented listing of the assembler source code nd in: Two listings of assembler language source files (one with no errors, one with errors). 3. A listing of the symbol tables produced. . Copies of both intermediate files (write on the printout to indicate the salient features) Pass one will read each line of the source file, and begin the process of translating it to object code. (Note: it will be to your advantage to have a separate procedure handle reading, and perhaps tokenizing, the source file.) Among other things, this pass will create the symbol table. At the end of the pass, the symbol table should be printed, showing each symbol together with its location. This pass must also recognize and handle the assembler mnemonics in addition to the directives START, END, BYTE, WORD, RESB, and RESW. It should also be able to recognize the following types of errors (note that this is not an exhaustive list) Duplicate labels Illegal label Illegal operation Missing or illegal operand on data storage directive Missing or illegal operand on START directive Missing or illegal operand on END directive (note: you do not need to check if the symbol is defined) Too many symbols in source program Program too long (note: could specify why it is illegal, but not necessary) r assembler should continue processing the source file so that all errors are flagged After flagging an error, you in a single run. These errors will not be printed, but must be passed to the second pass of the assembler NOTE: Your assembler should not terminate abnormally because of anything (legal or not) in the source program being assembled. Since some processing must take place on each line during pass one, is advantageous to save this information in an intermediate file for use by pass two. Some things you may wish to place in this file are copy of source line value of location counter values of mnemonics used (since they had to be looked up) operand (since you had to get it) error messages (from pass 1 best to use codes and not the actual message) This information should be easy to retrieve that is, you should not have to break up anything to get this saved information. Note that pass two will do the actual encoding of the opcode and operand into object code, and create the listing file together with all error messages. . A documented listing of the assembler source code nd in: Two listings of assembler language source files (one with no errors, one with errors). 3. A listing of the symbol tables produced. . Copies of both intermediate files (write on the printout to indicate the salient features)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!