write a program in c that reads a file of a subset of lc 3 instructions translates t 5192548
Write a program in C that reads a file of a subset of LC-3 instructions, translates them into a sequence of machine code written in hex which are stored in the memory starting at the address 0x3000. The instructions allowed in your input program should have the following type of instructions:
1. Load and store instructions : LD, ST, LEA
2. Arithmetic instructions: ADD
3. Logical instructions: AND
4. Branch instructions: BRP, BRZ, BRN, BRNZP, JSR, RET
5. Trap: PUTS 6. Data: FILL, STRINGZ, BLKW
A sample of input file:
.ORIG X3000
LD R1, X
AND R3, R3, #0
LOOP:
ADD R1, R1, #-1
BRp LOOP
JSR FOO
ST R3, RES
LEA R0, Mess
PUTS
HALT
FOO:
ADD R1, R1, #-4
ADD R3, R1, R1
RET
X .FILL #6
RES .BLKW 1
Mess .STRINGZ “Finish n”
.END