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

  Design a class called complex

Design a class called Complex. The class enables operations on so called complex numbers. These are numbers of the form realPart + imaginaryPart *i, where the i has the value

  Presented a number of recurrence relations

For this problem set, you will be presented a number of recurrence relations and asked to state their actual time complexity, showing your work in the process.

  Aimthis assignment is designed to apply your knowledge on

aimthis assignment is designed to apply your knowledge on microcontroller to build a traffic light system. you are

  Write a program to find the middle element in a linked list

1. Write a program to check if there is a loop in a linked list. Create a loop in a linked list and use your method 'isLoop' to identify that the loop exists. The method isLoop should return a Boolean type.2.

  Create the need matrix

Creating a system having five process from p0 to p4 and five resource types.

  Viewer features of the application

Sharon has started to use both the stock details management and the file information viewer features of the application. However, while using the file information viewer application, she accidentally enters the path of a folder that does not exist..

  Find the largest element and print out the index and value

Write a function maxv() that returns the largest element of a vector argument. Find the largest element and print out the index and value.

  1 what is the output of the following c programsnbspinclude

1. what is the output of the following c programs?nbspinclude ltiostreamgtusing namespace stdint mainnbspnbspnbsp cout

  Write a program that asks the user to enter two numbers

Write a program that asks the user to enter two numbers. The program should use the conditional operator to find which number is the smaller and which is the larger.

  Construct vector and linked lists data structures

You will prepare sorted versions of the Linked Lists and Vector data structures developed in class

  Develop a data representation for the current position

Develop a data representation for the current position of the ball. The position is best described with a pair of positive integers. Develop a data representation for velocity of the ball. You may assume that the ball always moves exactly 10 pixe..

  Matching program that takes input from a text file

need to make a string matching program that takes input from a text file and outputs that match (if there is one) asked from the user. i have done this part , the only problem is that , with the output match , i also need to print some words before a..

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