Write c programs to implement some of the functions

Assignment Help C/C++ Programming
Reference no: EM13925501

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

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

Part 3

Expand your program in Part 2 to allow instruction JMP to be converted. Name this program as part3.c

Part 4

Expand your program in Part 3 to allow instruction LD to be converted.

• It should be assumed that the symbol table of the assembly language program is stored in a file. Each line of the file contains a symbol and its corresponding address. The symbol and its address are separated by exactly one space. It should be assumed that the address is a hexadecimal number.

• The name of the file containing the symbol table should be provided as the second command line argument of the program.

• The starting address of the program should be given as the third command line argument of the program.

• Name this program as part4.c

Part 5

Expand your program in Part 4 to allow instruction BR to be converted. Name this program as part5.c

Reference no: EM13925501

Questions Cloud

Least squares regression line : In a simple linear regression, the least squares regression line is (a) the line which makes the sample correlation as close to +1 or -1 as possible. (b) the line which best splits the data in half, with half of the data points lying above the reg..
Biltmore national bank : The Biltmore National Bank raised capital through the sale of $100 million face value of 8% coupon rate, 10-year bonds. The bonds paid interest semiannually and were sold at a time when equivalent risk-rated bonds carried a yield rate of 10%.
What information ratio could a sponsor achieve by employing : What must Manager B's skill level be to match Manager A's information ratio? What information ratio could a sponsor achieve by employing both managers, assuming that Manager B has a skill level of 8 percent?
The constraint that represents this condition : A baker uses organic flour from a local farmer in all of his baked goods. For each batch of bread (x1), he uses 4 lbs. For a batch of cookies (x2), he uses 3 pounds, and for a batch of muffins (x3) he uses 2 pounds. The local farmer can supply him wi..
Write c programs to implement some of the functions : 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: The assembly instructions are stored in a file. Each line of the file stores exactly on..
Chris walker-department of business : Please read Chapter 9's Case Study on pages 293-294 in your textbook. This case actually did happen. However, the names have been changed for confidentiality. Thus, you cannot go to the college Website where the case actually happened. Therefore, go ..
Calculate the net pay for both chad and jordan for december : What amounts will BJ's report on the 2013 W-2s for each employee?
The initial cost of project : The initial cost of a project is $10,000. There is a 30% chance that it will be highly successful, in which case cash inflows of $4,500 are expected for the next four years. There is a 70% chance that the project will be unsuccessful, in which case a..
Write a program with main() method that tests the examgrade : Create a new student with valid first/last name, invalid id, and valid status.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd