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

  • 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'));...

  • 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; }

  • Marie Assembly Language

    Assembly (MARIE), how can I output my input variables on exit?I am trying to compose an assembly (MARIE) program to output my input variables **on exit**. I am triggering an exit when . (period) is entered. I am transforming the input, and to later display the new value on exit.Some context, FOO will return SBB when ran through Rot-13However, my program is displaying the output on each iteration of my loop. I am instead wanting to not display anything, until . is entered...

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

  • MIPS assembly language Covert this code to MIPS: #include <stdio.h> int function (int a) int main)i...

    MIPS assembly language Covert this code to MIPS: #include <stdio.h> int function (int a) int main)i int x=5 ; int y: y function(x); printf "yd",y); return 0; int function (int a) return 3*a+5; Assumptions: . Place arguments in $a0-$a3 . Place return values in $vO-$v1 Return address saved automatically in $ra . lgnore the stack for this example. (Thus, the function will destroy registers used by calling function

  • In PEP8 code. assembly pep8 code. 30. Write an assembly language program that corresponds to the...

    In PEP8 code. assembly pep8 code. 30. Write an assembly language program that corresponds to the following C+ program #include <iostream> using namespace std; int num; int main() cin >> num: num = num/ 16; cout << "num = " << num << endl; return 0; 21 de

  • I need my c++ code converted to MASM (assembly language). The instructions below: write an assembly...

    I need my c++ code converted to MASM (assembly language). The instructions below: write an assembly program that does the following; 1. count and display the number of words in the user input string. 2. Flip the case of each character from upper to lower or lower to upper. For example if the user types in:   "Hello thEre. How aRe yOu?" Your output should be: The number of words in the input string is: 5 The output string is : hELLO...

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
ADVERTISEMENT