Question

questions from my assembly book.

12 Assembly Subroutines . OBLEMS 121 122 123 When a instructio Which instruction is used to call a function? struction is used to return from a function? call instruction is executed, how does the processor know how to get back to where t came from? 12.4 Which registers are used for passing arguments? 5 Which registers are used for returning results? 126 Which registers must be preserved before using? 12.7 What instructions can be used to save and restore register value on the stack? 128 Show the instruction to allocate 12 bytes on the stack. 129 Show the instruction to free 12 bytes on the stack 12.10 For the following C language program, which registers are used to pass the argument values of 3, 5 and 7? int add3 (int a, int b, int c); int main (void) int c; c add3 (3, 5, 7); return 0 or the above C language program, which register is used to return the results from the function add3? 12.9 Fundamentals

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
questions from my assembly book. 12 Assembly Subroutines . OBLEMS 121 122 123 When a instructio...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how...

    Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines (also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer. MIPS has special registers to send information to and from a subroutine. The registers $a0,...

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

  • Convert this C++ program to x86 assembly language using the Irvine library: #include <iostream> unsigned int...

    Convert this C++ program to x86 assembly language using the Irvine library: #include <iostream> unsigned int x; unsigned int c; unsigned int result; // f(x) = 8x + c // Make sure to push and pop all necessary registers to the stack to // ensure only the EAX register is modified upon return from the function unsigned int Equation(unsigned int x, unsigned int c) { // You CANNOT use the mul or imul operations to perform the multiplication return (8...

  • Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment...

    Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment BEGINS Here | ;+======================================================================+ segment .data ;Code this expression: sum = num1+num2 num1 dq 0 ;left operand of the addition operation num2 dq 0 ;right operand of the addition operation sum dq 0 ;will hold the computed Sum value RetVal dq 0 ;Integer value RETURNED by function calls ;can be ignored or used as determined by the programmer ;Message string prompting for the keyboard...

  • Need to write a MIPS assembly program that finds the minimum and maximum and sum of...

    Need to write a MIPS assembly program that finds the minimum and maximum and sum of a stored array. It also finds the locations of the minimum and maximum. The interaction between the main program and the function is solely through the stack. The function stores $ra immediately after being called and restores $ra before returning to main. The main program reserves a static C like array (index starts from 0) of 10 elements and initializes it. The maximum should...

  • PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs...

    PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs to:             -define a recursive procedure/function and call it.             -use syscall operations to display integers and strings on the console window             -use syscall operations to read integers from the keyboard. Assignment Description: Implement a MIPS assembly language program that defines "main", and "function1" procedures. The function1 is recursive and should be defined as: function1(n) = (2*n)+9                      if n <= 5              =...

  • QUESTION 11 Which instruction is used to return from a user function to its caller? return...

    QUESTION 11 Which instruction is used to return from a user function to its caller? return eret jal jr 1 points    QUESTION 12 Which of the following is the best description of memory mapped input/output (MMIO)? the ability to use a common address space to access memory as well as input/output devices. the ability to read characters from the keyboard the ability to interrupt the CPU when the result of an operation involving an IO device is complete. the...

  • ASSEMBLY LANGUAGE (Mars MIPS) Starting code: Factorial: #Factorial Recursive function subu $sp, $sp, 4 sw $ra,...

    ASSEMBLY LANGUAGE (Mars MIPS) Starting code: Factorial: #Factorial Recursive function subu $sp, $sp, 4 sw $ra, 4($sp) # save the return address on stack beqz $a0, terminate # test for termination subu $sp, $sp, 4 # do not terminate yet sw $a0, 4($sp) # save the parameter sub $a0, $a0, 1 # will call with a smaller argument jal Factorial # after the termination condition is reached these lines # will be executed lw $t0, 4($sp) # the argument I...

  • You know the following assembly code snippet is from a recursive function in C. You also...

    You know the following assembly code snippet is from a recursive function in C. You also know that the stack contents at a particular point in time when we are in the recursive function are shown on the next page. Answer the following questions: a) how many Foo stack frames are on the stack? b) what is the return address back to the function that called Foo for the first time? c) what is the return address back into the...

  • Q3.1 3 Points Upon entry into a routine that has been called from C.printRegs prints the...

    Q3.1 3 Points Upon entry into a routine that has been called from C.printRegs prints the following: rae-24 r81-88 r82-FA 83-08 r84-FA re5-08 re6-24 r27-00 rag=01 ra9=11 r18=85 r11=e3 r 12:00 13:00 14:00 15=7F r16-89 r17-e8 r18-62 r19-FC r26-83 r21-09 r22-A r23-01 r24-20 r25-r26-ea r27-ea r28-34 r29-08 38-C1 r31-08 sreg: C- Z- N-1 V=8 S-1 H T =@ 1-1 What is the value in hex) of the first parameter (assume type int)? Answer using Ox_ notation, including the Ox and...

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