You are required to write a C program to translate LC-3's AND and ADD assembly language instructions into machine code. The detailed requirements are as below:
1. The assembly instructions are stored in a file. Each line of the file stores exactly oneinstruction. The name of the file should be provided to the program as a command line argument.
2. For this part, it should be assumed that the operands of the instructions only use the"register" addressing mode. That is, the values of all the operands are stored in registers.
3. It should be assumed that (a) the instructions are valid AND or ADD instructions, (b)there is exactly one space separating the opcode and the operands of the instruction, (c) the operands are separated by exactly one comma ",", and, (d) all the characters in the instruction are lower case letters.
4. The machine code should be displayed as a 4-digit hexadecimal number.
5. Name this program as part1.c
Here is an example of the execution of the program. In this example, the name of the file containing the instructions is source1. The contents of source1 are: add r1,r2,r3 and r0,r4,r5
The execution of the program is shown below. The command line argument is marked in red.
$ ./part1 source1
1283
5105