Question

NEED HELP WITH THIS . Write a MARIE assembly language program that would simulate calling and exe...

NEED HELP WITH THIS .

Write a MARIE assembly language program that would simulate calling and executing the following C function, as shown below: z = someFunction(a, b); where z, a and b are main( ) program variables, and the values stored in a and b are input by the user. The value stored in z will be output. Did your program execute correctly? This is the code for the function: int someFunction(int x, int y) { return 3 * x – 2 * y; }

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Zero, DEC 0
X, DEC 2
Y, DEC 5
One, DEC1

1. LoadX // load X first
2. SubtOne // subtract one from X
3. Skipcond800 / skip if X-1 > 0 // if X-1 > 0
then skipcondition as 800
4.JumpL1 // otherwise jump L1
5.LoadX // loadX
6.AddX // add X value To X again
7.StoreY // store the value in Y
8.LoadZero // load the value 0
9.StoreX //store the value in X
10.L1: LoadY // load the value in Y
11.AddOne // add one to Y
12.StoreY //store the value Y-> Y+1
13.Halt // end

Add a comment
Know the answer?
Add Answer to:
NEED HELP WITH THIS . Write a MARIE assembly language program that would simulate calling and exe...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a parity checker for the ASCII system in MARIE. MARIE is an assembly language. The...

    Write a parity checker for the ASCII system in MARIE. MARIE is an assembly language. The parity checker should repeatedly execute a loop that performs the following tasks: 1. Ask the user for an input X, which can be any printable ASCII character; 2. Output the decimal code of X; 3. Output the total number of 1’s that appears in the binary code of X; 4. Output the parity bit which, when added to the binary code of X, will...

  • Using the MARIE computer assembly language, write a program that computes the following expression: z =...

    Using the MARIE computer assembly language, write a program that computes the following expression: z = a * b * c. The computer will read in the input values a, b, and c from the keyboard and the final result (z) have to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Remember that the instruction set does not have an instruction to execute multiplication. The program must be tested...

  • Write MARIE assembly language programs that do the following: I. Write a program that inputs thre...

    Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...

  • Using the MARIE computer assembly language, write a program that computes the following expression: z ß...

    Using the MARIE computer assembly language, write a program that computes the following expression: z ß (a * b) * (c * d). The computer will read in the input values a, b, c, and d from the keyboard, and the final result (z) has to be displayed. In addition, every time an input value is read in, it must be displayed on the screen. Each time a multiplication of two numbers is needed, it has to be done using...

  • Using a programming language of your choice, write a complete and fully functional program that uses...

    Using a programming language of your choice, write a complete and fully functional program that uses reference and pointer types to swap two integer numbers. The two numbers are read in separately by the program’s user. Use a proper prompt for each number read in. a. Use one function that uses formal parameter reference type to swap the two numbers b. Use another function that uses formal parameter pointer type to swap the two numbers. c. In the main or...

  • need help converting a code in c++ over into MARIE assembly language // C++ program to...

    need help converting a code in c++ over into MARIE assembly language // C++ program to find (a^b) mod n for 'a' #include<bits/stdc++.h> using namespace std; // calculate a%n unsigned int aModM(string s, unsigned int mod) {    unsigned int number = 0;    for (unsigned int i = 0; i < s.length(); i++)    {        // (s[i]-'0') gives the digit value and form        // the number        number = (number*10 + (s[i] - '0'));...

  • Write MARIE assembly language programs that do the following: Write a program that inputs an integer...

    Write MARIE assembly language programs that do the following: Write a program that inputs an integer and prints to output a countdown from the integer to 0. For example, if 7 is input: 7 6 5 4 3 2 1 0

  • Four Integer Stats Write an ARM Assembly Language (I will not accept Intel Assembly code) program...

    Four Integer Stats Write an ARM Assembly Language (I will not accept Intel Assembly code) program to prompt the user to enter four integers. Have your program output to the screen the four integers that were entered at the keyboard, along with the following: sum of the four integers, smallest value, largest value, and the average of the four values. You must utilize the scanf function for reading in the user input and the printf function for outputting the results...

  • Convert the following code in to ARM assembly language. Triple Max // Return max of three...

    Convert the following code in to ARM assembly language. Triple Max // Return max of three variables int max(int a, int b, int c) { // Fill in your own code for this function } int main() { // Use registers for local variables int x = 10; int y = 5; int z = 20; int max = max(x, y, z); printf("max = %d\n", max); return 0; }

  • 1. [2 points] Write a MIPS assembly language program of the following C function and the...

    1. [2 points] Write a MIPS assembly language program of the following C function and the code to call the function: int leaf_example (int g, h, i, j) { int f; f = (g + h) - (i + j); return f; مهه Arguments g, h, i, and j are passed to the function in registers $a0, $al, Şa2, and $a3, respectively while f in $50 (hence, need to save $50 on stack), and the result is to be stored...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT