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

  Allocate array of n doubles and assign the resulting pointer

The variable dp is to refer to an array of double. Assuming the integer variable n has been assigned a value, declare dp appropriately, allocate an array of n doubles and assign the resulting pointer to dp.

  Evaluates statements of an expression language

Completing and extending the C++ program that evaluates statements of an expression language.

  Create class that allows you to generate number of plants

In your driver, you should create at least 2 different plants, after you instantiate a plant, you should print out the information about the plant, then water the plant at least three times and then print out the plant again.

  Use the lengthof the side as a member variable of the class

write a class including four member functions to compute the areas of an equilateral triangle ,square,hexagon and octagon respectively .Use the lengthof the side as a member variable of the class.

  This function should accept a two-dimensional

getLowestInRow. This function should accept a two-dimensional array as its argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the lowest value in the specif..

  Write function compute square root together with prototype

Write a C++ function called compute together with its prototype that is passed 2 integers, A and B and returns the square root of A2+B2 ,as a double.

  The overloaded assignment operator.

You have a class called MyBag that contains this partial implementation of the overloaded assignment operator.  The first line is missing.

  Write a program that keeps track of important birthdays

Write a program that keeps track of important birthdays. You can implement it with a one-dimensional array with enumeration type indices, a two-dimensional array, or with parallel arrays.

  The agricultural activities that contribute to a global

The agricultural activities that contribute to a global increase of greenhouse gases in the atmosphere.

  Convert celsius temperatures to fahrenheit temperatures

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

  Write a program that inputs a line of text into char

8.6 (Displaying Strings in Uppercase and Lowercase) Write a program that inputs a line of text into char array s[100]. Output the line in uppercase letters and in lowercase letters.

  Write a simple guessing game

In this lab, you will write a simple guessing game. The computer will generate a random integer within a valid specified range, inclusive (min, max) read in from a text file

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