Assembly language instructions into machine code

Assignment Help Programming Languages
Reference no: EM13190981

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 oneinstruction. 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

Reference no: EM13190981

Questions Cloud

How do you restrict a domain on a casio graphing calculator : How do you restrict a domain on a Casio graphing calculator?
How many boxes did the troop sale : elena's daughter sold 102 boxes of girl scout cookies she was told that this amount represnted 5%of the troop sale how many boxes did the troop sale?
Define solution of propionic acid is required to supply : What volume of a 35.0 mM solution of propionic acid is required to supply
What are the probabilities associated with each value : Two balls are randomly chosen from an urn containing 8 white, 4 black, and two orange balls. Suppose that we win PHP 2.00 for each black ball selected and we lose PHP 1.00 for each white ball selected. Let X denotes our winnings. What are the poss..
Assembly language instructions into machine code : The assembly instructions are stored in a file. Each line of the file stores exactly oneinstruction. The name of the file should be provided to the program as a command line argument.
What is average variable and marginal cost : Supposed that firms only variable input is labor when 50 workers are used, the average product of labor is 50, and marginal product of the 50th workers is 75. The wage rate is $80, and the total worker is 75. Wage rate is $80
What is the expected value of the insurance policy : A 30 year old man pays $350 for a one year life insurance policy with coverage of $50,000. If the probability that he will live through the year is 0.9975, what is the expected value of the insurance policy?
Compute the activities of ca : Calculate the activities of Ca2+ and F- in the solution of flourite (CaF2) in pure water at 25C without regard to possible hydrolysis.
Compute the mean, variance and standard deviation : Compute the mean, variance, and standard deviation.

Reviews

Write a Review

Programming Languages Questions & Answers

  Use shared mutex for synchronization and locking mechanism

Execute two programs of matrix multiplication with thread programming. Use the shared mutex for synchronization and locking mechanism.

  Write a loop that will show the price of silver and gold

Write a C++ program that displays a table showing the price of silver and gold. The table will have three columns. The first column will be labeled Ounces, the second labeled Silver

  Write a perl program

Write perl program which will run on my system and will start another perl program on another linux system. The main program should wait for linux perl program to complete its work and send the result to my main perl program.

  Program to accept inputs from user beginning temperature

Physicists tell us that lowest possible temperature is absolute zero. Absolute zero is -459.69 degrees Fahrenheit. Accept inputs from user: a beginning temperature, ending temperature, and increment value (all Fahrenheit).

  Create form to accept an arrival and departure date

Create a form that accepts an arrival and departure date for a reservation from the user and then calculates the number of nights and the total price for the reservation.

  Use the linked stack class to support

Use the Linked stack class to support an application that tracks the status of an online auction. Budding begins at 1(dollars, pounds, euros, or whatever) and proceeds in increments of at least 1

  Calculates and displays the property tax

Write a java application that calculates and displays the property tax for N property owners. N should be declared as a constant and it should be equal to the largest digit of your student ID number

  Create xml document to mark nutrition facts for cookies

Create an XML document that marks up the nutrition facts for a package of Grandma White's cookies. A package of cookies has a serving size of 1 package and the following nutritional value per serving.

  What is unixs main philosophy

Describe and critically evaluate the similarities between the Windows and Unix operating systems - what are some of the advantages of running UNIX and what is UNIX's main philosophy

  Write down a method which is passed string argument

Write down a method, getFirstLine, which is passed a String argument and that returns first line. (Recall that lines are terminated with the "n" character.)

  Design application that would output payment coupons

Design the application that would output 12 payment coupons for each of the 15 apartments in each of the 20 buildings. Each coupon should contain the building number.

  Hubspot: inbound marketing and web 2.0

Hubspot: Inbound Marketing and Web 2.0

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