Use NASM x86 bit for the assembly code CmpE102 Fall 2017 HW4 Pg. 1 CmpE102 Fall
ID: 3605759 • Letter: U
Question
Use NASM x86 bit for the assembly code
CmpE102 Fall 2017 HW4 Pg. 1 CmpE102 Fall 2017 Homework 4 Due Date: 6 Nov You may work as a team of up to 3 people on the homework assignments. Turn in one solution with all names on it. It is expected that all students participate in the solution, and that all students will be able to solve similar problems on an examination. Assume all variables are signed 32-bit quantities, except for when you can tell they are characters. Topic: Function calls in UNIX Write assembly code to implement the following function calls, using C/UNIX calling conventions. Show the contents of the stack on entering the called function. 1. int myfunl (int,int,int,char); //prototype myfunl (d,a,5, 'm'); //function call 2. int myfunc2 (int,char); //prototype char [] bob-"Bob's your uncle!"; myfunc2 (18, bob); 1000); //function call 3. printf ("CSU presidents get a car allowance of $d per month ", Show the contents of the stack after entering the following functions. Label the EBP offsets of ariables 4. int myfun3 (int i, int j) int m, n, p; 5. int myfun4 (int m, int n, int p) [ int a-0, b-19, c[41;Explanation / Answer
Ans:
#include <stdio.h>
static void Main()
{
int myfunc1(int a,int b,int c,char d)
{
printf("The entered no. s are ",%d,%d,%d,%c);
}
int myfunc2(int i,char* j)
{
printf("The entered no. s are ",%d%c);
}
int myfunc3(int i,int j)
{
printf("The entered no. s are ",%d%d);
}
int myfunc4(int m,int n,int p)
{
printf("The entered no. s are ",%d%d%d);
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.