11 May 1 Note: You will be using the GNU compiler gc
1 Note: You will be using the GNU compiler gcc. Therefore, you must ensure that your program compile and run on your system. You are required to write C programs to implement some of the functions of the LC-3 assembler. That is, the programs covert LC-3 assembly instructions to machine code. Part 1 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 one instruction. 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 2 Part 2 Expand your program in Part 1 to allow the operand use the “immediate” addressing mode. That is, the value of an operand is stored in the instruction. It should be assumed that the value operand is given as a decimal number. Name this program as part2.c Here is an example of the execution of the program. In this example, the name of the file containing the instructions is source2. The contents of source2 are: add r1,r2,r3 and r0,r4,r5 add…
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
